[R-SIG-Finance] blotter getting getEndEq(account, CurrentDate) by Symbol

Immanuel mane.desk at googlemail.com
Mon Feb 28 01:13:04 CET 2011


Hello again,

I'm still trying to get the current end equity for one symbol.
What is the smartest way to accomplished that?
I figured out that:
getPortfolio("turtles")$symbol[symbol]
produces the output below. So I was hoping that
sum(getPortfolio("turtles")$symbol[symbol]$posPL$Net.Trading.PL)
would give me what I want but I got only "NULL" .

Any suggestions? Or is there a simpler way to accomplish
what I want?

I need the end quity for each symbol to calculate the
UnitSize for the next trade since I want to trade each
symbol on its own equity.

regards

--------

Browse[1]> getPortfolio("turtles")$symbol[symbol]
$XLE
$XLE$txn
           Txn.Qty Txn.Price  Txn.Value Txn.Avg.Cost Pos.Qty Pos.Avg.Cost
2008-01-01       0      0.00       0.00         0.00       0         0.00
2008-03-13   10825     76.15  824323.75        76.15   10825        76.15
2008-03-24  -10825     72.05 -779941.25        72.05       0         0.00
2008-03-25     385     72.77   28016.45        72.77     385        72.77
           Gross.Txn.Realized.PL Txn.Fees Net.Txn.Realized.PL Con.Mult
2008-01-01                   0.0        0                 0.0        0
2008-03-13                   0.0        0                 0.0        1
2008-03-24              -44382.5        0            -44382.5        1
2008-03-25                   0.0        0                 0.0        1

$XLE$posPL
           Pos.Qty Con.Mult Ccy.Mult Pos.Value Pos.Avg.Cost Txn.Value
2008-01-01       0        1        1       0.0         0.00       0.0
2008-03-13   10825        1        1  824323.8        76.15  824323.8
2008-03-14   10825        1        1  809277.0        76.15       0.0
2008-03-17   10825        1        1  781023.8        76.15       0.0
2008-03-18   10825        1        1  815122.5        76.15       0.0
2008-03-19   10825        1        1  765327.5        76.15       0.0
2008-03-20   10825        1        1  766518.2        76.15       0.0
2008-03-24       0        1        1       0.0         0.00 -779941.2
           Period.Realized.PL Period.Unrealized.PL Gross.Trading.PL Txn.Fees
2008-01-01                0.0                 0.00             0.00        0
2008-03-13                0.0                 0.00             0.00        0
2008-03-14                0.0            -15046.75        -15046.75        0
2008-03-17                0.0            -28253.25        -28253.25        0
2008-03-18                0.0             34098.75         34098.75        0
2008-03-19                0.0            -49795.00        -49795.00        0
2008-03-20                0.0              1190.75          1190.75        0
2008-03-24           -44382.5             57805.50         13423.00        0
           Net.Trading.PL
2008-01-01           0.00
2008-03-13           0.00
2008-03-14      -15046.75
2008-03-17      -28253.25
2008-03-18       34098.75
2008-03-19      -49795.00
2008-03-20        1190.75
2008-03-24       13423.00

$XLE$posPL.USD
           Pos.Qty Con.Mult Ccy.Mult Pos.Value Pos.Avg.Cost Txn.Value
2008-01-01       0        1        1       0.0         0.00       0.0
2008-03-13   10825        1        1  824323.8        76.15  824323.8
2008-03-14   10825        1        1  809277.0        76.15       0.0
2008-03-17   10825        1        1  781023.8        76.15       0.0
2008-03-18   10825        1        1  815122.5        76.15       0.0
2008-03-19   10825        1        1  765327.5        76.15       0.0
2008-03-20   10825        1        1  766518.2        76.15       0.0
2008-03-24       0        1        1       0.0         0.00 -779941.2
           Period.Realized.PL Period.Unrealized.PL Gross.Trading.PL Txn.Fees
2008-01-01                0.0                 0.00             0.00        0
2008-03-13                0.0                 0.00             0.00        0
2008-03-14                0.0            -15046.75        -15046.75        0
2008-03-17                0.0            -28253.25        -28253.25        0
2008-03-18                0.0             34098.75         34098.75        0
2008-03-19                0.0            -49795.00        -49795.00        0
2008-03-20                0.0              1190.75          1190.75        0
2008-03-24           -44382.5             57805.50         13423.00        0
           Net.Trading.PL
2008-01-01           0.00
2008-03-13           0.00
2008-03-14      -15046.75
2008-03-17      -28253.25
2008-03-18       34098.75
2008-03-19      -49795.00
2008-03-20        1190.75
2008-03-24       13423.00
----------------------

On 02/27/2011 10:19 PM, Brian G. Peterson wrote:
> On 02/27/2011 03:13 PM, Immanuel wrote:
>> Hello all,
>>
>> I'm desperedly trying to getEndEq(account, CurrentDate) for
>> one symbol. I found that .getBySymbol() internal is used by
>> PortfReturns() but I only got:
>>
>>> .getBySymbol(Portfolio = Portfolio, Attribute = "Net.Trading.PL",Dates
>> = CurrentDate)
>> Error: could not find function ".getBySymbol"
>>
>> which I don't understand since ?.getBySymol shows the R Help
>>
>> can anyone help me out?
>>
>> thanks&  regards,
>> Immanuel
>
> the .functions are not exported, so you need to call it explicitly
>
> blotter:::.getBySymbol
>
>



More information about the R-SIG-Finance mailing list