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