[R-SIG-Finance] Quantstrat - extracting current symbol
oskar.gottlieb at lenzglobal.com
Fri May 12 12:07:25 CEST 2017
Thanks for the quick reply!
I was aware of the instrument objects, I just did not know there were the
instrument_attr(), instrument.table() functions. This solves the need for
external meta info dataframe, which is extremely convinient.
The best way to get the attribute then, would be to call
About add.indicator - I did a poor job explaining what I was trying to
achieve, but it's exactly what you're saying. I will create a new indicator
function, which will get some metadata from the instrument and all of that
will be handled inside the indicator function, there is no need to pass it
as a parameter to the add.indicator function.
2017-05-12 11:16 GMT+02:00 Brian G. Peterson <brian at braverock.com>:
> On 05/12/2017 03:58 AM, Oskar Gottlieb wrote:
>> I have multiple symbols (futures contracts) of one product and I would
>> to access a data frame with their meta information. I would then parse the
>> meta info into an add.indicator argument list. Is there a function, which
>> would return the current symbol over which we are looping?
> quantstrat would expect the metadata for these symbols to be in
> FinancialInstrument, not in a data.frame. That is where quantstrat and
> blotter expect to get things like tick size, multiplier, expiration date,
> and currency for each instrument.
> Inside quantstrat, there will always be a 'symbol' variable which you
> could access to find out what symbol is currently being processed (unless
> we're in a rebalancing rule, when that doesn't apply).
> What I would recommend is to put all your instrument metadata in
> FinancialInstrument (since that is what it is for) and have your indicator
> and signal functions access that data with
> To further guess at what you're trying to do, you talk about using this
> list for add.indicator. I don't understand what you're trying to do with
> that statement. The strategy object is a specification of how the strategy
> will work. The indicators, signals, and rules should all work on the
> mktdata passed to them by the applyStrategy function (and inside that by
> applyIndicators, applySignals, applyRules). So any call to add.indicator
> should be generic for the entire strategy specification.
> If you wanted an indicator to do something different based on tenor or
> days to expiration, for example, you'd handle that inside the indicator
> function, not as parameters to the call to add.indicator. (probably after
> calling getInstrument to get the metadata, as described above).
> If this hasn't answered your question, perhaps you could follow up with
> something more specific including a *minimal* example.
> Brian G. Peterson
> Ph: 773-459-4973
> IM: bgpbraverock
> R-SIG-Finance at r-project.org mailing list
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions
> should go.
[[alternative HTML version deleted]]
More information about the R-SIG-Finance