otp.eval#
- eval(query, symbol=None, start=None, end=None, **kwargs)[source]#
Bind symbol parameter to otp.query or otp.Query and Source for later use
- Parameters
query (otp.Source, otp.query) –
symbol (symbol) –
start (meta field (otp.Source.meta_fields) or symbol param) –
end (meta field (otp.Source.meta_fields) or symbol param) –
kwargs (will be passed to query. Allowed params: strings, numbers, otp.Source meta fields, symbol params) –
- Returns
result – Query wrapper
- Return type
_QueryEvalWrapper
Examples
>>> def fsq(symbol): ... symbols = otp.Tick(SYMBOL_NAME=symbol.name + '1') ... return symbols >>> def main(symbol): ... data = otp.DataSource(db='SOME_DB', tick_type='TT') ... data = otp.funcs.merge([data], symbols=otp.eval(fsq, symbol=symbol)) ... return data >>> otp.run(main, symbols='S') Time X 0 2003-12-01 00:00:00.000 1 1 2003-12-01 00:00:00.001 2 2 2003-12-01 00:00:00.002 3