otp.Source.modify_symbol_name#

Source.modify_symbol_name(symbol_name, inplace=False)#

Modifies the name of the symbol that provides input ticks for this node. Uses MODIFY_SYMBOL_NAME EP.

Parameters
  • symbol_name (str, Column, Operation) – String or expression with new SYMBOL_NAME value. New SYMBOL_NAME must not depend on ticks, if set via expression.

  • inplace (bool) – The flag controls whether operation should be applied inplace or not. If inplace=True, then it returns nothing. Otherwise method returns a new modified object.

  • self (Source) –

Return type

Source or None

Examples

Replacing with static string:

>>> data = otp.DataSource('SOME_DB', symbol='S1', tick_type='TT')
>>> data = data.modify_symbol_name(symbol_name='S2')
>>> otp.run(data)
                     Time   X
0 2003-12-01 00:00:00.000  -3
1 2003-12-01 00:00:00.001  -2
2 2003-12-01 00:00:00.002  -1

Replacing with expression:

>>> data = otp.DataSource('SOME_DB', symbol='S2', tick_type='TT')
>>> data = data.modify_symbol_name(symbol_name=data['_SYMBOL_NAME'].str.replace('2', '1'))
>>> otp.run(data)
                     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

See also

MODIFY_SYMBOL_NAME OneTick event processor