otp.Source.__setitem__#

Source.__setitem__(key, value)#

Add new column to the source or update existing one.

Parameters

Examples

>>> data = otp.Tick(A='A')
>>> data['D'] = otp.datetime(2022, 2, 2)
>>> data['X'] = 1
>>> data['Y'] = data['X']
>>> data['X'] = 12345
>>> data['Z'] = data['Y'].astype(str) + 'abc'
>>> otp.run(data)
        Time  A          D      X  Y     Z
0 2003-12-01  A 2022-02-02  12345  1  1abc

See also

ADD_FIELD OneTick event processor
UPDATE_FIELD OneTick event processor