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.
- locator_parser/__init__.py +0 -0
- locator_parser/acl.py +73 -0
- locator_parser/actions.py +262 -0
- locator_parser/common.py +368 -0
- locator_parser/io.py +43 -0
- locator_parser/locator.py +150 -0
- onetick/__init__.py +101 -0
- onetick/doc_utilities/__init__.py +3 -0
- onetick/doc_utilities/napoleon.py +40 -0
- onetick/doc_utilities/ot_doctest.py +140 -0
- onetick/doc_utilities/snippets.py +279 -0
- onetick/lib/__init__.py +4 -0
- onetick/lib/instance.py +141 -0
- onetick/py/__init__.py +293 -0
- onetick/py/_stack_info.py +89 -0
- onetick/py/_version.py +2 -0
- onetick/py/aggregations/__init__.py +11 -0
- onetick/py/aggregations/_base.py +648 -0
- onetick/py/aggregations/_docs.py +948 -0
- onetick/py/aggregations/compute.py +286 -0
- onetick/py/aggregations/functions.py +2216 -0
- onetick/py/aggregations/generic.py +104 -0
- onetick/py/aggregations/high_low.py +80 -0
- onetick/py/aggregations/num_distinct.py +83 -0
- onetick/py/aggregations/order_book.py +501 -0
- onetick/py/aggregations/other.py +1014 -0
- onetick/py/backports.py +26 -0
- onetick/py/cache.py +374 -0
- onetick/py/callback/__init__.py +5 -0
- onetick/py/callback/callback.py +276 -0
- onetick/py/callback/callbacks.py +131 -0
- onetick/py/compatibility.py +798 -0
- onetick/py/configuration.py +771 -0
- onetick/py/core/__init__.py +0 -0
- onetick/py/core/_csv_inspector.py +93 -0
- onetick/py/core/_internal/__init__.py +0 -0
- onetick/py/core/_internal/_manually_bound_value.py +6 -0
- onetick/py/core/_internal/_nodes_history.py +250 -0
- onetick/py/core/_internal/_op_utils/__init__.py +0 -0
- onetick/py/core/_internal/_op_utils/every_operand.py +9 -0
- onetick/py/core/_internal/_op_utils/is_const.py +10 -0
- onetick/py/core/_internal/_per_tick_scripts/tick_list_sort_template.script +121 -0
- onetick/py/core/_internal/_proxy_node.py +140 -0
- onetick/py/core/_internal/_state_objects.py +2312 -0
- onetick/py/core/_internal/_state_vars.py +93 -0
- onetick/py/core/_source/__init__.py +0 -0
- onetick/py/core/_source/_symbol_param.py +95 -0
- onetick/py/core/_source/schema.py +97 -0
- onetick/py/core/_source/source_methods/__init__.py +0 -0
- onetick/py/core/_source/source_methods/aggregations.py +809 -0
- onetick/py/core/_source/source_methods/applyers.py +296 -0
- onetick/py/core/_source/source_methods/columns.py +141 -0
- onetick/py/core/_source/source_methods/data_quality.py +301 -0
- onetick/py/core/_source/source_methods/debugs.py +272 -0
- onetick/py/core/_source/source_methods/drops.py +120 -0
- onetick/py/core/_source/source_methods/fields.py +619 -0
- onetick/py/core/_source/source_methods/filters.py +1002 -0
- onetick/py/core/_source/source_methods/joins.py +1413 -0
- onetick/py/core/_source/source_methods/merges.py +605 -0
- onetick/py/core/_source/source_methods/misc.py +1455 -0
- onetick/py/core/_source/source_methods/pandases.py +155 -0
- onetick/py/core/_source/source_methods/renames.py +356 -0
- onetick/py/core/_source/source_methods/sorts.py +183 -0
- onetick/py/core/_source/source_methods/switches.py +142 -0
- onetick/py/core/_source/source_methods/symbols.py +117 -0
- onetick/py/core/_source/source_methods/times.py +627 -0
- onetick/py/core/_source/source_methods/writes.py +986 -0
- onetick/py/core/_source/symbol.py +205 -0
- onetick/py/core/_source/tmp_otq.py +222 -0
- onetick/py/core/column.py +209 -0
- onetick/py/core/column_operations/__init__.py +0 -0
- onetick/py/core/column_operations/_methods/__init__.py +4 -0
- onetick/py/core/column_operations/_methods/_internal.py +28 -0
- onetick/py/core/column_operations/_methods/conversions.py +216 -0
- onetick/py/core/column_operations/_methods/methods.py +292 -0
- onetick/py/core/column_operations/_methods/op_types.py +160 -0
- onetick/py/core/column_operations/accessors/__init__.py +0 -0
- onetick/py/core/column_operations/accessors/_accessor.py +28 -0
- onetick/py/core/column_operations/accessors/decimal_accessor.py +104 -0
- onetick/py/core/column_operations/accessors/dt_accessor.py +537 -0
- onetick/py/core/column_operations/accessors/float_accessor.py +184 -0
- onetick/py/core/column_operations/accessors/str_accessor.py +1367 -0
- onetick/py/core/column_operations/base.py +1121 -0
- onetick/py/core/cut_builder.py +150 -0
- onetick/py/core/db_constants.py +20 -0
- onetick/py/core/eval_query.py +245 -0
- onetick/py/core/lambda_object.py +441 -0
- onetick/py/core/multi_output_source.py +232 -0
- onetick/py/core/per_tick_script.py +2256 -0
- onetick/py/core/query_inspector.py +464 -0
- onetick/py/core/source.py +1744 -0
- onetick/py/db/__init__.py +2 -0
- onetick/py/db/_inspection.py +1128 -0
- onetick/py/db/db.py +1327 -0
- onetick/py/db/utils.py +64 -0
- onetick/py/docs/__init__.py +0 -0
- onetick/py/docs/docstring_parser.py +112 -0
- onetick/py/docs/utils.py +81 -0
- onetick/py/functions.py +2398 -0
- onetick/py/license.py +190 -0
- onetick/py/log.py +88 -0
- onetick/py/math.py +935 -0
- onetick/py/misc.py +470 -0
- onetick/py/oqd/__init__.py +22 -0
- onetick/py/oqd/eps.py +1195 -0
- onetick/py/oqd/sources.py +325 -0
- onetick/py/otq.py +216 -0
- onetick/py/pyomd_mock.py +47 -0
- onetick/py/run.py +916 -0
- onetick/py/servers.py +173 -0
- onetick/py/session.py +1347 -0
- onetick/py/sources/__init__.py +19 -0
- onetick/py/sources/cache.py +167 -0
- onetick/py/sources/common.py +128 -0
- onetick/py/sources/csv.py +642 -0
- onetick/py/sources/custom.py +85 -0
- onetick/py/sources/data_file.py +305 -0
- onetick/py/sources/data_source.py +1045 -0
- onetick/py/sources/empty.py +94 -0
- onetick/py/sources/odbc.py +337 -0
- onetick/py/sources/order_book.py +271 -0
- onetick/py/sources/parquet.py +168 -0
- onetick/py/sources/pit.py +191 -0
- onetick/py/sources/query.py +495 -0
- onetick/py/sources/snapshots.py +419 -0
- onetick/py/sources/split_query_output_by_symbol.py +198 -0
- onetick/py/sources/symbology_mapping.py +123 -0
- onetick/py/sources/symbols.py +374 -0
- onetick/py/sources/ticks.py +825 -0
- onetick/py/sql.py +70 -0
- onetick/py/state.py +251 -0
- onetick/py/types.py +2131 -0
- onetick/py/utils/__init__.py +70 -0
- onetick/py/utils/acl.py +93 -0
- onetick/py/utils/config.py +186 -0
- onetick/py/utils/default.py +49 -0
- onetick/py/utils/file.py +38 -0
- onetick/py/utils/helpers.py +76 -0
- onetick/py/utils/locator.py +94 -0
- onetick/py/utils/perf.py +498 -0
- onetick/py/utils/query.py +49 -0
- onetick/py/utils/render.py +1374 -0
- onetick/py/utils/script.py +244 -0
- onetick/py/utils/temp.py +471 -0
- onetick/py/utils/types.py +120 -0
- onetick/py/utils/tz.py +84 -0
- onetick_py-1.177.0.dist-info/METADATA +137 -0
- onetick_py-1.177.0.dist-info/RECORD +152 -0
- onetick_py-1.177.0.dist-info/WHEEL +5 -0
- onetick_py-1.177.0.dist-info/entry_points.txt +2 -0
- onetick_py-1.177.0.dist-info/licenses/LICENSE +21 -0
- onetick_py-1.177.0.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from warnings import warn
|
|
4
|
+
|
|
5
|
+
import onetick.py as otp
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def __create_bat_script_to_run_config(dir_path, config_path):
|
|
9
|
+
with open(os.path.join(dir_path, "run.bat"), "w") as fout:
|
|
10
|
+
fout.write(f"set ONE_TICK_CONFIG={config_path}\n")
|
|
11
|
+
|
|
12
|
+
path = os.path.join(omd_dist_path(), "one_tick", "bin", "OneTickDisplay.exe")
|
|
13
|
+
|
|
14
|
+
fout.write(f'start "OneTick GUI" {path} -context DEFAULT\n')
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def __create_bat_script_to_run_query_designer(dir_path, config_path):
|
|
18
|
+
with open(os.path.join(dir_path, "run_query_designer.bat"), "w") as fout:
|
|
19
|
+
fout.write(f"set ONE_TICK_CONFIG={config_path}\n")
|
|
20
|
+
|
|
21
|
+
path = os.path.join(omd_dist_path(), "one_tick", "bin", "QueryDesigner.exe")
|
|
22
|
+
|
|
23
|
+
fout.write(f'start "Query Designer" {path} -context DEFAULT\n')
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def write_config_for_tick_server_run(fout, config_path, path):
|
|
27
|
+
fout.write('if [ "$1" == "-" ]; then\n')
|
|
28
|
+
fout.write(
|
|
29
|
+
" " * 4
|
|
30
|
+
+ "onetick server --cfg "
|
|
31
|
+
+ config_path
|
|
32
|
+
+ " -n "
|
|
33
|
+
+ os.path.basename(config_path).split(".")[0]
|
|
34
|
+
+ " ${@:2}\n" # this option allows to propagate other custom parameters into the script externally
|
|
35
|
+
)
|
|
36
|
+
fout.write("else\n")
|
|
37
|
+
fout.write(" " * 4 + path + " -context DEFAULT -port $MAIN_TS_PORT > /dev/null 2>&1\n")
|
|
38
|
+
fout.write("fi\n")
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def __create_shell_script_to_run_config(dir_path, config_path):
|
|
42
|
+
file_name = os.path.join(dir_path, "run.sh")
|
|
43
|
+
|
|
44
|
+
path = os.path.join(omd_dist_path(), "one_tick", "bin", "tick_server.exe")
|
|
45
|
+
|
|
46
|
+
with open(file_name, "w") as fout:
|
|
47
|
+
fout.write("#!/bin/bash\n")
|
|
48
|
+
fout.write('if [[ -z "$1" && -z "$MAIN_TS_PORT" ]]; then\n')
|
|
49
|
+
fout.write(
|
|
50
|
+
" " * 4
|
|
51
|
+
+ 'echo "Please, define port either using MAIN_TS_PORT environment'
|
|
52
|
+
' variable or as a first parameter to the ./run.sh script"\n'
|
|
53
|
+
)
|
|
54
|
+
fout.write(" " * 4 + "exit 1\n")
|
|
55
|
+
fout.write("\n")
|
|
56
|
+
fout.write("fi\n")
|
|
57
|
+
fout.write('if [[ -n "$1" ]]; then\n')
|
|
58
|
+
fout.write(" " * 4 + "MAIN_TS_PORT=$1\n")
|
|
59
|
+
fout.write("fi\n")
|
|
60
|
+
fout.write("\n")
|
|
61
|
+
fout.write(f"export ONE_TICK_CONFIG={config_path}\n")
|
|
62
|
+
write_config_for_tick_server_run(fout, config_path, path)
|
|
63
|
+
|
|
64
|
+
os.chmod(file_name, 0o750)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def __create_shell_script_to_run_dashboard(dir_path, config_path, main_install_dir):
|
|
68
|
+
if main_install_dir is None:
|
|
69
|
+
return
|
|
70
|
+
file_name = os.path.join(dir_path, "run_dashboard.sh")
|
|
71
|
+
path_ts = os.path.join(omd_dist_path(), "one_tick", "bin", "tick_server.exe")
|
|
72
|
+
client_data_path = os.path.join(main_install_dir, "client_data")
|
|
73
|
+
common_path = os.path.join(main_install_dir, "sol", "common")
|
|
74
|
+
tomcat_cfg = os.path.join(dir_path, 'tomcat.txt')
|
|
75
|
+
db_locator_remote = os.path.join(common_path, "config", "locator.remote")
|
|
76
|
+
|
|
77
|
+
Path(tomcat_cfg).write_text('')
|
|
78
|
+
|
|
79
|
+
with open(config_path, 'a') as f:
|
|
80
|
+
f.write(f'\nDB_LOCATOR.REMOTE = "{db_locator_remote}"')
|
|
81
|
+
|
|
82
|
+
with open(file_name, "w") as fout:
|
|
83
|
+
fout.write("#!/bin/bash\n")
|
|
84
|
+
fout.write(
|
|
85
|
+
'if [[ -z "$1" &&'
|
|
86
|
+
' -z "$MAIN_TS_PORT" &&'
|
|
87
|
+
' -z "$CATALINA_HTTP_PORT" &&'
|
|
88
|
+
' -z "$CATALINA_SERVER_PORT" ]]; then\n')
|
|
89
|
+
fout.write(
|
|
90
|
+
" " * 4
|
|
91
|
+
+ 'echo "Please, define ts port to use sequentially ports for catalina '
|
|
92
|
+
'or using \\$MAIN_TS_PORT, \\$CATALINA_HTTP_PORT, '
|
|
93
|
+
'\\$CATALINA_SERVER_PORT environment variable or '
|
|
94
|
+
'as a first parameter to the script"\n'
|
|
95
|
+
)
|
|
96
|
+
fout.write(" " * 4 + "exit 1\n")
|
|
97
|
+
fout.write("\n")
|
|
98
|
+
fout.write("fi\n")
|
|
99
|
+
fout.write('if [[ -n "$1" ]]; then\n')
|
|
100
|
+
fout.write(" " * 4 + "export CATALINA_HTTP_PORT=$1\n")
|
|
101
|
+
fout.write(" " * 4 + "export MAIN_TS_PORT=$(($1 + 1))\n")
|
|
102
|
+
fout.write(" " * 4 + "export CATALINA_SERVER_PORT=$(($1 + 2))\n")
|
|
103
|
+
fout.write("fi\n")
|
|
104
|
+
fout.write("\n")
|
|
105
|
+
fout.write('echo "Running dashboard with CATALINA_HTTP_PORT=$CATALINA_HTTP_PORT, '
|
|
106
|
+
'MAIN_TS_PORT=$MAIN_TS_PORT, '
|
|
107
|
+
'CATALINA_SERVER_PORT=${CATALINA_SERVER_PORT}"\n')
|
|
108
|
+
fout.write("export ONE_TICK_CONFIG=" + config_path + "\n")
|
|
109
|
+
fout.write("export MAIN_CLIENT_DIR=" + client_data_path + "\n")
|
|
110
|
+
fout.write("export MAIN_INSTALL_DIR=" + main_install_dir + "\n")
|
|
111
|
+
fout.write("export OMD_WEB_DASHBOARD_CONFIG_FILE="
|
|
112
|
+
+ os.path.join(client_data_path, "config", "web_dashboard.cfg") + "\n")
|
|
113
|
+
fout.write("export COMMON_PACK=" + common_path + "\n")
|
|
114
|
+
fout.write("export SURV_PACK=" + os.path.join(main_install_dir,
|
|
115
|
+
"sol", "surveillance") + "\n")
|
|
116
|
+
fout.write("export BESTEX_PACK=" + os.path.join(main_install_dir,
|
|
117
|
+
"sol", "bestex") + "\n")
|
|
118
|
+
fout.write("export WORKFLOW_PACK=" + os.path.join(main_install_dir,
|
|
119
|
+
"sol", "workflow") + "\n")
|
|
120
|
+
fout.write("source " + os.path.join(common_path, "config", "src",
|
|
121
|
+
"env_common_functions.sh") + "\n")
|
|
122
|
+
|
|
123
|
+
fout.write('if isAWSHosted\n')
|
|
124
|
+
fout.write('then\n')
|
|
125
|
+
fout.write(' export_if_empty MAIN_ONE_TICK_DIR="/opt/one_market_data/one_tick"\n')
|
|
126
|
+
fout.write(' export_if_empty LICENSE_DIR="/license"\n')
|
|
127
|
+
fout.write(' export_if_empty VENDOR_DATA_DIR="${LOCATOR_LOCAL_DATA_DIR}/vendor_data/"\n')
|
|
128
|
+
fout.write(' export_if_empty JAVA_HOME="/usr/bin/java"\n')
|
|
129
|
+
fout.write('\n')
|
|
130
|
+
fout.write(' if [[ -d /usr/share/tomcat8 ]]\n')
|
|
131
|
+
fout.write(' then\n')
|
|
132
|
+
fout.write(' export_if_empty CATALINA_HOME="/usr/share/tomcat8"\n')
|
|
133
|
+
fout.write(' else\n')
|
|
134
|
+
fout.write(' export_if_empty CATALINA_HOME="/usr/share/tomcat"\n')
|
|
135
|
+
fout.write(' fi\n')
|
|
136
|
+
fout.write('\n')
|
|
137
|
+
fout.write(' # trying system tomcat, then client tomcat, then sol tomcat\n')
|
|
138
|
+
fout.write(' if [[ -d "/etc/omd/tomcat" ]]; then\n')
|
|
139
|
+
fout.write(' export_if_empty CATALINA_BASE="/etc/omd/tomcat"\n')
|
|
140
|
+
fout.write(' elif [[ -d "${MAIN_CLIENT_DIR}/config/tomcat" ]]; then\n')
|
|
141
|
+
fout.write(' export_if_empty CATALINA_BASE="${MAIN_CLIENT_DIR}/config/tomcat"\n')
|
|
142
|
+
fout.write(' else\n')
|
|
143
|
+
fout.write(' export_if_empty CATALINA_BASE="${COMMON_PACK}/tomcat"\n')
|
|
144
|
+
fout.write(' fi\n')
|
|
145
|
+
fout.write('fi\n')
|
|
146
|
+
fout.write('\n')
|
|
147
|
+
fout.write('if isDeployed\n')
|
|
148
|
+
fout.write('then\n')
|
|
149
|
+
fout.write(' export_if_empty MAIN_TS_PORT=12345\n')
|
|
150
|
+
fout.write(' export_if_empty CATALINA_SERVER_PORT=12346\n')
|
|
151
|
+
fout.write(' export_if_empty CATALINA_HTTP_PORT=8080\n')
|
|
152
|
+
fout.write(' export_if_empty OMD_WEB_DASHBOARD_CONFIG_FILE=${MAIN_CLIENT_DIR}/config/web_dashboard.cfg\n')
|
|
153
|
+
fout.write(' export_if_empty MAIN_ONE_TICK_DIR="$MAIN_INSTALL_DIR/../onetick/one_market_data/one_tick"\n')
|
|
154
|
+
fout.write(' export_if_empty LICENSE_DIR="$MAIN_INSTALL_DIR/../license"\n')
|
|
155
|
+
fout.write(' export_if_empty JAVA_HOME="$MAIN_INSTALL_DIR/../java/jdk1.8.0_202"\n')
|
|
156
|
+
fout.write(' export_if_empty CATALINA_HOME="$MAIN_INSTALL_DIR/../tomcat"\n')
|
|
157
|
+
fout.write(' export_if_empty CATALINA_BASE="$MAIN_CLIENT_DIR/config/tomcat"\n')
|
|
158
|
+
fout.write('fi\n')
|
|
159
|
+
fout.write('export_if_empty CATALINA_PID="$CATALINA_BASE/bin/pid"\n')
|
|
160
|
+
fout.write('export_if_empty CATALINA_TMPDIR="$CATALINA_BASE/temp"\n')
|
|
161
|
+
fout.write(f'export TOMCAT_CFG="{tomcat_cfg}"\n')
|
|
162
|
+
fout.write(
|
|
163
|
+
'export JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 '
|
|
164
|
+
'-server -Xms512m -Xmx512m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC '
|
|
165
|
+
'-XX:+AggressiveOpts -DServerPort=$CATALINA_SERVER_PORT $JAVA_OPTS"\n')
|
|
166
|
+
fout.write(
|
|
167
|
+
'export CATALINA_OPTS="-Djna.tmpdir=$CATALINA_TMPDIR '
|
|
168
|
+
'-Dcatalina.log.path=$MAIN_LOG_DIR -DHttpPort=$CATALINA_HTTP_PORT '
|
|
169
|
+
'-DHttpsPort=$CATALINA_HTTPS_PORT -DUser=$USER $CATALINA_OPTS"\n')
|
|
170
|
+
fout.write(
|
|
171
|
+
'export PATH="$MAIN_ONE_TICK_DIR/bin:$JAVA_HOME/bin:$CATALINA_HOME/bin:$COMMON_PACK/scripts:$PATH"\n')
|
|
172
|
+
fout.write(
|
|
173
|
+
'export LD_LIBRARY_PATH="$MAIN_ONE_TICK_DIR/bin:'
|
|
174
|
+
'$MAIN_ONE_TICK_DIR/lib:$MAIN_ONE_TICK_DIR/bin/wombat:'
|
|
175
|
+
'$MAIN_ONE_TICK_DIR/bin/activ:$MAIN_ONE_TICK_DIR/bin/rfa:'
|
|
176
|
+
'$MAIN_ONE_TICK_DIR/bin/spryware:$LD_LIBRARY_PATH"\n')
|
|
177
|
+
fout.write('export_if_empty MAIN_TS_IP="localhost"\n')
|
|
178
|
+
fout.write('if isAWSHosted\n')
|
|
179
|
+
fout.write('then\n')
|
|
180
|
+
fout.write(' ' + os.path.join(common_path, "scripts",
|
|
181
|
+
"impl", "start_apache_aws.sh") + "\n")
|
|
182
|
+
fout.write('fi\n')
|
|
183
|
+
fout.write('if isDeployed\n')
|
|
184
|
+
fout.write('then\n')
|
|
185
|
+
fout.write(' ' + os.path.join(common_path, "scripts",
|
|
186
|
+
"impl", "start_apache.sh") + "\n")
|
|
187
|
+
fout.write('fi\n')
|
|
188
|
+
write_config_for_tick_server_run(fout, config_path, path_ts)
|
|
189
|
+
fout.write('if isAWSHosted\n')
|
|
190
|
+
fout.write('then\n')
|
|
191
|
+
fout.write(' ' + os.path.join(common_path, "scripts",
|
|
192
|
+
"impl", "stop_apache_aws.sh") + "\n")
|
|
193
|
+
fout.write('fi\n')
|
|
194
|
+
fout.write('if isDeployed\n')
|
|
195
|
+
fout.write('then\n')
|
|
196
|
+
fout.write(' ' + os.path.join(common_path, "scripts",
|
|
197
|
+
"impl", "stop_apache.sh") + "\n")
|
|
198
|
+
fout.write('fi\n')
|
|
199
|
+
|
|
200
|
+
os.chmod(file_name, 0o750)
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
def create_file_to_run_config(dir_path, config_path, main_install_dir=None):
|
|
204
|
+
if otp.__webapi__:
|
|
205
|
+
warn("OTP_WEBAPI is set, means local configs will not work with remote OneTick server")
|
|
206
|
+
if os.name == "nt":
|
|
207
|
+
__create_bat_script_to_run_config(dir_path, config_path)
|
|
208
|
+
__create_bat_script_to_run_query_designer(dir_path, config_path)
|
|
209
|
+
else:
|
|
210
|
+
__create_shell_script_to_run_config(dir_path, config_path)
|
|
211
|
+
__create_shell_script_to_run_dashboard(dir_path, config_path,
|
|
212
|
+
main_install_dir)
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
def omd_dist_path():
|
|
216
|
+
"""
|
|
217
|
+
Returns path to the OneTick distribution calculated from the
|
|
218
|
+
PYTHONPATH or MAIN_ONE_TICK_DIR. If path is not found, then FileNotFoundError is risen.
|
|
219
|
+
Example for a linux system: /opt/one_market_data
|
|
220
|
+
"""
|
|
221
|
+
omd_prefix = Path('one_market_data/one_tick')
|
|
222
|
+
res_path = None
|
|
223
|
+
|
|
224
|
+
paths = []
|
|
225
|
+
pythonpath = os.environ.get('PYTHONPATH')
|
|
226
|
+
if pythonpath:
|
|
227
|
+
paths = pythonpath.split(os.pathsep)
|
|
228
|
+
main_one_tick_dir = os.environ.get('MAIN_ONE_TICK_DIR')
|
|
229
|
+
if main_one_tick_dir:
|
|
230
|
+
paths.append(main_one_tick_dir)
|
|
231
|
+
|
|
232
|
+
for value in paths:
|
|
233
|
+
if str(omd_prefix) in str(Path(value)):
|
|
234
|
+
res_path = value
|
|
235
|
+
break
|
|
236
|
+
|
|
237
|
+
if res_path is None:
|
|
238
|
+
raise FileNotFoundError('Path to OneTick distribution is not found')
|
|
239
|
+
|
|
240
|
+
base_prefix = 'one_market_data'
|
|
241
|
+
omd_prefix_pos = res_path.find(base_prefix)
|
|
242
|
+
res_path = res_path[: omd_prefix_pos + len(base_prefix)]
|
|
243
|
+
|
|
244
|
+
return res_path
|