onetick-py 1.162.2__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.
Files changed (152) hide show
  1. locator_parser/__init__.py +0 -0
  2. locator_parser/acl.py +73 -0
  3. locator_parser/actions.py +266 -0
  4. locator_parser/common.py +365 -0
  5. locator_parser/io.py +41 -0
  6. locator_parser/locator.py +150 -0
  7. onetick/__init__.py +101 -0
  8. onetick/doc_utilities/__init__.py +3 -0
  9. onetick/doc_utilities/napoleon.py +40 -0
  10. onetick/doc_utilities/ot_doctest.py +140 -0
  11. onetick/doc_utilities/snippets.py +280 -0
  12. onetick/lib/__init__.py +4 -0
  13. onetick/lib/instance.py +138 -0
  14. onetick/py/__init__.py +290 -0
  15. onetick/py/_stack_info.py +89 -0
  16. onetick/py/_version.py +2 -0
  17. onetick/py/aggregations/__init__.py +11 -0
  18. onetick/py/aggregations/_base.py +645 -0
  19. onetick/py/aggregations/_docs.py +912 -0
  20. onetick/py/aggregations/compute.py +286 -0
  21. onetick/py/aggregations/functions.py +2216 -0
  22. onetick/py/aggregations/generic.py +104 -0
  23. onetick/py/aggregations/high_low.py +80 -0
  24. onetick/py/aggregations/num_distinct.py +83 -0
  25. onetick/py/aggregations/order_book.py +427 -0
  26. onetick/py/aggregations/other.py +1014 -0
  27. onetick/py/backports.py +26 -0
  28. onetick/py/cache.py +373 -0
  29. onetick/py/callback/__init__.py +5 -0
  30. onetick/py/callback/callback.py +275 -0
  31. onetick/py/callback/callbacks.py +131 -0
  32. onetick/py/compatibility.py +752 -0
  33. onetick/py/configuration.py +736 -0
  34. onetick/py/core/__init__.py +0 -0
  35. onetick/py/core/_csv_inspector.py +93 -0
  36. onetick/py/core/_internal/__init__.py +0 -0
  37. onetick/py/core/_internal/_manually_bound_value.py +6 -0
  38. onetick/py/core/_internal/_nodes_history.py +250 -0
  39. onetick/py/core/_internal/_op_utils/__init__.py +0 -0
  40. onetick/py/core/_internal/_op_utils/every_operand.py +9 -0
  41. onetick/py/core/_internal/_op_utils/is_const.py +10 -0
  42. onetick/py/core/_internal/_per_tick_scripts/tick_list_sort_template.script +121 -0
  43. onetick/py/core/_internal/_proxy_node.py +140 -0
  44. onetick/py/core/_internal/_state_objects.py +2307 -0
  45. onetick/py/core/_internal/_state_vars.py +87 -0
  46. onetick/py/core/_source/__init__.py +0 -0
  47. onetick/py/core/_source/_symbol_param.py +95 -0
  48. onetick/py/core/_source/schema.py +97 -0
  49. onetick/py/core/_source/source_methods/__init__.py +0 -0
  50. onetick/py/core/_source/source_methods/aggregations.py +810 -0
  51. onetick/py/core/_source/source_methods/applyers.py +296 -0
  52. onetick/py/core/_source/source_methods/columns.py +141 -0
  53. onetick/py/core/_source/source_methods/data_quality.py +301 -0
  54. onetick/py/core/_source/source_methods/debugs.py +270 -0
  55. onetick/py/core/_source/source_methods/drops.py +120 -0
  56. onetick/py/core/_source/source_methods/fields.py +619 -0
  57. onetick/py/core/_source/source_methods/filters.py +1001 -0
  58. onetick/py/core/_source/source_methods/joins.py +1393 -0
  59. onetick/py/core/_source/source_methods/merges.py +566 -0
  60. onetick/py/core/_source/source_methods/misc.py +1325 -0
  61. onetick/py/core/_source/source_methods/pandases.py +155 -0
  62. onetick/py/core/_source/source_methods/renames.py +356 -0
  63. onetick/py/core/_source/source_methods/sorts.py +183 -0
  64. onetick/py/core/_source/source_methods/switches.py +142 -0
  65. onetick/py/core/_source/source_methods/symbols.py +117 -0
  66. onetick/py/core/_source/source_methods/times.py +627 -0
  67. onetick/py/core/_source/source_methods/writes.py +702 -0
  68. onetick/py/core/_source/symbol.py +202 -0
  69. onetick/py/core/_source/tmp_otq.py +222 -0
  70. onetick/py/core/column.py +209 -0
  71. onetick/py/core/column_operations/__init__.py +0 -0
  72. onetick/py/core/column_operations/_methods/__init__.py +4 -0
  73. onetick/py/core/column_operations/_methods/_internal.py +28 -0
  74. onetick/py/core/column_operations/_methods/conversions.py +215 -0
  75. onetick/py/core/column_operations/_methods/methods.py +294 -0
  76. onetick/py/core/column_operations/_methods/op_types.py +150 -0
  77. onetick/py/core/column_operations/accessors/__init__.py +0 -0
  78. onetick/py/core/column_operations/accessors/_accessor.py +30 -0
  79. onetick/py/core/column_operations/accessors/decimal_accessor.py +92 -0
  80. onetick/py/core/column_operations/accessors/dt_accessor.py +464 -0
  81. onetick/py/core/column_operations/accessors/float_accessor.py +160 -0
  82. onetick/py/core/column_operations/accessors/str_accessor.py +1374 -0
  83. onetick/py/core/column_operations/base.py +1061 -0
  84. onetick/py/core/cut_builder.py +149 -0
  85. onetick/py/core/db_constants.py +20 -0
  86. onetick/py/core/eval_query.py +244 -0
  87. onetick/py/core/lambda_object.py +442 -0
  88. onetick/py/core/multi_output_source.py +193 -0
  89. onetick/py/core/per_tick_script.py +2253 -0
  90. onetick/py/core/query_inspector.py +465 -0
  91. onetick/py/core/source.py +1663 -0
  92. onetick/py/db/__init__.py +2 -0
  93. onetick/py/db/_inspection.py +1042 -0
  94. onetick/py/db/db.py +1423 -0
  95. onetick/py/db/utils.py +64 -0
  96. onetick/py/docs/__init__.py +0 -0
  97. onetick/py/docs/docstring_parser.py +112 -0
  98. onetick/py/docs/utils.py +81 -0
  99. onetick/py/functions.py +2354 -0
  100. onetick/py/license.py +188 -0
  101. onetick/py/log.py +88 -0
  102. onetick/py/math.py +947 -0
  103. onetick/py/misc.py +437 -0
  104. onetick/py/oqd/__init__.py +22 -0
  105. onetick/py/oqd/eps.py +1195 -0
  106. onetick/py/oqd/sources.py +325 -0
  107. onetick/py/otq.py +211 -0
  108. onetick/py/pyomd_mock.py +47 -0
  109. onetick/py/run.py +841 -0
  110. onetick/py/servers.py +173 -0
  111. onetick/py/session.py +1342 -0
  112. onetick/py/sources/__init__.py +19 -0
  113. onetick/py/sources/cache.py +167 -0
  114. onetick/py/sources/common.py +126 -0
  115. onetick/py/sources/csv.py +642 -0
  116. onetick/py/sources/custom.py +85 -0
  117. onetick/py/sources/data_file.py +305 -0
  118. onetick/py/sources/data_source.py +1049 -0
  119. onetick/py/sources/empty.py +94 -0
  120. onetick/py/sources/odbc.py +337 -0
  121. onetick/py/sources/order_book.py +238 -0
  122. onetick/py/sources/parquet.py +168 -0
  123. onetick/py/sources/pit.py +191 -0
  124. onetick/py/sources/query.py +495 -0
  125. onetick/py/sources/snapshots.py +419 -0
  126. onetick/py/sources/split_query_output_by_symbol.py +198 -0
  127. onetick/py/sources/symbology_mapping.py +123 -0
  128. onetick/py/sources/symbols.py +357 -0
  129. onetick/py/sources/ticks.py +825 -0
  130. onetick/py/sql.py +70 -0
  131. onetick/py/state.py +256 -0
  132. onetick/py/types.py +2056 -0
  133. onetick/py/utils/__init__.py +70 -0
  134. onetick/py/utils/acl.py +93 -0
  135. onetick/py/utils/config.py +186 -0
  136. onetick/py/utils/default.py +49 -0
  137. onetick/py/utils/file.py +38 -0
  138. onetick/py/utils/helpers.py +76 -0
  139. onetick/py/utils/locator.py +94 -0
  140. onetick/py/utils/perf.py +499 -0
  141. onetick/py/utils/query.py +49 -0
  142. onetick/py/utils/render.py +1139 -0
  143. onetick/py/utils/script.py +244 -0
  144. onetick/py/utils/temp.py +471 -0
  145. onetick/py/utils/types.py +118 -0
  146. onetick/py/utils/tz.py +82 -0
  147. onetick_py-1.162.2.dist-info/METADATA +148 -0
  148. onetick_py-1.162.2.dist-info/RECORD +152 -0
  149. onetick_py-1.162.2.dist-info/WHEEL +5 -0
  150. onetick_py-1.162.2.dist-info/entry_points.txt +2 -0
  151. onetick_py-1.162.2.dist-info/licenses/LICENSE +21 -0
  152. onetick_py-1.162.2.dist-info/top_level.txt +2 -0
@@ -0,0 +1,752 @@
1
+ import os
2
+ import warnings
3
+ from dataclasses import dataclass, astuple
4
+ from datetime import datetime
5
+ from typing import Optional
6
+ from packaging.version import parse as parse_version
7
+
8
+ import onetick.py as otp
9
+ from onetick.py.otq import otq, otli
10
+ from onetick.py.backports import cache
11
+
12
+
13
+ @dataclass
14
+ class OnetickVersion:
15
+ is_release: bool
16
+ release_version: Optional[str]
17
+ update_number: Optional[int]
18
+ build_number: int
19
+
20
+
21
+ @dataclass
22
+ class OnetickVersionFromServer(OnetickVersion):
23
+ db: str
24
+ context: str
25
+
26
+
27
+ def _parse_update_info(update_info: str) -> Optional[int]:
28
+ if update_info == 'initial':
29
+ return 0
30
+ if update_info == 'precandidate':
31
+ return None
32
+ prefix = 'update'
33
+ if not update_info.startswith(prefix):
34
+ raise ValueError(f"Unexpected update info format: '{update_info}'")
35
+ update_info = update_info[len(prefix):]
36
+ return int(update_info)
37
+
38
+
39
+ def _compare_build_string_and_number(build_string: str, build_number: int,
40
+ release_format_version: int, release_string: str):
41
+ if release_format_version == 2:
42
+ build_string += '120000'
43
+ try:
44
+ release_build_number = int(build_string)
45
+ except Exception:
46
+ raise ValueError(f"Unexpected build number '{build_string}' in release string '{release_string}'")
47
+
48
+ if str(release_build_number) != str(build_number):
49
+ raise ValueError(
50
+ f"Different build numbers in OneTick release '{release_string}' and version: '{build_number}'"
51
+ )
52
+
53
+
54
+ def _parse_release_string(release_string: str, build_number: int) -> OnetickVersion:
55
+ # pylint: disable=W0707
56
+
57
+ # Known release string formats:
58
+ # dev_build
59
+ # rel_1_23_20230605193357
60
+ # BUILD_initial_20230831120000
61
+ # BUILD_update1_20230831120000
62
+ # BUILD_pre_candidate_20240501000000
63
+ #
64
+ # BUILD_rel_20241018_initial
65
+ # BUILD_rel_20241018_update3
66
+ # rel_1_25_initial
67
+ # rel_1_25_update1
68
+
69
+ if release_string == 'dev_build':
70
+ return OnetickVersion(False, None, None, build_number)
71
+
72
+ release_type, *release_info, release_suffix = release_string.split('_')
73
+
74
+ if not release_info:
75
+ raise ValueError("No release info")
76
+
77
+ try:
78
+ update_number = _parse_update_info(release_suffix)
79
+ release_format_version = 2
80
+ except ValueError:
81
+ update_number = None
82
+ release_format_version = 1
83
+ _compare_build_string_and_number(release_suffix, build_number, release_format_version, release_string)
84
+
85
+ if release_type == 'rel':
86
+ release_version_string = '.'.join(release_info)
87
+ release_version = parse_version(release_version_string)
88
+ return OnetickVersion(True, str(release_version), update_number, build_number)
89
+
90
+ if release_type == 'BUILD':
91
+ if release_format_version == 1:
92
+ update_info = ''.join(release_info)
93
+ update_number = _parse_update_info(update_info)
94
+ if release_format_version == 2:
95
+ assert release_info[0] == 'rel', 'Unknown release type'
96
+ release_info = release_info[1:]
97
+ build_string = ''.join(release_info)
98
+ _compare_build_string_and_number(build_string, build_number, release_format_version, release_string)
99
+
100
+ return OnetickVersion(False, None, update_number, build_number)
101
+
102
+ raise ValueError(f"Unknown release type '{release_type}' in release string '{release_string}'")
103
+
104
+
105
+ @cache
106
+ def get_onetick_version(db=None, context=None) -> OnetickVersionFromServer:
107
+ """
108
+ Get OneTick release version, as build number isn't enough
109
+ to determine features available in OneTick.
110
+
111
+ Returns tuple with release type, release version, update number and build number.
112
+
113
+ Note
114
+ ----
115
+ The version is taken from the server by calling the query against this server.
116
+
117
+ The server is specified by two global configuration parameters:
118
+ :py:attr:`otp.config.context<onetick.py.configuration.Config.context>`
119
+ and :py:attr:`otp.config.default_db<onetick.py.configuration.Config.default_db>`.
120
+ By default, 'DEFAULT' context and 'LOCAL' database will be used.
121
+
122
+ The check will not be accurate in all cases, as the user may use :func:`otp.run <onetick.py.run>`
123
+ with different context or set symbol with different database in the end.
124
+
125
+ Checking version correctly in all cases requires redesigning compatibility check system
126
+ by moving it to the runtime level -- checking version inside the graph.
127
+ But for now this method is the best we can do.
128
+ """
129
+ s = None
130
+ if not os.environ.get('ONE_TICK_CONFIG') and not otq.webapi:
131
+ s = otp.Session()
132
+ else:
133
+ _ = otli.OneTickLib()
134
+ p = otq.TickGenerator(bucket_interval=0,
135
+ fields='BUILD=GET_ONETICK_VERSION(), RELEASE=GET_ONETICK_RELEASE()')
136
+ graph = otq.GraphQuery(p.tick_type('DUMMY'))
137
+
138
+ # if otp.config.default_db is set, then we use it to check compatibility
139
+ # otherwise we use LOCAL database available everywhere
140
+ db = db or otp.config.get('default_db', 'LOCAL')
141
+ dummy_symbol = f'{db}::'
142
+ context = context or otp.config.context
143
+
144
+ result = otq.run(graph,
145
+ symbols=dummy_symbol,
146
+ start=datetime(2003, 12, 1),
147
+ end=datetime(2003, 12, 2),
148
+ context=context,
149
+ timezone='UTC')
150
+ if s:
151
+ s.close()
152
+
153
+ build_number = result[dummy_symbol]["BUILD"][0]
154
+ release_string = result[dummy_symbol]["RELEASE"][0]
155
+
156
+ try:
157
+ onetick_version = _parse_release_string(release_string, build_number=build_number)
158
+ return OnetickVersionFromServer(*astuple(onetick_version), db, context) # type: ignore[call-arg]
159
+ except Exception as err:
160
+ warnings.warn(f"Unknown release format string: '{release_string}'.\n{err}")
161
+ return OnetickVersionFromServer(False, None, None, build_number, db, context)
162
+
163
+
164
+ def _is_min_build_or_version(min_release_version=None,
165
+ min_release_version_build_number=None,
166
+ min_build_number=None,
167
+ min_update_number=None,
168
+ throw_warning=False,
169
+ feature_name=None,
170
+ db=None,
171
+ context=None):
172
+ """
173
+ Check if current OneTick version is at least min_release_version.
174
+ When using not released version, check if build number is at least min_build_number.
175
+ """
176
+ if not min_build_number:
177
+ raise ValueError("min_build_number parameter is required")
178
+
179
+ from onetick.py.configuration import config
180
+ if config.disable_compatibility_checks:
181
+ return True
182
+
183
+ onetick_version = get_onetick_version(db=db, context=context)
184
+ if not onetick_version.is_release:
185
+ has = onetick_version.build_number >= min_build_number
186
+ if (
187
+ min_update_number is not None
188
+ and onetick_version.update_number is not None
189
+ and onetick_version.build_number == min_build_number
190
+ ):
191
+ has = has and onetick_version.update_number >= min_update_number
192
+ else:
193
+ if not min_release_version:
194
+ # onetick is on release, but feature is not released yet
195
+ has = False
196
+ else:
197
+ has = parse_version(str(onetick_version.release_version)) >= parse_version(str(min_release_version))
198
+ if min_release_version_build_number:
199
+ has = has and onetick_version.build_number >= min_release_version_build_number
200
+
201
+ if not has and throw_warning:
202
+ msg = f"OneTick {onetick_version} does not support {feature_name} which is supported "
203
+ if min_release_version is not None:
204
+ msg += f"starting from release {min_release_version} or "
205
+ msg += f"starting from dev build {min_build_number} "
206
+ if min_update_number is not None:
207
+ msg += f"update {min_update_number}"
208
+ warnings.warn(msg)
209
+ return has
210
+
211
+
212
+ def _add_version_info_to_exception(exc):
213
+ """
214
+ Add onetick-py and onetick version numbers to exception message.
215
+ """
216
+ onetick_version = get_onetick_version()
217
+ if not onetick_version.is_release:
218
+ message = f'OneTick {onetick_version.build_number}'
219
+ else:
220
+ message = f'OneTick {onetick_version.release_version} ({onetick_version.build_number})'
221
+ message = f'onetick-py=={otp.__version__}, {message}'
222
+ if exc.args:
223
+ message = str(exc.args[0]) + os.linesep + message
224
+ exc.args = (message, *exc.args[1:])
225
+ return exc
226
+
227
+
228
+ def has_max_expected_ticks_per_symbol(throw_warning=False):
229
+ """Check if otq.run() has max_expected_ticks_per_symbol parameter.
230
+
231
+ 20220531: Implemented 0027950: OneTick numpy API and onetick.query python API
232
+ should expose parameter max_expected_ticks_per_symbol
233
+ """
234
+ has = _is_min_build_or_version(1.23, 20221025023710,
235
+ 20220714120000,
236
+ throw_warning=throw_warning,
237
+ feature_name="otp.run parameter 'max_expected_ticks_per_symbol'")
238
+ return has
239
+
240
+
241
+ def has_password_param(throw_warning=False):
242
+ """Check if otq.run() has password parameter.
243
+
244
+ Implemented 0027216: onetick.query does not expose parameter password
245
+ """
246
+ has = _is_min_build_or_version(1.23, None,
247
+ 20220327120000,
248
+ throw_warning=throw_warning,
249
+ feature_name="otp.run parameter 'password'")
250
+ return has
251
+
252
+
253
+ def has_timezone_parameter(throw_warning=False):
254
+ """
255
+ Fixed 0027499: In onetick.query, _convert_time_to_YYYYMMDDhhmmss method should accept timezone parameter
256
+ """
257
+ has = _is_min_build_or_version(1.23, None,
258
+ 20220519120000,
259
+ throw_warning=throw_warning,
260
+ feature_name="convert_time_to_YYYYMMDDhhmmss parameter 'timezone'")
261
+ return has
262
+
263
+
264
+ def has_query_encoding_parameter(throw_warning=False):
265
+ """
266
+ 0027383: In onetick.query, run method should support parameter "encoding"
267
+ """
268
+ has = _is_min_build_or_version(1.23, None,
269
+ 20220327120000,
270
+ throw_warning=throw_warning,
271
+ feature_name="query encoding parameter")
272
+ return has
273
+
274
+
275
+ def is_supported_agg_option_price():
276
+ """0029945: OPTION_PRICE EP produces an exception when used in COMPUTE and explicitly set to its default value
277
+ """
278
+ return _is_min_build_or_version(1.23, 20230314061408,
279
+ 20230316120000)
280
+
281
+
282
+ def is_supported_otq_run_password():
283
+ """Implemented 0027216: onetick.query does not expose parameter password
284
+ """
285
+ return _is_min_build_or_version(1.23, None,
286
+ 20220327120000)
287
+
288
+
289
+ def is_supported_stack_info():
290
+ """Fixed 0028824: setting otq.API_CONFIG.SHOW_STACK_INFO=1 does not cause location of an EP in
291
+ python code to be added to the text of exception
292
+ """
293
+ onetick_version = get_onetick_version()
294
+ if onetick_version.build_number == 20240205120000:
295
+ # BDS-345
296
+ return False
297
+ return _is_min_build_or_version(1.24, None,
298
+ 20221111120000)
299
+
300
+
301
+ def is_supported_num_distinct():
302
+ """???
303
+ """
304
+ return _is_min_build_or_version(1.23, None,
305
+ 20220913120000)
306
+
307
+
308
+ def is_supported_rename_fields_symbol_change():
309
+ """???
310
+ """
311
+ return _is_min_build_or_version(1.24, 20230316120000,
312
+ 20230316120000)
313
+
314
+
315
+ def is_supported_new_ob_snapshot_behavior():
316
+ """???
317
+ """
318
+ return _is_min_build_or_version(1.24, 20230711120000,
319
+ 20230711120000)
320
+
321
+
322
+ def is_supported_where_clause_for_back_ticks():
323
+ """Implemented 0028064: add WHERE_CLAUSE_FOR_BACK_TICKS to PASSTHROUGH EP
324
+ """
325
+ return _is_min_build_or_version(1.23, None,
326
+ 20220714120000)
327
+
328
+
329
+ def is_supported_bucket_units_for_tick_generator(throw_warning=False):
330
+ """Implemented 0029117: Add BUCKET_INTERVAL_UNITS to TICK_GENERATOR EP
331
+ """
332
+ feature_name = "parameter 'bucket_units' for otp.Tick"
333
+ return _is_min_build_or_version(1.24, None,
334
+ 20230112120000,
335
+ throw_warning=throw_warning, feature_name=feature_name)
336
+
337
+
338
+ def is_supported_varstring_in_get_string_value():
339
+ """Implemented 0030763: GET_STRING_VALUE method on tick objects should support also varstring field types
340
+ """
341
+ return _is_min_build_or_version(1.24, None,
342
+ 20230711120000)
343
+
344
+
345
+ def is_supported_uint_numpy_interface():
346
+ # 20220216: Fixed 0027130: onetick numpy interface should preserve
347
+ # field type of unsigned fields (currently they become signed)
348
+ return _is_min_build_or_version(1.23, None,
349
+ 20220327120000)
350
+
351
+
352
+ def is_supported_otq_reference_data_loader():
353
+ """???
354
+ """
355
+ return _is_min_build_or_version(1.23, 20220519120000, 20220519120000)
356
+
357
+
358
+ def is_supported_nsectime_tick_set_eval():
359
+ # BDS-321
360
+ # Fixed 0031588: Ticks in TICK_SET populated by eval , loose nanosecond precision
361
+ return _is_min_build_or_version(1.24, None,
362
+ 20231108120000)
363
+
364
+
365
+ def is_supported_otq_ob_summary(throw_warning=False):
366
+ """
367
+ 20220325: Implemented 0027258: Add EP OB_SUMMARY, which will combine functionality of OB_SIZE, OB_NUM_LEVELS, and
368
+ OB_VWAP, and add new features
369
+ """
370
+ has = _is_min_build_or_version(1.23, None,
371
+ 20220327120000,
372
+ throw_warning=throw_warning,
373
+ feature_name="onetick.query OB_SUMMARY support")
374
+ return has
375
+
376
+
377
+ def is_supported_reload_locator_with_derived_db():
378
+ # See tasks PY-388, BDS-334.
379
+ # Was fixed in update1_20231108120000.
380
+ # 0032118: OneTick processes that refresh their locator may crash
381
+ # if they make use databases derived from the dbs in that locator
382
+ return _is_min_build_or_version(1.24, None,
383
+ 20231108120000, min_update_number=1)
384
+
385
+
386
+ def is_supported_large_ints_empty_interval():
387
+ # BDS-333
388
+ # Was fixed in update1_20231108120000.
389
+ # 0032093: when EXPECT_LARGE_INTS isn't 'false, HIGH,LOW,FIRST, and LAST EPs should show integer values,
390
+ # not doubles, when input is empty
391
+ return _is_min_build_or_version(1.24, None,
392
+ 20231108120000, min_update_number=1)
393
+
394
+
395
+ def is_start_time_as_minimum_start_date_supported():
396
+ # 20220203: Fixed 0027114: Getting error when query start time is equal
397
+ # to <minimum_start_date> parameter in access control file.
398
+ return _is_min_build_or_version(1.23, None,
399
+ 20220211120000)
400
+
401
+
402
+ def is_supported_list_empty_derived_databases():
403
+ # PY-856, BDS-323
404
+ # Was fixed in BUILD_initial_20240205120000
405
+ # 20240130: Fixed 0031783: onetick.query crashes when a query returned no ticks,
406
+ # but produced a tick descriptor with string fields of 0 size
407
+ return _is_min_build_or_version(1.24, 20240524004422,
408
+ 20240205120000, min_update_number=0)
409
+
410
+
411
+ def is_odbc_query_supported():
412
+ # no record found in Release Notes
413
+ # but grep shows that it was added in 20231108-0 build and 1.24 release
414
+ return _is_min_build_or_version(1.24, None,
415
+ 20231108120000)
416
+
417
+
418
+ def is_event_processor_repr_upper():
419
+ return _is_min_build_or_version(None, None,
420
+ 20240205120000, min_update_number=0) or otq.webapi
421
+
422
+
423
+ def is_date_trunc_fixed():
424
+ # tests/core/accessors/test_dt.py::TestDateTrunc::test_dst_year
425
+ # this test will show, when release fixes the issue
426
+ return _is_min_build_or_version(None, None,
427
+ 20240205120000, min_update_number=0)
428
+
429
+
430
+ def is_supported_end_time_in_modify_state_var_from_query():
431
+ # BDS-335 [onetick 0032075]: End time for the called query in MODIFY_STATE_VAR_FROM_QUERY is set incorrectly
432
+ # Was fixed in update1_20231108120000.
433
+ return _is_min_build_or_version(1.24, None,
434
+ 20231108120000, min_update_number=1)
435
+
436
+
437
+ def is_supported_modify_state_var_from_query():
438
+ return hasattr(otq, 'ModifyStateVarFromQuery')
439
+
440
+
441
+ def is_sha2_hashing_supported():
442
+ return _is_min_build_or_version(1.23, 20220714120000,
443
+ 20220714120000)
444
+
445
+
446
+ def is_supported_join_with_aggregated_window():
447
+ return hasattr(otq, 'JoinWithAggregatedWindow')
448
+
449
+
450
+ def is_existing_fields_handling_supported():
451
+ # 20220207: Implemented 0027076:
452
+ # ADD_FIELDS should support parameter EXISTING_FIELDS_HANDLING with values THROW and OVERRIDE
453
+ return _is_min_build_or_version(1.23, None,
454
+ 20220211120000)
455
+
456
+
457
+ def is_supported_per_cache_otq_params(throw_warning=False):
458
+ return _is_min_build_or_version(1.23, 20220714120000, 20220714120000, throw_warning=throw_warning)
459
+
460
+
461
+ def is_option_price_theta_value_changed():
462
+ # 20240221: Fixed 0032506:
463
+ # Theta value from OPTION_PRICE EP is sometimes wrong.
464
+ return _is_min_build_or_version(1.24, 20240306230425,
465
+ 20240330120000)
466
+
467
+
468
+ def is_fixed_modify_state_var_from_query():
469
+ # 20230913: Fixed 0031340:
470
+ # MODIFY_STATE_VAR_FROM_QUERY does not properly propagate initialization events
471
+ # which may cause crash in destination EPs
472
+ return _is_min_build_or_version(1.24, None,
473
+ 20231108120000)
474
+
475
+
476
+ def is_supported_next_in_join_with_aggregated_window(throw_warning=False, feature_name=None):
477
+ # 20231111: Fixed 0031756:
478
+ # Queries with JOIN_WITH_AGGREGATED_WINDOW crash
479
+ # if it is followed by Aggregation EPs referencing fields in PASS_SOURCE
480
+ return _is_min_build_or_version(1.24, None,
481
+ 20231108120000, min_update_number=1,
482
+ throw_warning=throw_warning, feature_name=feature_name)
483
+
484
+
485
+ def is_min_db_start_criteria_works_correctly():
486
+ # Works from 1.23
487
+ # 20220512: Implemented 0027673:
488
+ # SHOW_SYMBOLOGY_LIST should not throw start/end date criteria violation exceptions
489
+ return _is_min_build_or_version(1.23, 20220519120000,
490
+ 20220519120000)
491
+
492
+
493
+ def is_repeat_with_field_name_works_correctly():
494
+ # Works before 20230522-0, on 20230522-2/4 and after 20230711
495
+ # 20230705: Fixed 0030642:
496
+ # built-in REPEAT function works incorrectly when passed a field name
497
+ # as opposed to the constant string, starting rel_20230522
498
+ onetick_version = get_onetick_version()
499
+
500
+ if (
501
+ onetick_version.build_number < 20230522120000 or
502
+ onetick_version.build_number == 20230522120000 and onetick_version.update_number >= 2 or
503
+ onetick_version.build_number >= 20230711120000
504
+ ):
505
+ return True
506
+
507
+ return False
508
+
509
+
510
+ def is_duplicating_quotes_not_supported():
511
+ # 20240329: Fixed 0032754:
512
+ # Logical expressions should trigger error when duplicate single(or double) quote
513
+ # is directly followed or preceded by some name
514
+ return _is_min_build_or_version(None, None, 20240330120000)
515
+
516
+
517
+ def are_quotes_in_query_params_supported():
518
+ # Fixed 0033318: onetick.query package passes quoted otq parameters without quotes
519
+ return _is_min_build_or_version(None, None, 20240530120000, min_update_number=1)
520
+
521
+
522
+ def is_concurrent_cache_is_fixed():
523
+ # PY-1009, BDS-365
524
+ # 20240802: Fixed 0033806: Dynamic caches created with PER_CACHE_OTQ_PARAMS in READ_CACHE EP
525
+ # still lack synchronization in multi-core environment.
526
+ return _is_min_build_or_version(1.24, 20240806024006,
527
+ 20240812120000)
528
+
529
+
530
+ def is_apply_rights_supported(throw_warning=False):
531
+ # 20191026: Fixed 0021898: CORP_ACTIONS EP does not expose parameter APPLY_RIGHTS
532
+ return _is_min_build_or_version(1.22, 20220128183755,
533
+ 20220714120000,
534
+ throw_warning=throw_warning)
535
+
536
+
537
+ def is_write_parquet_directories_fixed():
538
+ # 20240609: Fixed 0033342: WRITE_TO_PARQUET EP should not produce directories in non-partitioned mode
539
+ return _is_min_build_or_version(1.25, 20250209162722,
540
+ 20240530120000, min_update_number=1)
541
+
542
+
543
+ def is_zero_concurrency_supported():
544
+ # 20240312: Implemented 0032157:
545
+ # Add support for automatic assignment of concurrency to the queries, if concurrency is set to special value '0'
546
+ return _is_min_build_or_version(None, None,
547
+ 20240501000000)
548
+
549
+
550
+ def is_get_query_property_flag_supported():
551
+ # 20231205: Implemented 0031857:
552
+ # create flag for GET_QUERY_PROPERTY and GET_QUERY_PROPERTIES to return also special query properties
553
+ return _is_min_build_or_version(None, None,
554
+ 20240205120000)
555
+
556
+
557
+ def is_all_fields_when_ticks_exit_window_supported():
558
+ # 20231230: Implemented 0031741:
559
+ # ALL_FIELDS_FOR_SLIDING aggregation parameter should support value WHEN_TICKS_EXIT_WINDOW
560
+ # (check out "Parameters common go generic aggregations" section in OneTick Event Processors' guide).
561
+ return _is_min_build_or_version(1.24, 20240116201311,
562
+ 20240205120000)
563
+
564
+
565
+ def is_first_ep_skip_tick_if_supported():
566
+ # 20240130: Implemented 0032167: Add SKIP_TICK_IF parameter for FIRST EP
567
+ return _is_min_build_or_version(None, None,
568
+ 20240205120000)
569
+
570
+
571
+ def is_last_ep_fwd_fill_if_supported():
572
+ # 20220708: Implemented 0028111: LAST EP should have parameter FWD_FILL_IF
573
+ return _is_min_build_or_version(1.23, 20221025023710,
574
+ 20220714120000)
575
+
576
+
577
+ def is_diff_show_matching_ticks_supported():
578
+ return _is_min_build_or_version(None, None,
579
+ 20240812120000)
580
+
581
+
582
+ def is_diff_non_decreasing_value_fields_supported():
583
+ # 20240620: Implemmented 0033285: extend DIFF EP to support matching ticks with non-identical primary timestamps
584
+ return _is_min_build_or_version(None, None,
585
+ 20240812120000)
586
+
587
+
588
+ def is_standardized_moment_supported():
589
+ # 20240513: Implemented 0032822: Add STANDARDIZED_MOMENT EP, to compute STANDARDIZED_MOMENT of Nth degree
590
+ return _is_min_build_or_version(None, None,
591
+ 20240530120000)
592
+
593
+
594
+ def is_supported_pnl_realized():
595
+ # No info, however onetick.query missing required EP class
596
+ return _is_min_build_or_version(1.24, 20240116201311,
597
+ 20231108120000)
598
+
599
+
600
+ def is_supported_pnl_realized_buy_sell_flag_bin():
601
+ # 20240429: Implemented 0032683: Enhance PNL_REALIZED EP for BUY_SELL_FLAG field to support also 0 and 1
602
+ return _is_min_build_or_version(None, None,
603
+ 20240530120000)
604
+
605
+
606
+ def is_data_file_query_supported():
607
+ # 20240311: Implemented 0032631: Implement ARROW_FILE_QUERY EP
608
+ return _is_min_build_or_version(None, None,
609
+ 20240330120000)
610
+
611
+
612
+ def is_data_file_query_symbology_supported(throw_warning=False, feature_name=None):
613
+ # 20240603: Implemented 0033111: DATA_FILE_QUERY EP should support parameter SYMBOLOGY
614
+ return _is_min_build_or_version(None, None,
615
+ 20240812120000,
616
+ throw_warning=throw_warning, feature_name=feature_name)
617
+
618
+
619
+ def is_supported_point_in_time(throw_warning=False, feature_name=None):
620
+ # 20240323: Implemented 0032255: Add POINT_IN_TIME EP
621
+ # 20240408: Implemented 0032821: enhance POINT_IN_TIME EP to support getting points in time
622
+ # from the input time series, when TIMES parameter is not set.
623
+
624
+ # POINT_IN_TIME EP supported since 20240330120000, but it is not very stable in this first version,
625
+ # so we decided to support it since the next version
626
+ return _is_min_build_or_version(1.25, 20241209135932,
627
+ 20240530120000,
628
+ throw_warning=throw_warning, feature_name=feature_name)
629
+
630
+
631
+ def is_find_value_for_percentile_supported():
632
+ # 20240527: Implemented 0032752: Add EP FIND_VALUE_FOR_PERCENTILE
633
+ return _is_min_build_or_version(None, None,
634
+ 20240530120000)
635
+
636
+
637
+ def is_derived_databases_crash_fixed():
638
+ # 20240130: Fixed 0032118: OneTick processes that refresh their locator
639
+ # may crash if they make use of databases derived from the dbs in that locator
640
+ return _is_min_build_or_version(1.24, 20240524004422,
641
+ 20240205120000)
642
+
643
+
644
+ def is_character_present_characters_field_fixed():
645
+ # 20230705: Fixed 0030747: CHARACTER_PRESENT EP may produce non-deterministic results when
646
+ # CHARACTERS_FIELD is specified
647
+ # 20230705: Fixed 0030748: CHARACTER_PRESENT EP must ignore 0-bytes in the values of a tick field named
648
+ # by the CHARACTERS_FIELD parameter
649
+ return _is_min_build_or_version(1.24, 20240116201311,
650
+ 20230711120000)
651
+
652
+
653
+ def is_supported_estimate_ts_delay():
654
+ # 20240924: Implemented 0033286: Add EP ESTIMATE_TS_DELAY
655
+ return _is_min_build_or_version(None, None,
656
+ 20241002120000)
657
+
658
+
659
+ def is_percentile_bug_fixed():
660
+ # 20241209: Implemented 0034428: In FIND_VALUE_FOR_PERCENTILE EP, rename SHOW_PERCENTILE_AS to COMPUTE_VALUE_AS
661
+ # NOTE: also has fix for FIRST_VALUE_WITH_GE_PERCENTILE and PERCENTILE=100 (was N/A, but must be biggest value)
662
+ return _is_min_build_or_version(None, None,
663
+ 20241220120000)
664
+
665
+
666
+ def is_limit_ep_supported():
667
+ return hasattr(otq, 'Limit')
668
+
669
+
670
+ def is_prefer_speed_over_accuracy_supported(**kwargs):
671
+ return _is_min_build_or_version(1.25, 20241229055942,
672
+ 20241018120000, min_update_number=3,
673
+ **kwargs)
674
+
675
+
676
+ def is_ob_virtual_prl_and_show_full_detail_supported():
677
+ # 20230705: Implemented 0030536: VIRTUAL_OB EP should support PRL output format and should require it
678
+ # for SHOW_FULL_DETAIL case
679
+ return _is_min_build_or_version(1.24, 20240116201311,
680
+ 20230711120000)
681
+
682
+
683
+ def is_per_tick_script_boolean_problem():
684
+ # strange problem, couldn't reproduce it anywhere except a single onetick build
685
+ version = get_onetick_version()
686
+ return version.release_version == '1.22' and version.build_number in (20220815034358, 20220128183755)
687
+
688
+
689
+ def is_symbol_time_override_fixed():
690
+ # Fixed 0028044: after rel_20220519, symbol_date=0 in the otq file overrides
691
+ # symbol_date expressions and _SYMBOL_TIME otq parameter
692
+ return _is_min_build_or_version(1.23, 20221025023710,
693
+ 20220714120000)
694
+
695
+
696
+ def is_database_view_schema_supported():
697
+ # Implemented 0034115: DB/SHOW_TICK_TYPES should return non-empty schema
698
+ # for View queries ending in single TABLE EP with type specified for each field
699
+ return _is_min_build_or_version(1.25, 20241229055942,
700
+ 20241001205534)
701
+
702
+
703
+ def is_native_plus_zstd_supported():
704
+ # 20220204: Implemented 0026827: memory and accelerator databases should support ZSTD, NATIVE_PLUS_ZSTD,
705
+ # and per-tick ZSTD compression
706
+ return _is_min_build_or_version(1.23, 20220913120000,
707
+ 20220211120000)
708
+
709
+
710
+ def is_save_snapshot_database_parameter_supported():
711
+ # 20220929: Implemented 0028559: Update SAVE_SNAPSHOT to specify output database
712
+ return _is_min_build_or_version(1.23, 20230605193357,
713
+ 20221111120000)
714
+
715
+
716
+ def is_join_with_snapshot_snapshot_fields_parameter_supported():
717
+ # 20240422: Implemented 0032910: add parameter SNAPSHOT_FIELDS to JOIN_WITH_SNAPSHOT EP
718
+ return _is_min_build_or_version(1.25, 20241229055942,
719
+ 20240530120000)
720
+
721
+
722
+ def is_multi_column_generic_aggregations_supported():
723
+ # Implementation of tick aggregations in COMPUTE requires to use RENAME_FIELDS to make correct output schema.
724
+ # However, if we place it inside generic aggregation inside COMPUTE, next error occur on old OneTick versions:
725
+ # ERR_06708004ERCOM: Event processor RENAME_FIELDS does not currently support dynamic symbol changes.
726
+ return _is_min_build_or_version(1.24, 20240116201311,
727
+ 20230315095103)
728
+
729
+
730
+ def is_max_concurrency_with_webapi_supported():
731
+ return _is_min_build_or_version(None, None,
732
+ 20250227120000, min_update_number=2)
733
+
734
+
735
+ def is_nanoseconds_fixed_in_run():
736
+ # 0032309: onetick.query_webapi should preserve nanosecond timestamps
737
+ return _is_min_build_or_version(1.24, 20240116201311,
738
+ 20240205120000)
739
+
740
+
741
+ def is_correct_timezone_used_in_otq_run():
742
+ # Fixed 0027500: In onetick.query, OtqFile.save_to_file method uses incorrect timezone
743
+ return _is_min_build_or_version(1.23, 20221025023710,
744
+ 20220519120000)
745
+
746
+
747
+ def is_ilike_supported():
748
+ # 20250423: Implemented 0035414: Add support of ILIKE in PER_TICK_SCRIPT EP
749
+ # 20250423: Implemented 0035412: Add support of ILIKE in logical expressions
750
+ # 20250423: Implemented 0035413: Add support of ILIKE in SQL
751
+ return _is_min_build_or_version(None, None,
752
+ 20250510120000)