[R-SIG-Finance] blotter->chart.Posn -- 'no transactions/position to chart'
Mark Knecht
markknecht at gmail.com
Thu Nov 21 21:09:10 CET 2013
On Thu, Nov 21, 2013 at 11:58 AM, Joshua Ulrich <josh.m.ulrich at gmail.com> wrote:
> On Thu, Nov 21, 2013 at 1:38 PM, Mark Knecht <markknecht at gmail.com> wrote:
>> On Thu, Nov 21, 2013 at 11:08 AM, Mark Knecht <markknecht at gmail.com> wrote:
>> <SNIP>
>>>
>>> chart.Posn("Equity", Symbol = "VTI", Dates = "2001-06-15")
>>
>> Note that my Dates entry there is possibly meaningless, I'm not sure.
>> Most examples I've seen on the web would do something like
>>
> Yes, setting Dates to a single observation is unlikely to ever work.
>
>> chart.Posn("Equity", Symbol = "VTI", Dates = "2001::")
>>
>> which produces the same error. I also get the same error if I remove
>> the Dates= option completely.
>>
> That's because you only have one transaction. chart.Posn currently
> requires at least two transactions before it can plot anything.
> Perhaps we could add a "includeOpenTrade" argument like perTradeStats
> has... at bare minimum, the error could be a bit more informative.
>
> Best,
> --
> Joshua Ulrich | about.me/joshuaulrich
> FOSS Trading | www.fosstrading.com
Hi Joshua,
OK, I'm sort of laughing out loud here as I don't think my solution
is what you really intended I do but you are correct, a single
purchase of 100 shares fails where as 2 purchases of 50 shares on the
same date, as in:
addTxn("Equity", Symbol = "VTI", TxnQty = 50, TxnPrice = 47.41,
TxnDate = "2001-06-18", TxnFees = 0, verbose = FALSE)
addTxn("Equity", Symbol = "VTI", TxnQty = 50, TxnPrice = 47.41,
TxnDate = "2001-06-18", TxnFees = 0, verbose = FALSE)
actually works just fine. The position is now 100 shares and
chart.Posn draws the chart correctly as best I can tell.
None the less thanks VERY much for the quick answer.
Cheers,
Mark
More information about the R-SIG-Finance
mailing list