onetick-py 1.165.0__py3-none-any.whl → 1.167.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 +1 -1
- onetick/py/aggregations/_docs.py +11 -0
- onetick/py/aggregations/order_book.py +38 -5
- onetick/py/compatibility.py +8 -0
- onetick/py/db/_inspection.py +28 -12
- onetick/py/misc.py +7 -6
- onetick/py/session.py +5 -2
- onetick/py/utils/render.py +39 -26
- {onetick_py-1.165.0.dist-info → onetick_py-1.167.0.dist-info}/METADATA +3 -2
- {onetick_py-1.165.0.dist-info → onetick_py-1.167.0.dist-info}/RECORD +14 -14
- {onetick_py-1.165.0.dist-info → onetick_py-1.167.0.dist-info}/WHEEL +0 -0
- {onetick_py-1.165.0.dist-info → onetick_py-1.167.0.dist-info}/entry_points.txt +0 -0
- {onetick_py-1.165.0.dist-info → onetick_py-1.167.0.dist-info}/licenses/LICENSE +0 -0
- {onetick_py-1.165.0.dist-info → onetick_py-1.167.0.dist-info}/top_level.txt +0 -0
onetick/py/_version.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# This file was generated automatically. DO NOT CHANGE.
|
|
2
|
-
VERSION = '1.
|
|
2
|
+
VERSION = '1.167.0'
|
onetick/py/aggregations/_docs.py
CHANGED
|
@@ -522,6 +522,17 @@ _size_max_fractional_digits_doc = param_doc(
|
|
|
522
522
|
annotation=int,
|
|
523
523
|
default=0,
|
|
524
524
|
)
|
|
525
|
+
_include_market_order_ticks_doc = param_doc(
|
|
526
|
+
name='include_market_order_ticks',
|
|
527
|
+
desc="""
|
|
528
|
+
If set, market order ticks (they have price NaN) are included into the order book,
|
|
529
|
+
and are at the order book's top level.
|
|
530
|
+
|
|
531
|
+
Default is False.
|
|
532
|
+
""",
|
|
533
|
+
annotation=bool,
|
|
534
|
+
default=None,
|
|
535
|
+
)
|
|
525
536
|
_query_fun_doc = param_doc(
|
|
526
537
|
name='query_fun',
|
|
527
538
|
desc="""
|
|
@@ -36,7 +36,8 @@ from ._docs import (_running_doc,
|
|
|
36
36
|
_book_delimiters_doc,
|
|
37
37
|
_max_initialization_days_doc,
|
|
38
38
|
_state_key_max_inactivity_sec_doc,
|
|
39
|
-
_size_max_fractional_digits_doc
|
|
39
|
+
_size_max_fractional_digits_doc,
|
|
40
|
+
_include_market_order_ticks_doc)
|
|
40
41
|
|
|
41
42
|
|
|
42
43
|
OB_SNAPSHOT_DOC_PARAMS = [
|
|
@@ -47,7 +48,8 @@ OB_SNAPSHOT_DOC_PARAMS = [
|
|
|
47
48
|
_book_uncross_method_doc, _dq_events_that_clear_book_doc, _identify_source_doc,
|
|
48
49
|
_show_full_detail_doc, _show_only_changes_doc, _book_delimiters_doc,
|
|
49
50
|
_max_initialization_days_doc, _state_key_max_inactivity_sec_doc,
|
|
50
|
-
_size_max_fractional_digits_doc
|
|
51
|
+
_size_max_fractional_digits_doc,
|
|
52
|
+
_include_market_order_ticks_doc,
|
|
51
53
|
]
|
|
52
54
|
OB_SNAPSHOT_WIDE_DOC_PARAMS = [
|
|
53
55
|
_running_doc,
|
|
@@ -57,7 +59,8 @@ OB_SNAPSHOT_WIDE_DOC_PARAMS = [
|
|
|
57
59
|
_book_uncross_method_doc, _dq_events_that_clear_book_doc,
|
|
58
60
|
_book_delimiters_doc,
|
|
59
61
|
_max_initialization_days_doc, _state_key_max_inactivity_sec_doc,
|
|
60
|
-
_size_max_fractional_digits_doc
|
|
62
|
+
_size_max_fractional_digits_doc,
|
|
63
|
+
_include_market_order_ticks_doc,
|
|
61
64
|
]
|
|
62
65
|
OB_SNAPSHOT_FLAT_DOC_PARAMS = [
|
|
63
66
|
_running_doc,
|
|
@@ -67,7 +70,8 @@ OB_SNAPSHOT_FLAT_DOC_PARAMS = [
|
|
|
67
70
|
_book_uncross_method_doc, _dq_events_that_clear_book_doc,
|
|
68
71
|
_show_full_detail_doc,
|
|
69
72
|
_max_initialization_days_doc, _state_key_max_inactivity_sec_doc,
|
|
70
|
-
_size_max_fractional_digits_doc
|
|
73
|
+
_size_max_fractional_digits_doc,
|
|
74
|
+
_include_market_order_ticks_doc,
|
|
71
75
|
]
|
|
72
76
|
OB_SUMMARY_DOC_PARAMS = [
|
|
73
77
|
_running_doc,
|
|
@@ -75,7 +79,8 @@ OB_SUMMARY_DOC_PARAMS = [
|
|
|
75
79
|
_bucket_end_condition_doc, _end_condition_per_group_doc, _group_by_doc, _groups_to_display_doc,
|
|
76
80
|
_side_doc, _max_levels_doc, _min_levels_doc, _max_depth_shares_doc, _max_depth_for_price_doc,
|
|
77
81
|
_book_uncross_method_doc, _dq_events_that_clear_book_doc, _max_initialization_days_doc,
|
|
78
|
-
_state_key_max_inactivity_sec_doc, _size_max_fractional_digits_doc
|
|
82
|
+
_state_key_max_inactivity_sec_doc, _size_max_fractional_digits_doc,
|
|
83
|
+
_include_market_order_ticks_doc,
|
|
79
84
|
]
|
|
80
85
|
|
|
81
86
|
OB_SIZE_DOC_PARAMS = [
|
|
@@ -177,6 +182,7 @@ class ObSnapshot(_OrderBookAggregation):
|
|
|
177
182
|
'book_delimiters': 'BOOK_DELIMITERS',
|
|
178
183
|
'state_key_max_inactivity_sec': 'STATE_KEY_MAX_INACTIVITY_SEC',
|
|
179
184
|
'size_max_fractional_digits': 'SIZE_MAX_FRACTIONAL_DIGITS',
|
|
185
|
+
'include_market_order_ticks': 'INCLUDE_MARKET_ORDER_TICKS',
|
|
180
186
|
})
|
|
181
187
|
FIELDS_DEFAULT = dict(_OrderBookAggregation.FIELDS_DEFAULT, **{
|
|
182
188
|
'identify_source': False,
|
|
@@ -185,6 +191,7 @@ class ObSnapshot(_OrderBookAggregation):
|
|
|
185
191
|
'book_delimiters': None,
|
|
186
192
|
'state_key_max_inactivity_sec': None,
|
|
187
193
|
'size_max_fractional_digits': 0,
|
|
194
|
+
'include_market_order_ticks': None,
|
|
188
195
|
})
|
|
189
196
|
|
|
190
197
|
def __init__(self,
|
|
@@ -195,6 +202,7 @@ class ObSnapshot(_OrderBookAggregation):
|
|
|
195
202
|
book_delimiters: Optional[Literal['D']] = None,
|
|
196
203
|
state_key_max_inactivity_sec: Optional[int] = None,
|
|
197
204
|
size_max_fractional_digits: int = 0,
|
|
205
|
+
include_market_order_ticks: Optional[bool] = None,
|
|
198
206
|
**kwargs):
|
|
199
207
|
self.identify_source = identify_source
|
|
200
208
|
self.show_full_detail = show_full_detail
|
|
@@ -202,11 +210,22 @@ class ObSnapshot(_OrderBookAggregation):
|
|
|
202
210
|
self.book_delimiters = book_delimiters
|
|
203
211
|
self.state_key_max_inactivity_sec = state_key_max_inactivity_sec
|
|
204
212
|
self.size_max_fractional_digits = size_max_fractional_digits
|
|
213
|
+
self.include_market_order_ticks = include_market_order_ticks
|
|
205
214
|
# we don't want to set hard limit on the output of order book aggregations
|
|
206
215
|
if self.show_full_detail:
|
|
207
216
|
kwargs['all_fields'] = True
|
|
208
217
|
super().__init__(*args, **kwargs)
|
|
209
218
|
|
|
219
|
+
def _param_validation(self):
|
|
220
|
+
super()._param_validation()
|
|
221
|
+
if self.include_market_order_ticks is not None:
|
|
222
|
+
if 'include_market_order_ticks' not in self.EP.Parameters.list_parameters():
|
|
223
|
+
raise ValueError("Parameter 'include_market_order_ticks' is not supported on this OneTick API version")
|
|
224
|
+
otp.compatibility.is_include_market_order_ticks_supported(
|
|
225
|
+
throw_warning=True,
|
|
226
|
+
feature_name="parameter 'include_market_order_ticks'",
|
|
227
|
+
)
|
|
228
|
+
|
|
210
229
|
def _get_output_schema(self, src: 'Source', name: Optional[str] = None) -> dict:
|
|
211
230
|
schema = {
|
|
212
231
|
'PRICE': float,
|
|
@@ -284,11 +303,13 @@ class ObSummary(_OrderBookAggregation):
|
|
|
284
303
|
'min_levels': 'MIN_LEVELS',
|
|
285
304
|
'state_key_max_inactivity_sec': 'STATE_KEY_MAX_INACTIVITY_SEC',
|
|
286
305
|
'size_max_fractional_digits': 'SIZE_MAX_FRACTIONAL_DIGITS',
|
|
306
|
+
'include_market_order_ticks': 'INCLUDE_MARKET_ORDER_TICKS',
|
|
287
307
|
})
|
|
288
308
|
FIELDS_DEFAULT = dict(_OrderBookAggregation.FIELDS_DEFAULT, **{
|
|
289
309
|
'min_levels': None,
|
|
290
310
|
'state_key_max_inactivity_sec': None,
|
|
291
311
|
'size_max_fractional_digits': 0,
|
|
312
|
+
'include_market_order_ticks': None,
|
|
292
313
|
})
|
|
293
314
|
|
|
294
315
|
def __init__(self,
|
|
@@ -296,6 +317,7 @@ class ObSummary(_OrderBookAggregation):
|
|
|
296
317
|
min_levels: Optional[int] = None,
|
|
297
318
|
state_key_max_inactivity_sec: Optional[int] = None,
|
|
298
319
|
size_max_fractional_digits: int = 0,
|
|
320
|
+
include_market_order_ticks: Optional[bool] = None,
|
|
299
321
|
**kwargs):
|
|
300
322
|
if is_supported_otq_ob_summary():
|
|
301
323
|
self.EP = otq.ObSummary
|
|
@@ -305,8 +327,19 @@ class ObSummary(_OrderBookAggregation):
|
|
|
305
327
|
self.min_levels = min_levels
|
|
306
328
|
self.state_key_max_inactivity_sec = state_key_max_inactivity_sec
|
|
307
329
|
self.size_max_fractional_digits = size_max_fractional_digits
|
|
330
|
+
self.include_market_order_ticks = include_market_order_ticks
|
|
308
331
|
super().__init__(*args, **kwargs)
|
|
309
332
|
|
|
333
|
+
def _param_validation(self):
|
|
334
|
+
super()._param_validation()
|
|
335
|
+
if self.include_market_order_ticks is not None:
|
|
336
|
+
if 'include_market_order_ticks' not in self.EP.Parameters.list_parameters():
|
|
337
|
+
raise ValueError("Parameter 'include_market_order_ticks' is not supported on this OneTick API version")
|
|
338
|
+
otp.compatibility.is_include_market_order_ticks_supported(
|
|
339
|
+
throw_warning=True,
|
|
340
|
+
feature_name="parameter 'include_market_order_ticks'",
|
|
341
|
+
)
|
|
342
|
+
|
|
310
343
|
def _get_output_schema(self, src: 'Source', name: Optional[str] = None) -> dict:
|
|
311
344
|
schema = {
|
|
312
345
|
'BID_SIZE': int,
|
onetick/py/compatibility.py
CHANGED
|
@@ -750,3 +750,11 @@ def is_ilike_supported():
|
|
|
750
750
|
# 20250423: Implemented 0035413: Add support of ILIKE in SQL
|
|
751
751
|
return _is_min_build_or_version(None, None,
|
|
752
752
|
20250510120000)
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
def is_include_market_order_ticks_supported(**kwargs):
|
|
756
|
+
# Implemented 0031478: OB_SNAPSHOT... and OB_SUMMARY EPs
|
|
757
|
+
# should support parameter INCLUDE_MARKET_ORDER_TICKS (false by default)
|
|
758
|
+
return _is_min_build_or_version(1.25, 20241229055942,
|
|
759
|
+
20240812120000, min_update_number=2,
|
|
760
|
+
**kwargs)
|
onetick/py/db/_inspection.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import warnings
|
|
2
|
-
from typing import
|
|
2
|
+
from typing import Union, Iterable, Tuple, Optional, Any, Literal
|
|
3
3
|
from datetime import date as dt_date, datetime, timedelta
|
|
4
4
|
|
|
5
5
|
import pandas as pd
|
|
@@ -502,7 +502,7 @@ class DB:
|
|
|
502
502
|
return last_date
|
|
503
503
|
return date
|
|
504
504
|
|
|
505
|
-
def tick_types(self, date=None, timezone=None) ->
|
|
505
|
+
def tick_types(self, date=None, timezone=None) -> list[str]:
|
|
506
506
|
"""
|
|
507
507
|
Returns list of tick types for the ``date``.
|
|
508
508
|
|
|
@@ -527,7 +527,7 @@ class DB:
|
|
|
527
527
|
date = self.last_date if date is None else date
|
|
528
528
|
if timezone is None:
|
|
529
529
|
timezone = configuration.config.tz
|
|
530
|
-
time_params:
|
|
530
|
+
time_params: dict[str, Any] = {}
|
|
531
531
|
|
|
532
532
|
if date is not None:
|
|
533
533
|
time_params['start'], time_params['end'] = self._fit_date_in_acl(date, timezone=timezone)
|
|
@@ -551,7 +551,7 @@ class DB:
|
|
|
551
551
|
min_date = min(obj[0] for obj in self._locator_date_ranges)
|
|
552
552
|
return _datetime2date(min_date)
|
|
553
553
|
|
|
554
|
-
def schema(self, date=None, tick_type=None, timezone=None, check_index_file=utils.adaptive) ->
|
|
554
|
+
def schema(self, date=None, tick_type=None, timezone=None, check_index_file=utils.adaptive) -> dict[str, type]:
|
|
555
555
|
"""
|
|
556
556
|
Gets the schema of the database.
|
|
557
557
|
|
|
@@ -696,7 +696,7 @@ class DB:
|
|
|
696
696
|
|
|
697
697
|
return schema
|
|
698
698
|
|
|
699
|
-
def symbols(self, date=None, timezone=None, tick_type=None, pattern='.*') ->
|
|
699
|
+
def symbols(self, date=None, timezone=None, tick_type=None, pattern='.*') -> list[str]:
|
|
700
700
|
"""
|
|
701
701
|
Finds a list of available symbols in the database
|
|
702
702
|
|
|
@@ -907,7 +907,7 @@ class DB:
|
|
|
907
907
|
return df
|
|
908
908
|
|
|
909
909
|
|
|
910
|
-
def databases(context=utils.default, derived=False) ->
|
|
910
|
+
def databases(context=utils.default, derived=False, readable_only: bool = True) -> dict[str, DB]:
|
|
911
911
|
"""
|
|
912
912
|
Gets all available databases in the ``context``
|
|
913
913
|
|
|
@@ -918,13 +918,18 @@ def databases(context=utils.default, derived=False) -> Dict[str, DB]:
|
|
|
918
918
|
If not set then default :py:attr:`context<onetick.py.configuration.Config.context>` is used.
|
|
919
919
|
See :ref:`guide about switching contexts <switching contexts>` for examples.
|
|
920
920
|
derived: bool, dict
|
|
921
|
-
If False then derived databases are not returned.
|
|
922
|
-
|
|
923
|
-
If
|
|
921
|
+
If False (default) then derived databases are not returned.
|
|
922
|
+
Otherwise derived databases names are added to the result after the non-derived databases.
|
|
923
|
+
If set to dict then its items used as parameters to :py:func:`~onetick.py.derived_databases`.
|
|
924
|
+
If set to True then default parameters for :py:func:`~onetick.py.derived_databases` are used.
|
|
925
|
+
readable_only: bool
|
|
926
|
+
If set to True (default), then return only the databases with read-access for the current user.
|
|
927
|
+
Otherwise return all databases visible from the current process.
|
|
924
928
|
|
|
925
929
|
See also
|
|
926
930
|
--------
|
|
927
931
|
| **SHOW_DB_LIST** OneTick event processor
|
|
932
|
+
| **ACCESS_INFO** OneTick event processor
|
|
928
933
|
| :py:func:`derived_databases`
|
|
929
934
|
|
|
930
935
|
Returns
|
|
@@ -933,7 +938,18 @@ def databases(context=utils.default, derived=False) -> Dict[str, DB]:
|
|
|
933
938
|
Dict where keys are database names and values are :class:`DB <onetick.py.db._inspection.DB>` objects
|
|
934
939
|
with ``context`` specified.
|
|
935
940
|
"""
|
|
936
|
-
|
|
941
|
+
if readable_only:
|
|
942
|
+
node = (
|
|
943
|
+
otq.AccessInfo(info_type='DATABASES', show_for_all_users=False, deep_scan=True).tick_type('ANY')
|
|
944
|
+
>> otq.Passthrough('DB_NAME,READ_ACCESS')
|
|
945
|
+
>> otq.WhereClause(where='READ_ACCESS = 1')
|
|
946
|
+
)
|
|
947
|
+
else:
|
|
948
|
+
node = (
|
|
949
|
+
otq.ShowDbList().tick_type('ANY')
|
|
950
|
+
>> otq.Passthrough('DATABASE_NAME')
|
|
951
|
+
)
|
|
952
|
+
dbs = otp.run(node,
|
|
937
953
|
symbols='LOCAL::',
|
|
938
954
|
# start and end times don't matter for this query, use some constants
|
|
939
955
|
start=db_constants.DEFAULT_START_DATE,
|
|
@@ -944,7 +960,7 @@ def databases(context=utils.default, derived=False) -> Dict[str, DB]:
|
|
|
944
960
|
if len(dbs) == 0:
|
|
945
961
|
return {}
|
|
946
962
|
|
|
947
|
-
db_list = list(dbs['DATABASE_NAME'])
|
|
963
|
+
db_list = list(dbs['DB_NAME'] if readable_only else dbs['DATABASE_NAME'])
|
|
948
964
|
db_dict = {db_name: DB(db_name, context=context) for db_name in db_list}
|
|
949
965
|
if derived:
|
|
950
966
|
kwargs = derived if isinstance(derived, dict) else {}
|
|
@@ -961,7 +977,7 @@ def derived_databases(
|
|
|
961
977
|
selection_criteria='all',
|
|
962
978
|
db=None,
|
|
963
979
|
db_discovery_scope='query_host_only',
|
|
964
|
-
) ->
|
|
980
|
+
) -> dict[str, DB]:
|
|
965
981
|
"""
|
|
966
982
|
Gets available derived databases.
|
|
967
983
|
|
onetick/py/misc.py
CHANGED
|
@@ -404,19 +404,20 @@ def get_symbology_mapping(dest_symbology, src_symbology=None, symbol=None, times
|
|
|
404
404
|
Time A SYMBOLOGY_MAPPING
|
|
405
405
|
0 2022-01-03 1 9706
|
|
406
406
|
|
|
407
|
-
Override source symbology, symbol and symbol date
|
|
407
|
+
Override source symbology, symbol and symbol date
|
|
408
|
+
(Also note that parameters can be set from columns):
|
|
408
409
|
|
|
409
|
-
>>> data = otp.Tick(A=1, db=None)
|
|
410
|
-
>>> data['SYMBOLOGY_MAPPING'] = otp.get_symbology_mapping('OID', 'TDEQ', '
|
|
410
|
+
>>> data = otp.Tick(A=1, db=None, SYMBOL='MSFT')
|
|
411
|
+
>>> data['SYMBOLOGY_MAPPING'] = otp.get_symbology_mapping('OID', 'TDEQ', data['SYMBOL'], otp.dt(2022, 1, 3))
|
|
411
412
|
>>> otp.run(data, symbols='US_COMP::AAPL', # doctest: +SKIP
|
|
412
413
|
... date=otp.dt(2022, 1, 3))
|
|
413
414
|
Time A SYMBOLOGY_MAPPING
|
|
414
415
|
0 2022-01-03 1 109037
|
|
415
416
|
"""
|
|
416
417
|
params_correct = (
|
|
417
|
-
all([src_symbology, symbol, timestamp])
|
|
418
|
-
or all([src_symbology, symbol])
|
|
419
|
-
or not any([src_symbology, symbol, timestamp])
|
|
418
|
+
all(v is not None for v in [src_symbology, symbol, timestamp])
|
|
419
|
+
or all(v is not None for v in [src_symbology, symbol])
|
|
420
|
+
or not any(v is not None for v in [src_symbology, symbol, timestamp])
|
|
420
421
|
)
|
|
421
422
|
if not params_correct:
|
|
422
423
|
raise ValueError("Parameters 'src_symbology' and 'symbol' or"
|
onetick/py/session.py
CHANGED
|
@@ -1115,8 +1115,6 @@ class Session:
|
|
|
1115
1115
|
# TODO: rollback, but need to wait BDS-91
|
|
1116
1116
|
raise
|
|
1117
1117
|
|
|
1118
|
-
Session._instance = self
|
|
1119
|
-
|
|
1120
1118
|
# force reload cfg/locator/acl, because it is not reloaded after each time session if re-created
|
|
1121
1119
|
if os.getenv('OTP_WEBAPI_TEST_MODE'):
|
|
1122
1120
|
utils.reload_config(None, config_type='MAIN_CONFIG')
|
|
@@ -1125,6 +1123,11 @@ class Session:
|
|
|
1125
1123
|
|
|
1126
1124
|
self._ts_dbs = {}
|
|
1127
1125
|
|
|
1126
|
+
# PY-1352: this line must be the last
|
|
1127
|
+
# in case we get exception anywhere before, we shouldn't set Session class variable,
|
|
1128
|
+
# because it will affect the creation of all the future Session objects
|
|
1129
|
+
Session._instance = self
|
|
1130
|
+
|
|
1128
1131
|
def use(self, *items):
|
|
1129
1132
|
"""
|
|
1130
1133
|
Makes DB or TS available inside the session.
|
onetick/py/utils/render.py
CHANGED
|
@@ -342,7 +342,10 @@ def _parse_function_params(func_params: str) -> Tuple[list, dict]:
|
|
|
342
342
|
|
|
343
343
|
|
|
344
344
|
def _parse_function(expression: str) -> Tuple[Optional[str], list, dict]:
|
|
345
|
-
|
|
345
|
+
# EP_NAME(PARAM_NAME=PARAM_VALUE,...)
|
|
346
|
+
# [a-zA-Z_:] is EP_NAME, can contain letters, underscore and colon
|
|
347
|
+
# [\s\S] is any symbol including newline (because . doesn't include newline by default)
|
|
348
|
+
m = re.search(r"^([a-zA-Z_:]*)\s*\(([\s\S]*)\)\s*$", expression)
|
|
346
349
|
|
|
347
350
|
if not m:
|
|
348
351
|
return None, [], {}
|
|
@@ -501,20 +504,24 @@ def _build_query_tree(query: Query):
|
|
|
501
504
|
node.labels["OUT"] = node.config["NESTED_OUTPUT"]
|
|
502
505
|
|
|
503
506
|
if "SOURCE_DESCRIPTION" in node.config:
|
|
504
|
-
|
|
505
|
-
if
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
if
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
if labels
|
|
514
|
-
|
|
507
|
+
descriptions = node.config["SOURCE_DESCRIPTION"]
|
|
508
|
+
if isinstance(descriptions, str):
|
|
509
|
+
descriptions = [descriptions]
|
|
510
|
+
for description in descriptions:
|
|
511
|
+
description = description.strip().split(" ")
|
|
512
|
+
if len(description) > 1:
|
|
513
|
+
desc_node = description[0].split(".")[0]
|
|
514
|
+
labels = description[1].split(".")
|
|
515
|
+
|
|
516
|
+
if labels and desc_node in query.nodes:
|
|
517
|
+
if labels[0]:
|
|
518
|
+
query.nodes[desc_node].labels["IN"] = labels[0]
|
|
519
|
+
|
|
520
|
+
if labels[1]:
|
|
521
|
+
query.nodes[desc_node].labels["OUT"] = labels[1]
|
|
515
522
|
|
|
516
523
|
if "SINK_DESCRIPTION" in node.config:
|
|
517
|
-
description_path = node.config["
|
|
524
|
+
description_path = node.config["SINK_DESCRIPTION"].strip().split(".")
|
|
518
525
|
if len(description_path) > 1:
|
|
519
526
|
desc_node = description_path[0]
|
|
520
527
|
label = description_path[-1]
|
|
@@ -527,7 +534,7 @@ def _build_query_tree(query: Query):
|
|
|
527
534
|
if "SINK" in node.config:
|
|
528
535
|
sink_nodes = [(sink, True) for sink in node.config["SINK"].strip().split()]
|
|
529
536
|
if sink_nodes:
|
|
530
|
-
leaves.
|
|
537
|
+
leaves.discard(node_id)
|
|
531
538
|
|
|
532
539
|
nodes += sink_nodes
|
|
533
540
|
del node.config["SINK"]
|
|
@@ -535,7 +542,7 @@ def _build_query_tree(query: Query):
|
|
|
535
542
|
if "SOURCE" in node.config:
|
|
536
543
|
source_nodes = [(sink, False) for sink in node.config["SOURCE"].strip().split()]
|
|
537
544
|
if source_nodes:
|
|
538
|
-
roots.
|
|
545
|
+
roots.discard(node_id)
|
|
539
546
|
|
|
540
547
|
nodes += source_nodes
|
|
541
548
|
del node.config["SOURCE"]
|
|
@@ -546,10 +553,10 @@ def _build_query_tree(query: Query):
|
|
|
546
553
|
source_node_id = source_node_path[0]
|
|
547
554
|
|
|
548
555
|
if not is_sink_node and source_node_id in leaves:
|
|
549
|
-
leaves.
|
|
556
|
+
leaves.discard(source_node_id)
|
|
550
557
|
|
|
551
558
|
if is_sink_node and source_node_id in roots:
|
|
552
|
-
roots.
|
|
559
|
+
roots.discard(source_node_id)
|
|
553
560
|
|
|
554
561
|
if source_node_id not in query.nodes:
|
|
555
562
|
raise RuntimeError(f"Malformed otq file passed: node {source_node_id} not found in {query.name}")
|
|
@@ -690,21 +697,25 @@ def read_otq(path: str, parse_eval_from_params: bool = False) -> Optional[Graph]
|
|
|
690
697
|
return graph
|
|
691
698
|
|
|
692
699
|
|
|
693
|
-
def
|
|
694
|
-
if line_limit is
|
|
700
|
+
def truncate_param_value(ep: Any, param, value, line_limit: Optional[Tuple[int, int]] = None):
|
|
701
|
+
if line_limit is None:
|
|
702
|
+
return value
|
|
703
|
+
|
|
704
|
+
height, width = line_limit
|
|
705
|
+
if height < 0 or width < 0:
|
|
695
706
|
raise ValueError("line_limit values should not be negative")
|
|
696
707
|
|
|
697
|
-
if isinstance(ep, EP) and
|
|
708
|
+
if isinstance(ep, EP) and (
|
|
698
709
|
ep.name == "PER_TICK_SCRIPT" and param.lower() == "script" or
|
|
699
710
|
ep.name == "CSV_FILE_LISTING" and param.lower() == "file_contents"
|
|
700
711
|
):
|
|
701
712
|
lines = [
|
|
702
|
-
line if len(line) <=
|
|
713
|
+
line if len(line) <= width or not width else line[:width] + "..."
|
|
703
714
|
for line in value.split("\n")
|
|
704
715
|
]
|
|
705
716
|
|
|
706
|
-
if
|
|
707
|
-
lines = lines[:
|
|
717
|
+
if height and len(lines) > height:
|
|
718
|
+
lines = lines[:height] + ["..."]
|
|
708
719
|
|
|
709
720
|
return "\n".join(lines)
|
|
710
721
|
|
|
@@ -791,11 +802,13 @@ def build_node(graphs: GraphStorage, node: Node, line_limit: Optional[Tuple[int,
|
|
|
791
802
|
attrs["sides"] = "LR"
|
|
792
803
|
|
|
793
804
|
if isinstance(v, NestedQuery):
|
|
794
|
-
param_value =
|
|
805
|
+
param_value = v.raw_string
|
|
795
806
|
else:
|
|
796
|
-
param_value =
|
|
807
|
+
param_value = v
|
|
797
808
|
|
|
798
|
-
|
|
809
|
+
param_value = truncate_param_value(node.ep, k, param_value, line_limit)
|
|
810
|
+
param_value = html.escape(param_value).replace("\t", " " * 4)
|
|
811
|
+
param_lines = param_value.split("\n")
|
|
799
812
|
|
|
800
813
|
if k:
|
|
801
814
|
if len(param_lines) == 1:
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: onetick-py
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.167.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
|
|
7
7
|
Project-URL: Documentation, https://docs.pip.distribution.sol.onetick.com
|
|
8
|
-
Project-URL: OneTick, https://onetick.com
|
|
8
|
+
Project-URL: OneTick, https://onetick.com
|
|
9
|
+
Project-URL: GitHub, https://github.com/onemarketdata/onetick-py
|
|
9
10
|
Classifier: Topic :: Database :: Front-Ends
|
|
10
11
|
Classifier: Topic :: Scientific/Engineering
|
|
11
12
|
Classifier: Programming Language :: Python :: 3.9
|
|
@@ -13,33 +13,33 @@ onetick/lib/__init__.py,sha256=Rp7CIDoA4E6LIm1f2mNvl_5b_n-0U3suA3FmBXbmKoU,114
|
|
|
13
13
|
onetick/lib/instance.py,sha256=Fn3yoowjBtImAhR6n-f-Ti5J1q-RdDI-EGLpZvNwTi4,4773
|
|
14
14
|
onetick/py/__init__.py,sha256=j2WBnhu01i8VdOYkn9BGc-7JeAqXQoCFjVfXFZCSz-4,10950
|
|
15
15
|
onetick/py/_stack_info.py,sha256=PHZOkW_fK7Fbl4YEj5CaYK9L6vh4j-bUU7_cSYOWZ30,2546
|
|
16
|
-
onetick/py/_version.py,sha256=
|
|
16
|
+
onetick/py/_version.py,sha256=Ha1RHpdZgelWm_gNyQs3N1_5r-j2T_j0UhG_Q38pNfY,76
|
|
17
17
|
onetick/py/backports.py,sha256=mR00mxe7E7UgBljf-Wa93Mo6lpi-C4Op561uhPUoEt8,815
|
|
18
18
|
onetick/py/cache.py,sha256=f9WwFFCTqCP3eaA4V57tNPjCBHNPzU8ZvH81IuUsBE8,12756
|
|
19
|
-
onetick/py/compatibility.py,sha256=
|
|
19
|
+
onetick/py/compatibility.py,sha256=99UHDi58IZSLl9XcWjJTZerAsHGp_zV6zqfwRl2yDTY,30068
|
|
20
20
|
onetick/py/configuration.py,sha256=Cb_tH3F2vKMF27mFtd5TwXxhUA5Axmxp2TR3OKFfmQ0,27497
|
|
21
21
|
onetick/py/functions.py,sha256=LyLQ7NTNFzKfkR3A5RazS3tOtVqORe1BPrg6B4AAuLM,97689
|
|
22
22
|
onetick/py/license.py,sha256=50dsFrE-NKsPOdkAoyxHr44bH8DzFCr_6TabX0JH6tQ,6140
|
|
23
23
|
onetick/py/log.py,sha256=Els2drZcVjJrD6kvbwgFGEpg6jAacoUEtyN6rCaauuk,2723
|
|
24
24
|
onetick/py/math.py,sha256=Jx-wFggEydBnwgFRsPvFC6bcTCr3bK6WS7_lQ3_a0OU,21061
|
|
25
|
-
onetick/py/misc.py,sha256=
|
|
25
|
+
onetick/py/misc.py,sha256=rTM-_Xo_gIr3b9celmWSGa37OACbwvnLhANzWfTF5Ok,12811
|
|
26
26
|
onetick/py/otq.py,sha256=AM24XPw5OdI7SwRgzEPBgOyodF523Zo9SBE7f0XY6HA,7747
|
|
27
27
|
onetick/py/pyomd_mock.py,sha256=A7IIUraN9yCsPhvnHXQUZrmwFjlh7vofSnYm4G7bdsc,2006
|
|
28
28
|
onetick/py/run.py,sha256=xPmArKwvMw5sEbCjmtc7ORFigZrNN3DUDM9f2YYamj4,37554
|
|
29
29
|
onetick/py/servers.py,sha256=h6l0X55kcnpI25bZcYaBpPAAGBZjqk9mt1SQe4xZrh0,6840
|
|
30
|
-
onetick/py/session.py,sha256=
|
|
30
|
+
onetick/py/session.py,sha256=AqoS7BFN_Sz3JU2CAaZm0Bro8CmUy6VjmoDjwOU1wYM,49591
|
|
31
31
|
onetick/py/sql.py,sha256=kJ0732bZ0OGF8x3VzcOUs38zEGsxcd1nZOSN75VKXhA,2993
|
|
32
32
|
onetick/py/state.py,sha256=1fL0zgqm-mKi-1KkUc3OvqV6IstDxHEDxlHBIQI-4UM,10134
|
|
33
33
|
onetick/py/types.py,sha256=OfBTkKNQ7KrNceRXNPUJ36HyA-4sMUf_9T0TSYy-5Fc,64662
|
|
34
34
|
onetick/py/aggregations/__init__.py,sha256=02WnTc9ocTp34OkGyXRHY2QAZi_QjDMHClE5tvx6Gtk,736
|
|
35
35
|
onetick/py/aggregations/_base.py,sha256=YQWlFYlq_QvGwTIaNGuyoU8rQsYfx-Yd-lNNq4R_o6o,25702
|
|
36
|
-
onetick/py/aggregations/_docs.py,sha256=
|
|
36
|
+
onetick/py/aggregations/_docs.py,sha256=7pz6XIhRuP_1vuOYO9UfTlzl6zGD2_jwbPMfJPOX-M8,34798
|
|
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
|
|
40
40
|
onetick/py/aggregations/high_low.py,sha256=B7_Y6KhJjIqJthK0msW0JRkTpxINpnKPuSQjQa2QyZs,2508
|
|
41
41
|
onetick/py/aggregations/num_distinct.py,sha256=s-VrU92kBKnJ6LIAGq2-j-t8amnolIF2EHkEt78A7_s,2830
|
|
42
|
-
onetick/py/aggregations/order_book.py,sha256
|
|
42
|
+
onetick/py/aggregations/order_book.py,sha256=-QVtxh_VlzC0-jvZ5Lb6enQBW35Zc0O5uVLid129wc0,18657
|
|
43
43
|
onetick/py/aggregations/other.py,sha256=wCXrb3BCUJy5e39i35V2tslp0bVR2-8Fa8E1lf45hO4,39410
|
|
44
44
|
onetick/py/callback/__init__.py,sha256=lF6u1jDy0dv-2qBvonqmSaQAU7dWQAuq5FWyR5LzvLI,108
|
|
45
45
|
onetick/py/callback/callback.py,sha256=i8yVsbceqhVxNTcXU2ie0-nBRyC0nS2LVDFFtqfCMlw,8618
|
|
@@ -103,7 +103,7 @@ onetick/py/core/column_operations/accessors/dt_accessor.py,sha256=RvgIuCXs3nMXTN
|
|
|
103
103
|
onetick/py/core/column_operations/accessors/float_accessor.py,sha256=6di5Pw0nLwKEqnzQImzQ9ORv45xGm-uevFGCg-FZz4w,5541
|
|
104
104
|
onetick/py/core/column_operations/accessors/str_accessor.py,sha256=EBncqEOx421PQvRPd3pTQInWBKN2ttpy1ltXIJI-V-U,55510
|
|
105
105
|
onetick/py/db/__init__.py,sha256=-TKRO0suXTR-mLAppYt-Vegu9HQn7LU_JcObXpS3N9M,61
|
|
106
|
-
onetick/py/db/_inspection.py,sha256=
|
|
106
|
+
onetick/py/db/_inspection.py,sha256=6GAqs27xFyPyjTKodOSywcbz6tfFms6raXUAcPSKpW4,44591
|
|
107
107
|
onetick/py/db/db.py,sha256=nlkwQ0cDo2T7am4stNbbP_5NVDWD-nOIcoWYFVzr-_w,55920
|
|
108
108
|
onetick/py/db/utils.py,sha256=gt-KmbGgcp1tH81LH-cLO08n2Hx8GaBPbvfEN22mgLg,2309
|
|
109
109
|
onetick/py/docs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -139,14 +139,14 @@ onetick/py/utils/helpers.py,sha256=XY2PaMUSzFNIpiuiAY_gPQ0TnYTmfoPAGNAFh_6aB14,2
|
|
|
139
139
|
onetick/py/utils/locator.py,sha256=YUOXU0yh0ZZZOJpJniAq9WNn0_u3X_M5q2tEwt1cp_4,2887
|
|
140
140
|
onetick/py/utils/perf.py,sha256=g0r-9YUc2mx9Lj4PjG6Fk1keO3m9nC3t2cpHx3M-AeQ,19299
|
|
141
141
|
onetick/py/utils/query.py,sha256=b60JmfJDx3mpP74rTQC3qnlCb6t4fYFEauVaH9ulwL8,1330
|
|
142
|
-
onetick/py/utils/render.py,sha256=
|
|
142
|
+
onetick/py/utils/render.py,sha256=9SBKfKsHCrdF-FOZFGon7TalzXydCdPHINouRUwHMKM,38289
|
|
143
143
|
onetick/py/utils/script.py,sha256=Y8NujEo2_5QaP6KDnLKJiKQ7SmMjw8_dv8sYL9rHDCE,11184
|
|
144
144
|
onetick/py/utils/temp.py,sha256=j-BC155dE46k0zfKTTs26KTF0CK6WA1hO2GD54iunyM,17380
|
|
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.
|
|
148
|
-
onetick_py-1.
|
|
149
|
-
onetick_py-1.
|
|
150
|
-
onetick_py-1.
|
|
151
|
-
onetick_py-1.
|
|
152
|
-
onetick_py-1.
|
|
147
|
+
onetick_py-1.167.0.dist-info/licenses/LICENSE,sha256=Yhu7lKNFS0fsaN-jSattEMRtCOPueP58Eu5BPH8ZGjM,1075
|
|
148
|
+
onetick_py-1.167.0.dist-info/METADATA,sha256=Pe5It2d4IDu5GNpUsTOi8hlW8wtY07Un0IVZr9CoIqw,8024
|
|
149
|
+
onetick_py-1.167.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
150
|
+
onetick_py-1.167.0.dist-info/entry_points.txt,sha256=QmK_tFswIN-SQRmtnTSBEi8GvT0TVq-66IzXXZIsV3U,81
|
|
151
|
+
onetick_py-1.167.0.dist-info/top_level.txt,sha256=Na1jSJmVMyYGOndaswt554QKIUwQjcYh6th2ATsmw0U,23
|
|
152
|
+
onetick_py-1.167.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|