onetick-py 1.162.2__py3-none-any.whl → 1.163.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
onetick/py/_version.py CHANGED
@@ -1,2 +1,2 @@
1
1
  # This file was generated automatically. DO NOT CHANGE.
2
- VERSION = '1.162.2'
2
+ VERSION = '1.163.0'
@@ -31,7 +31,9 @@ _column_doc = param_doc(
31
31
  _running_doc = param_doc(
32
32
  name='running',
33
33
  desc='''
34
- Aggregation will be calculated as sliding window.
34
+ See :ref:`Aggregation buckets guide <buckets_guide>` to see examples of how this parameter works.
35
+
36
+ Specifies if the aggregation will be calculated as a sliding window.
35
37
  ``running`` and ``bucket_interval`` parameters determines when new buckets are created.
36
38
 
37
39
  * ``running`` = True
@@ -45,10 +47,10 @@ _running_doc = param_doc(
45
47
 
46
48
  * ``bucket_interval`` = 0
47
49
 
48
- Left boundary of window will be bound to start time. For each tick aggregation will be calculated in
49
- [start_time; tick_t].
50
+ Left boundary of window will be set to query start time. For each tick aggregation will be calculated in
51
+ the interval [start_time; tick_t] from query start time to the tick's timestamp (inclusive).
50
52
 
51
- * ``running`` = False
53
+ * ``running`` = False (default)
52
54
 
53
55
  buckets partition the [query start time, query end time) interval into non-overlapping intervals
54
56
  of size ``bucket_interval`` (with the last interval possibly of a smaller size).
@@ -68,6 +70,8 @@ _running_doc = param_doc(
68
70
  _all_fields_doc = param_doc(
69
71
  name='all_fields',
70
72
  desc="""
73
+ See :ref:`Aggregation buckets guide <buckets_guide>` to see examples of how this parameter works.
74
+
71
75
  * ``all_fields`` = True
72
76
 
73
77
  output ticks include all fields from the input ticks
@@ -95,15 +99,25 @@ _all_fields_doc = param_doc(
95
99
  _all_fields_with_policy_doc = param_doc(
96
100
  name='all_fields',
97
101
  desc="""
102
+ See :ref:`Aggregation buckets guide <buckets_guide>` to see examples of how this parameter works.
103
+
98
104
  - If ``all_fields`` False - output tick will have only aggregation fields.
99
105
 
106
+ - If ``all_fields`` is True and ``running`` is False - additional fields will be copied from the first
107
+ tick in the bucket to the output tick.
108
+
100
109
  - If ``all_fields`` False and ``running`` True - output ticks are created when a tick enters or leaves the
101
110
  sliding window.
102
111
 
103
- - If ``all_fields`` True - an output tick is generated only for arrival events,
112
+ - If ``all_fields`` True and ``running`` True - an output tick is generated only for arrival events,
104
113
  but all attributes from the input tick causing an arrival event are copied over to the output tick
105
114
  and the aggregation is added as another attribute.
106
115
 
116
+ - If ``all_fields`` True and ``running`` "when_ticks_exit_window" -
117
+ an output tick is generated only for exit events,
118
+ but all attributes from the exiting tick are copied over to the output tick
119
+ and the aggregation is added as another attribute.
120
+
107
121
  - If ``all_fields`` set to "first", "last", "high", or "low" - explicitly set tick selection policy for all
108
122
  fields values. For "high" and "low" "PRICE" field will be selected as an input.
109
123
  Otherwise, you will get the runtime error.
@@ -114,7 +128,8 @@ _all_fields_with_policy_doc = param_doc(
114
128
  first parameter.
115
129
  """,
116
130
  default=False,
117
- annotation=Union[Literal[True, False, "first", "last", "high", "low"], HighTick, LowTick]
131
+ str_annotation=("True, False, 'when_ticks_exit_window', 'first', 'last', 'high', 'low', "
132
+ ":py:func:`~onetick.py.agg.high_tick`, :py:func:`~onetick.py.agg.low_tick`"),
118
133
  )
119
134
  _bucket_interval_doc = param_doc(
120
135
  name='bucket_interval',
onetick/py/functions.py CHANGED
@@ -902,8 +902,18 @@ def join_by_time(sources, how="outer", on=None, policy=None, check_schema=True,
902
902
  0 2003-12-01 00:00:00.001 1 0
903
903
  1 2003-12-01 00:00:00.003 2 1
904
904
 
905
- In case you willing to add prefix/suffix to all columns in one of the sources you should use
906
- :func:`Source.add_prefix` or :func:`Source.add_suffix`
905
+ Note
906
+ ----
907
+ In case different ``sources`` have matching columns, the exception will be raised.
908
+
909
+ To fix this error,
910
+ functions :func:`Source.add_prefix` or :func:`Source.add_suffix` can be used to rename all columns in the source.
911
+
912
+ Note that resulting **TIMESTAMP** pseudo-column will be taken from the leading source,
913
+ and timestamps of ticks from non-leading sources will not be added to the output,
914
+ so if you need to save them, you need to copy the timestamp to some other column.
915
+
916
+ See examples below.
907
917
 
908
918
  Parameters
909
919
  ----------
@@ -1047,7 +1057,8 @@ def join_by_time(sources, how="outer", on=None, policy=None, check_schema=True,
1047
1057
 
1048
1058
  Default joining logic, outer join with the first source is the leader by default:
1049
1059
 
1050
- >>> otp.run(otp.join_by_time([d1, d2]))
1060
+ >>> data = otp.join_by_time([d1, d2])
1061
+ >>> otp.run(data)
1051
1062
  Time A B
1052
1063
  0 2003-12-01 00:00:00.001 1 0
1053
1064
  1 2003-12-01 00:00:00.002 2 1
@@ -1055,7 +1066,8 @@ def join_by_time(sources, how="outer", on=None, policy=None, check_schema=True,
1055
1066
 
1056
1067
  Leading source can be changed by using parameter ``leading``:
1057
1068
 
1058
- >>> otp.run(otp.join_by_time([d1, d2], leading=1))
1069
+ >>> data = otp.join_by_time([d1, d2], leading=1)
1070
+ >>> otp.run(data)
1059
1071
  Time A B
1060
1072
  0 2003-12-01 00:00:00.001 1 1
1061
1073
  1 2003-12-01 00:00:00.002 2 2
@@ -1064,7 +1076,8 @@ def join_by_time(sources, how="outer", on=None, policy=None, check_schema=True,
1064
1076
  Note that OneTick's logic is different depending on the order of sources specified,
1065
1077
  so specifying ``leading`` parameter in the previous example is not the same as changing the order of sources here:
1066
1078
 
1067
- >>> otp.run(otp.join_by_time([d2, d1], leading=0))
1079
+ >>> data = otp.join_by_time([d2, d1], leading=0)
1080
+ >>> otp.run(data)
1068
1081
  Time B A
1069
1082
  0 2003-12-01 00:00:00.001 1 0
1070
1083
  1 2003-12-01 00:00:00.002 2 1
@@ -1073,7 +1086,8 @@ def join_by_time(sources, how="outer", on=None, policy=None, check_schema=True,
1073
1086
  Parameter ``source_fields_order`` can be used to change the order of fields in the output,
1074
1087
  but it also affects the joining logic the same way as changing the order of sources:
1075
1088
 
1076
- >>> otp.run(otp.join_by_time([d1, d2], leading=1, source_fields_order=[1, 0]))
1089
+ >>> data = otp.join_by_time([d1, d2], leading=1, source_fields_order=[1, 0])
1090
+ >>> otp.run(data)
1077
1091
  Time B A
1078
1092
  0 2003-12-01 00:00:00.001 1 0
1079
1093
  1 2003-12-01 00:00:00.002 2 1
@@ -1082,26 +1096,48 @@ def join_by_time(sources, how="outer", on=None, policy=None, check_schema=True,
1082
1096
  Parameter ``how`` can be set to "inner".
1083
1097
  In this case only ticks that were successfully joined from all sources will be propagated:
1084
1098
 
1085
- >>> otp.run(otp.join_by_time([d1, d2], how='inner'))
1099
+ >>> data = otp.join_by_time([d1, d2], how='inner')
1100
+ >>> otp.run(data)
1086
1101
  Time A B
1087
1102
  0 2003-12-01 00:00:00.002 2 1
1088
1103
  1 2003-12-01 00:00:00.003 3 2
1089
1104
 
1090
1105
  Set parameter ``match_if_identical_times`` to only join ticks with the same timestamps:
1091
1106
 
1092
- >>> otp.run(otp.join_by_time([d1, d2], how='inner', match_if_identical_times=True))
1107
+ >>> data = otp.join_by_time([d1, d2], how='inner', match_if_identical_times=True)
1108
+ >>> otp.run(data)
1093
1109
  Time A B
1094
1110
  0 2003-12-01 00:00:00.001 1 1
1095
1111
  1 2003-12-01 00:00:00.002 2 2
1096
1112
 
1097
- Adding prefix to right source for all columns:
1113
+ In case of conflicting names in different sources, exception will be raised:
1114
+
1115
+ >>> d3 = otp.Ticks({'A': [1, 2, 4], 'offset': [1, 2, 4]})
1116
+ >>> data = otp.join_by_time([d1, d3])
1117
+ Traceback (most recent call last):
1118
+ ...
1119
+ ValueError: There are matched columns between sources: A
1120
+
1121
+ Adding prefix to right source for all columns will fix this problem:
1098
1122
 
1099
- >>> otp.run(otp.join_by_time([d1, d2.add_prefix('right_')]))
1100
- Time A right_B
1123
+ >>> data = otp.join_by_time([d1, d3.add_prefix('right_')])
1124
+ >>> otp.run(data)
1125
+ Time A right_A
1101
1126
  0 2003-12-01 00:00:00.001 1 0
1102
1127
  1 2003-12-01 00:00:00.002 2 1
1103
1128
  2 2003-12-01 00:00:00.003 3 2
1104
1129
 
1130
+ Note that timestamps from the non-leading source are not added to the output.
1131
+ You can add them manually in a different field:
1132
+
1133
+ >>> d3['D3_TIMESTAMP'] = d3['TIMESTAMP']
1134
+ >>> data = otp.join_by_time([d1, d3.add_prefix('right_')])
1135
+ >>> otp.run(data)
1136
+ Time A right_A right_D3_TIMESTAMP
1137
+ 0 2003-12-01 00:00:00.001 1 0 1969-12-31 19:00:00.000
1138
+ 1 2003-12-01 00:00:00.002 2 1 2003-12-01 00:00:00.001
1139
+ 2 2003-12-01 00:00:00.003 3 2 2003-12-01 00:00:00.002
1140
+
1105
1141
  Use parameter ``output_type_index`` to specify which input class to use to create output object.
1106
1142
  It may be useful in case some custom user class was used as input:
1107
1143
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: onetick-py
3
- Version: 1.162.2
3
+ Version: 1.163.0
4
4
  Summary: Python package that allows you to work with OneTick
5
5
  Author-email: solutions <solutions@onetick.com>
6
6
  License-Expression: MIT
@@ -13,12 +13,12 @@ onetick/lib/__init__.py,sha256=Rp7CIDoA4E6LIm1f2mNvl_5b_n-0U3suA3FmBXbmKoU,114
13
13
  onetick/lib/instance.py,sha256=fifgq2Z915GCGgp6kNCXDrfj71fs--afDGjB4CuL0Cw,4639
14
14
  onetick/py/__init__.py,sha256=yLbgxw7Z4kMndYGNKeHIbjHIF9hljYtizCCivo90cp4,11027
15
15
  onetick/py/_stack_info.py,sha256=PHZOkW_fK7Fbl4YEj5CaYK9L6vh4j-bUU7_cSYOWZ30,2546
16
- onetick/py/_version.py,sha256=aIXXaf_RWoB07KeCbDstweSzIUl50PWZeG8I8m5om6A,76
16
+ onetick/py/_version.py,sha256=p3SkNzZxBzSSVobC0q0xRefLAGkEL34zg4SJcEVa6lQ,76
17
17
  onetick/py/backports.py,sha256=mR00mxe7E7UgBljf-Wa93Mo6lpi-C4Op561uhPUoEt8,815
18
18
  onetick/py/cache.py,sha256=3RjwMA6B-qodMhDe3Fj0lQAU1IE54Vvmeq4gGDiZfz8,12682
19
19
  onetick/py/compatibility.py,sha256=KUBRyt_VayU7UnssXe2q_jOQoqCA4-HwIvUSDl9Xn1M,29696
20
20
  onetick/py/configuration.py,sha256=Cb_tH3F2vKMF27mFtd5TwXxhUA5Axmxp2TR3OKFfmQ0,27497
21
- onetick/py/functions.py,sha256=c80ain2S3GRfjW6NTFawN6QonhaJC5Yf8VKTQT4AOgY,96298
21
+ onetick/py/functions.py,sha256=4KlWXmceJclfkeU5H7I9wUW_KG7NRv0dZWXw6MOhq0Y,97669
22
22
  onetick/py/license.py,sha256=tKdiLK41y38Ome0xgj1Xp37mhCmS_uq-wXD5Z5f7xK8,6068
23
23
  onetick/py/log.py,sha256=Els2drZcVjJrD6kvbwgFGEpg6jAacoUEtyN6rCaauuk,2723
24
24
  onetick/py/math.py,sha256=83w2uoIr-GRC2NsZqvkXXUEgWUDLMA88hdw22f2ibYk,21053
@@ -33,7 +33,7 @@ onetick/py/state.py,sha256=9GC3oMm1CrIjVcAuw77V0GaBZHBcBH6BhZM8QSpTA5w,10085
33
33
  onetick/py/types.py,sha256=EDac7J109ON89ZtlGSPyaUEHpbb1vRTS-Mo9DeabrEk,64390
34
34
  onetick/py/aggregations/__init__.py,sha256=02WnTc9ocTp34OkGyXRHY2QAZi_QjDMHClE5tvx6Gtk,736
35
35
  onetick/py/aggregations/_base.py,sha256=zJL5zYIEmG7XkuWi5kW8m_1JEpohh5kmYbdxGcgvufU,25545
36
- onetick/py/aggregations/_docs.py,sha256=PlJLSoNKf91dk6PXD0TVV7JNQANgOyS7aNXoTXLMU5Y,33539
36
+ onetick/py/aggregations/_docs.py,sha256=-EkfklVrMz80EIDsm5zQ386Gy0dgfnEmG6cG4CUlidE,34492
37
37
  onetick/py/aggregations/compute.py,sha256=GJpR8AWlEmfNsnl-L2oJPuY5rFb6PC-VwLZnnRGtCys,11854
38
38
  onetick/py/aggregations/functions.py,sha256=crwjUb4H7-h66aSY50RwSCcR_OE4vF9mF0gVLaXiXiQ,80798
39
39
  onetick/py/aggregations/generic.py,sha256=7mWRRAPS-t-e_umQc2T3GPPuW1Pia7mKhgjaVB2sSBM,3896
@@ -144,9 +144,9 @@ onetick/py/utils/script.py,sha256=Y8NujEo2_5QaP6KDnLKJiKQ7SmMjw8_dv8sYL9rHDCE,11
144
144
  onetick/py/utils/temp.py,sha256=wp07CiygTZSkifgnE5DGyIm4u8vMHQy7A2NTxKo8k2A,17386
145
145
  onetick/py/utils/types.py,sha256=_tYf66r9JVgjtiCJfxIxrg_BQEjHkjlnck_i86dBYEY,3606
146
146
  onetick/py/utils/tz.py,sha256=QXclESLGU8YXysUT9DXkcBqLWWO47Bb_tanFUzYpPZI,2800
147
- onetick_py-1.162.2.dist-info/licenses/LICENSE,sha256=Yhu7lKNFS0fsaN-jSattEMRtCOPueP58Eu5BPH8ZGjM,1075
148
- onetick_py-1.162.2.dist-info/METADATA,sha256=t52ua8EBWNPKHNiBwnkRJQX3iiRH-kq72xQVu4fo41I,7959
149
- onetick_py-1.162.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
150
- onetick_py-1.162.2.dist-info/entry_points.txt,sha256=QmK_tFswIN-SQRmtnTSBEi8GvT0TVq-66IzXXZIsV3U,81
151
- onetick_py-1.162.2.dist-info/top_level.txt,sha256=Na1jSJmVMyYGOndaswt554QKIUwQjcYh6th2ATsmw0U,23
152
- onetick_py-1.162.2.dist-info/RECORD,,
147
+ onetick_py-1.163.0.dist-info/licenses/LICENSE,sha256=Yhu7lKNFS0fsaN-jSattEMRtCOPueP58Eu5BPH8ZGjM,1075
148
+ onetick_py-1.163.0.dist-info/METADATA,sha256=AeGuiIXB5m5K3wnJ_sTbP1vYU_jtqabefJzh30i7O5Y,7959
149
+ onetick_py-1.163.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
150
+ onetick_py-1.163.0.dist-info/entry_points.txt,sha256=QmK_tFswIN-SQRmtnTSBEi8GvT0TVq-66IzXXZIsV3U,81
151
+ onetick_py-1.163.0.dist-info/top_level.txt,sha256=Na1jSJmVMyYGOndaswt554QKIUwQjcYh6th2ATsmw0U,23
152
+ onetick_py-1.163.0.dist-info/RECORD,,