otp.Source.limit#

Source.limit(tick_limit, inplace=False)#

Propagates ticks until the count limit is reached. Once the limit is reached, hidden ticks will still continue to propagate until the next regular tick appears.

Parameters
  • tick_limit (int) – The number of regular ticks to propagate. Must be a non-negative integer or -1, which will mean no limit.

  • 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

Basic example

data = otp.Ticks(X=[1, 2, 3, 4, 5, 6])
data = data.limit(tick_limit=3)
print(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

Disable limit

data = otp.Ticks(X=[1, 2, 3, 4, 5, 6])
data = data.limit(tick_limit=-1)
print(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
3 2003-12-01 00:00:00.003  4
4 2003-12-01 00:00:00.004  5
5 2003-12-01 00:00:00.005  6

See also

LIMIT OneTick event processor