otp.Empty#

class Empty(db=utils.adaptive_to_default, symbol=utils.adaptive_to_default, tick_type=utils.adaptive, start=utils.adaptive, end=utils.adaptive, schema=None, **kwargs)#

Bases: onetick.py.core.source.Source

Empty data source

Parameters

Examples

We can define schema:

>>> data = otp.Empty(schema={'A': str, 'B': int})
>>> otp.run(data)
Empty DataFrame
Columns: [A, B, Time]
Index: []
>>> data.columns()
{'A': <class 'str'>, 'B': <class 'int'>, 'TIMESTAMP': <class 'onetick.py.types.nsectime'>,
'_START_TIME': <class 'onetick.py.types.nsectime'>, '_END_TIME': <class 'onetick.py.types.nsectime'>,
'_SYMBOL_NAME': <class 'str'>, '_DBNAME': <class 'str'>, '_TICK_TYPE': <class 'str'>, '_TIMEZONE': <class 'str'>}

Or we can get schema from the database:

>>> data = otp.Empty(db='SOME_DB', tick_type='TT')
>>> data.columns()
{'X': <class 'int'>, 'TIMESTAMP': <class 'onetick.py.types.nsectime'>,
'_START_TIME': <class 'onetick.py.types.nsectime'>, '_END_TIME': <class 'onetick.py.types.nsectime'>,
'_SYMBOL_NAME': <class 'str'>, '_DBNAME': <class 'str'>, '_TICK_TYPE': <class 'str'>, '_TIMEZONE': <class 'str'>}