cfquant 0.2.9__tar.gz → 0.2.22__tar.gz
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.
- {cfquant-0.2.9 → cfquant-0.2.22}/LTtx/tx/LTtx_server.py +14 -7
- {cfquant-0.2.9 → cfquant-0.2.22}/LTtx/tx/tx.py +27 -14
- {cfquant-0.2.9 → cfquant-0.2.22}/MANIFEST.in +2 -1
- {cfquant-0.2.9 → cfquant-0.2.22}/PKG-INFO +53 -37
- {cfquant-0.2.9 → cfquant-0.2.22}/README.md +50 -35
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant/__init__.py +4 -2
- cfquant-0.2.22/cfquant/_editable_install.py +488 -0
- cfquant-0.2.22/cfquant/batch_orders.py +396 -0
- cfquant-0.2.22/cfquant/cftrader.py +119 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant/cli.py +35 -11
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant/client.py +30 -27
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant/config.py +6 -6
- cfquant-0.2.22/cfquant/level2.py +172 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant/normal_bridge.py +425 -131
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant/order_meta.py +279 -37
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant/pipe_bridge.py +20 -17
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant/pipe_client.py +38 -38
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant/pipe_hub.py +388 -119
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant/pipe_transport.py +241 -163
- cfquant-0.2.22/cfquant/protocol.py +357 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant/qmt_bridge.py +184 -115
- cfquant-0.2.22/cfquant/qmt_strategy_deploy.py +808 -0
- cfquant-0.2.22/cfquant/qmt_strategy_package.py +69 -0
- cfquant-0.2.22/cfquant/qmt_strategy_runtime.py +244 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant/runtime_report.py +37 -0
- cfquant-0.2.22/cfquant/tests/10_/345/221/275/344/273/244/350/241/214/346/216/245/345/217/243/346/265/213/350/257/225.py +120 -0
- cfquant-0.2.22/cfquant/tests/11_/346/231/256/351/200/232/346/241/245/346/216/245/346/264/276/345/217/221/346/265/213/350/257/225.py +81 -0
- cfquant-0.2.22/cfquant/tests/12_/350/256/242/345/215/225/345/244/207/346/263/250/346/265/213/350/257/225.py +1685 -0
- cfquant-0.2.22/cfquant/tests/13_/347/256/241/351/201/223/344/270/255/345/277/203/350/277/236/346/216/245/346/265/213/350/257/225.py +184 -0
- cfquant-0.2.22/cfquant/tests/14_/350/277/220/350/241/214/346/227/266/346/212/245/345/221/212/346/265/213/350/257/225.py +54 -0
- cfquant-0.2.22/cfquant/tests/15_/347/275/221/351/241/265/347/212/266/346/200/201/347/274/223/345/255/230/346/265/213/350/257/225.py +944 -0
- cfquant-0.2.22/cfquant/tests/16_/345/220/257/345/212/250/345/256/211/350/243/205/346/265/213/350/257/225.py +353 -0
- cfquant-0.2.22/cfquant/tests/17_/345/244/247QMT/346/216/245/345/217/243/351/200/202/351/205/215/346/265/213/350/257/225.py +486 -0
- cfquant-0.2.22/cfquant/tests/18_/351/253/230/347/272/247/346/250/241/345/274/217/345/256/236/346/234/272/350/201/224/350/260/203.py +433 -0
- cfquant-0.2.22/cfquant/tests/19_/345/256/236/346/234/272/350/201/224/350/260/203/345/210/244/345/256/232/346/265/213/350/257/225.py +62 -0
- cfquant-0.2.22/cfquant/tests/1_/350/241/214/346/203/205/346/216/245/346/224/266/346/265/213/350/257/225.py +300 -0
- cfquant-0.2.22/cfquant/tests/20_/350/201/224/350/260/203/351/227/256/351/242/230/344/277/256/345/244/215/346/265/213/350/257/225.py +1067 -0
- cfquant-0.2.22/cfquant/tests/21_/345/215/225/350/202/241/350/241/214/346/203/205/350/256/242/351/230/205/346/265/213/350/257/225.py +291 -0
- cfquant-0.2.22/cfquant/tests/22_/350/277/236/346/216/245/350/257/212/346/226/255/346/265/213/350/257/225.py +113 -0
- cfquant-0.2.22/cfquant/tests/23_/347/244/272/344/276/213/351/205/215/347/275/256/346/265/213/350/257/225.py +214 -0
- cfquant-0.2.22/cfquant/tests/24_/350/264/246/346/210/267/347/274/223/345/255/230/346/214/211/351/234/200/345/210/267/346/226/260/346/265/213/350/257/225.py +323 -0
- cfquant-0.2.22/cfquant/tests/25_/350/264/246/346/210/267/347/274/223/345/255/230/351/241/265/351/235/242/346/265/213/350/257/225.py +88 -0
- cfquant-0.2.22/cfquant/tests/26_/345/205/250/346/216/250/350/256/242/351/230/205/346/265/213/350/257/225.py +366 -0
- cfquant-0.2.22/cfquant/tests/27_/345/205/250/346/216/250/350/256/242/351/230/205/351/241/265/351/235/242/346/265/213/350/257/225.py +31 -0
- cfquant-0.2.22/cfquant/tests/28_Level2/346/216/245/345/217/243/351/200/202/351/205/215/346/265/213/350/257/225.py +425 -0
- cfquant-0.2.22/cfquant/tests/29_Level2/350/241/214/346/203/205/346/265/213/350/257/225.py +114 -0
- cfquant-0.2.22/cfquant/tests/2_/346/225/260/346/215/256/350/216/267/345/217/226/346/265/213/350/257/225.py +508 -0
- cfquant-0.2.22/cfquant/tests/30_cftrader/346/211/271/351/207/217/344/270/213/345/215/225/346/200/247/350/203/275/345/237/272/345/207/206.py +215 -0
- cfquant-0.2.22/cfquant/tests/31_cftrader/346/250/241/346/213/237/350/264/246/345/217/267/346/211/271/351/207/217/344/270/213/345/215/225/346/265/213/350/257/225.py +685 -0
- cfquant-0.2.22/cfquant/tests/3_/346/225/260/346/215/256/344/270/213/350/275/275/346/265/213/350/257/225.py +229 -0
- cfquant-0.2.22/cfquant/tests/4_/344/272/244/346/230/223/345/247/224/346/211/230/346/237/245/350/257/242/346/265/213/350/257/225.py +335 -0
- cfquant-0.2.22/cfquant/tests/5_/347/234/237/345/256/236/344/270/213/345/215/225/346/265/213/350/257/225.py +879 -0
- cfquant-0.2.22/cfquant/tests/6_/345/233/236/350/260/203/346/265/213/350/257/225.py +614 -0
- cfquant-0.2.22/cfquant/tests/7_/345/220/214/346/255/245/345/274/202/346/255/245/344/270/213/345/215/225/346/265/213/350/257/225.py +504 -0
- cfquant-0.2.22/cfquant/tests/8_/346/210/220/344/272/244/350/256/242/345/215/225/345/222/214/345/247/224/346/211/230/350/256/242/345/215/225/346/237/245/350/257/242/346/265/213/350/257/225.py +246 -0
- cfquant-0.2.22/cfquant/tests/9_/345/217/257/346/222/244/350/256/242/345/215/225/346/265/213/350/257/225.py +458 -0
- cfquant-0.2.22/cfquant/tests/_helpers.py +260 -0
- cfquant-0.2.22/cfquant/tests/log/cftrader/346/250/241/346/213/237/350/264/246/345/217/267/346/211/271/351/207/217/344/270/213/345/215/225/346/265/213/350/257/225_20260911_024617.md +12 -0
- cfquant-0.2.22/cfquant/tests/readme.md +310 -0
- cfquant-0.2.22/cfquant/tests/test_api_tester_browser.py +236 -0
- cfquant-0.2.22/cfquant/tests/test_api_tester_web.py +190 -0
- cfquant-0.2.22/cfquant/tests/test_binding_delete_confirmation.py +91 -0
- cfquant-0.2.22/cfquant/tests/test_cftrader.py +589 -0
- cfquant-0.2.22/cfquant/tests/test_cftrader_tutorial.py +177 -0
- cfquant-0.2.22/cfquant/tests/test_cftrader_web.py +261 -0
- cfquant-0.2.22/cfquant/tests/test_credit_compat.py +452 -0
- cfquant-0.2.22/cfquant/tests/test_json_serialization.py +186 -0
- cfquant-0.2.22/cfquant/tests/test_project_updater.py +210 -0
- cfquant-0.2.22/cfquant/tests/test_python_api_reference.py +88 -0
- cfquant-0.2.22/cfquant/tests/test_qmt_strategy_browser.py +566 -0
- cfquant-0.2.22/cfquant/tests/test_qmt_strategy_deploy.py +632 -0
- cfquant-0.2.22/cfquant/tests/test_qmt_strategy_web.py +393 -0
- cfquant-0.2.22/cfquant/tests/test_tutorial_reader.py +319 -0
- cfquant-0.2.22/cfquant/tests/test_tx_auto_import.py +26 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant/tx.py +27 -14
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant/tx_trade_bridge.py +1140 -190
- cfquant-0.2.22/cfquant/version.py +5 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant/xtdata.py +181 -53
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant/xttrader.py +514 -267
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant/xttype.py +474 -99
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant.egg-info/PKG-INFO +53 -37
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant.egg-info/SOURCES.txt +60 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant.egg-info/requires.txt +1 -2
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant_web_server.py +3855 -957
- {cfquant-0.2.9 → cfquant-0.2.22}/pyproject.toml +5 -4
- {cfquant-0.2.9 → cfquant-0.2.22}/qmt_scripts/CFQUANT.py +37 -6
- {cfquant-0.2.9 → cfquant-0.2.22}/qmt_scripts/CFQUANT_CTYPE_ALL_LOWLAT.py +37 -6
- {cfquant-0.2.9 → cfquant-0.2.22}/qmt_scripts/CFQUANT_LITE.py +2176 -1139
- {cfquant-0.2.9 → cfquant-0.2.22}/qmt_scripts//345/220/214/350/264/246/345/217/267/347/213/254/347/253/213/345/270/202/345/234/272/CFQUANT_CTYPE_ALL_LOWLAT_SH.py +37 -6
- {cfquant-0.2.9 → cfquant-0.2.22}/qmt_scripts//345/220/214/350/264/246/345/217/267/347/213/254/347/253/213/345/270/202/345/234/272/CFQUANT_CTYPE_ALL_LOWLAT_SZ.py +37 -6
- {cfquant-0.2.9 → cfquant-0.2.22}/qmt_scripts//345/220/214/350/264/246/345/217/267/347/213/254/347/253/213/345/270/202/345/234/272/CFQUANT_LITE_SH.py +2194 -1139
- {cfquant-0.2.9 → cfquant-0.2.22}/qmt_scripts//345/220/214/350/264/246/345/217/267/347/213/254/347/253/213/345/270/202/345/234/272/CFQUANT_LITE_SZ.py +2194 -1139
- {cfquant-0.2.9 → cfquant-0.2.22}/qmt_scripts//345/220/214/350/264/246/345/217/267/347/213/254/347/253/213/345/270/202/345/234/272/readme.md +19 -8
- cfquant-0.2.22/requirements.txt +12 -0
- cfquant-0.2.22/web_dashboard/api-tester.js +198 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/app.js +2852 -544
- cfquant-0.2.22/web_dashboard/cftrader-api-data.js +176 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/index.html +1135 -351
- cfquant-0.2.22/web_dashboard/python-api-data.js +7684 -0
- cfquant-0.2.22/web_dashboard/python-api.js +254 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/styles.css +1723 -369
- cfquant-0.2.9/cfquant/protocol.py +0 -238
- cfquant-0.2.9/cfquant/version.py +0 -5
- cfquant-0.2.9/requirements.txt +0 -7
- {cfquant-0.2.9 → cfquant-0.2.22}/LICENSE +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/LTtx/__init__.py +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/LTtx/tx/Config.txt +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/LTtx/tx/__init__.py +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant/account_routing.py +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant/channels.py +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant/hub.py +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant/logging_i18n.py +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant/xtconstant.py +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant.egg-info/dependency_links.txt +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant.egg-info/entry_points.txt +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant.egg-info/top_level.txt +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/cfquant_pipe_hub.py +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/qmt_scripts/CFQUANT_TRADE_LOWLAT.py +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/qmt_scripts/__init__.py +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/qmt_scripts//345/220/214/350/264/246/345/217/267/347/213/254/347/253/213/345/270/202/345/234/272/CFQUANT_TRADE_LOWLAT_SH.py" +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/qmt_scripts//345/220/214/350/264/246/345/217/267/347/213/254/347/253/213/345/270/202/345/234/272/CFQUANT_TRADE_LOWLAT_SZ.py" +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/setup.cfg +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/__init__.py +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/avatars/amber-pulse.svg +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/avatars/copper-grid.svg +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/avatars/market-blue.svg +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/avatars/rose-circuit.svg +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/avatars/signal-green.svg +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/avatars/slate-wave.svg +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/avatars/teal-orbit.svg +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/avatars/violet-node.svg +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/favicon.svg +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/image/qmt_deploy/image-10.png +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/image/qmt_deploy/image-11.png +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/image/qmt_deploy/image-12.png +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/image/qmt_deploy/image-13.png +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/image/qmt_deploy/image-14.png +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/image/qmt_deploy/image-15.png +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/image/qmt_deploy/image-16.png +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/image/qmt_deploy/image-17.png +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/image/qmt_deploy/image-18.png +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/image/qmt_deploy/image-19.png +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/image/qmt_deploy/image-20.png +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/image/qmt_deploy/image-21.png +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/image/qmt_deploy/image-4.png +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/image/qmt_deploy/image-5.png +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/image/qmt_deploy/image-6.png +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/image/qmt_deploy/image-7.png +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/image/qmt_deploy/image-8.png +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/image/qmt_deploy/image-9.png +0 -0
- {cfquant-0.2.9 → cfquant-0.2.22}/web_dashboard/vendor/mermaid.min.js +0 -0
|
@@ -16,9 +16,17 @@ import datetime
|
|
|
16
16
|
import importlib
|
|
17
17
|
import subprocess
|
|
18
18
|
import sys
|
|
19
|
-
from packaging import version
|
|
20
|
-
|
|
21
|
-
#运行需要的库
|
|
19
|
+
from packaging import version
|
|
20
|
+
|
|
21
|
+
#运行需要的库
|
|
22
|
+
DEFAULT_PIP_INDEX_URL = "https://pypi.tuna.tsinghua.edu.cn/simple"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _pip_index_args():
|
|
26
|
+
index_url = os.environ.get("CFQUANT_PIP_INDEX_URL", DEFAULT_PIP_INDEX_URL).strip()
|
|
27
|
+
return ["--index-url", index_url] if index_url else []
|
|
28
|
+
|
|
29
|
+
|
|
22
30
|
need_packge = {
|
|
23
31
|
'psutil': {'pip_name': 'psutil', 'version': '1.0.0'},
|
|
24
32
|
'pandas': {'pip_name': 'pandas', 'version': '0.0.1'},
|
|
@@ -84,10 +92,9 @@ def ensure_modules_with_version(modules: dict):
|
|
|
84
92
|
install_target = pip_name if required_version == "latest" else "%s>=%s" % (pip_name, required_version)
|
|
85
93
|
print(f"[AutoInstall] 正在安装/升级 {pip_name} → {required_version}...")
|
|
86
94
|
try:
|
|
87
|
-
subprocess.check_call([
|
|
88
|
-
sys.executable, "-m", "pip", "install", install_target,
|
|
89
|
-
|
|
90
|
-
], **_hidden_subprocess_kwargs())
|
|
95
|
+
subprocess.check_call([
|
|
96
|
+
sys.executable, "-m", "pip", "install", install_target,
|
|
97
|
+
] + _pip_index_args(), **_hidden_subprocess_kwargs())
|
|
91
98
|
print(f"[AutoInstall] 成功安装 {pip_name} {required_version}")
|
|
92
99
|
except Exception as e:
|
|
93
100
|
print(f"[AutoInstall] 安装 {pip_name} 失败: {e}")
|
|
@@ -17,10 +17,18 @@ import datetime
|
|
|
17
17
|
import sys
|
|
18
18
|
import subprocess
|
|
19
19
|
import importlib
|
|
20
|
-
import pandas as pd
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
import pandas as pd
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
DEFAULT_PIP_INDEX_URL = "https://pypi.tuna.tsinghua.edu.cn/simple"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _pip_index_args():
|
|
27
|
+
index_url = os.environ.get("CFQUANT_PIP_INDEX_URL", DEFAULT_PIP_INDEX_URL).strip()
|
|
28
|
+
return ["--index-url", index_url] if index_url else []
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _hidden_subprocess_kwargs():
|
|
24
32
|
if os.name != "nt":
|
|
25
33
|
return {}
|
|
26
34
|
kwargs = {}
|
|
@@ -113,9 +121,11 @@ class txl:
|
|
|
113
121
|
self.orjson_on = True
|
|
114
122
|
return importlib.import_module(import_name)
|
|
115
123
|
except ImportError:
|
|
116
|
-
self.sys_price(f"[TxLink自动安装] 缺少依赖 {package_name},正在安装...请不要退出,安装完成后程序将正常运行")
|
|
117
|
-
try:
|
|
118
|
-
subprocess.check_call([
|
|
124
|
+
self.sys_price(f"[TxLink自动安装] 缺少依赖 {package_name},正在安装...请不要退出,安装完成后程序将正常运行")
|
|
125
|
+
try:
|
|
126
|
+
subprocess.check_call([
|
|
127
|
+
sys.executable, "-m", "pip", "install", package_name,
|
|
128
|
+
] + _pip_index_args(), **_hidden_subprocess_kwargs())
|
|
119
129
|
self.orjson_on = True
|
|
120
130
|
return importlib.import_module(import_name)
|
|
121
131
|
except:
|
|
@@ -258,13 +268,16 @@ class txl:
|
|
|
258
268
|
else:
|
|
259
269
|
self.sys_print('当前版本已经是最新')
|
|
260
270
|
|
|
261
|
-
def sys_print(self,data,show_force=False):
|
|
262
|
-
msg = '%sLTtx[info]>>>>:%s,'%(self.get_nowtime(),data)
|
|
263
|
-
if self.sys_print_on or show_force:
|
|
264
|
-
print(msg)
|
|
265
|
-
self.save_log(msg)
|
|
266
|
-
|
|
267
|
-
def
|
|
271
|
+
def sys_print(self,data,show_force=False):
|
|
272
|
+
msg = '%sLTtx[info]>>>>:%s,'%(self.get_nowtime(),data)
|
|
273
|
+
if self.sys_print_on or show_force:
|
|
274
|
+
print(msg)
|
|
275
|
+
self.save_log(msg)
|
|
276
|
+
|
|
277
|
+
def sys_price(self,data,show_force=False):
|
|
278
|
+
return self.sys_print(data,show_force=show_force)
|
|
279
|
+
|
|
280
|
+
def send_file(self,file_name,show_on=True):
|
|
268
281
|
'''
|
|
269
282
|
将本地文件上传至数据中心
|
|
270
283
|
|
|
@@ -4,13 +4,13 @@ include cfquant_web_server.py
|
|
|
4
4
|
include cfquant_pipe_hub.py
|
|
5
5
|
|
|
6
6
|
recursive-include cfquant *.py
|
|
7
|
+
recursive-include cfquant/tests *.py *.md
|
|
7
8
|
recursive-include LTtx *.py
|
|
8
9
|
include LTtx/tx/Config.txt
|
|
9
10
|
|
|
10
11
|
recursive-include web_dashboard *.html *.css *.js *.svg *.png
|
|
11
12
|
recursive-include qmt_scripts *.py *.md
|
|
12
13
|
|
|
13
|
-
recursive-exclude cfquant/tests *
|
|
14
14
|
recursive-exclude LTtx/tx/__pycache__ *
|
|
15
15
|
recursive-exclude LTtx/tx/log_data *
|
|
16
16
|
recursive-exclude LTtx/tx/tx_log *
|
|
@@ -30,6 +30,7 @@ recursive-exclude pip_library_dev *
|
|
|
30
30
|
recursive-exclude .cfquant_project_updates *
|
|
31
31
|
recursive-exclude .cfquant_updates *
|
|
32
32
|
recursive-exclude .updates *
|
|
33
|
+
recursive-exclude .cfquant_ops *
|
|
33
34
|
recursive-exclude .pytest_cache *
|
|
34
35
|
recursive-exclude .playwright-cli *
|
|
35
36
|
recursive-exclude .local_archive *
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cfquant
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.22
|
|
4
4
|
Summary: QMT local bridge and xtquant-compatible Python client.
|
|
5
5
|
License: MIT
|
|
6
6
|
Requires-Python: >=3.8
|
|
@@ -9,10 +9,11 @@ License-File: LICENSE
|
|
|
9
9
|
Requires-Dist: pandas>=1.0
|
|
10
10
|
Requires-Dist: packaging>=20
|
|
11
11
|
Requires-Dist: psutil>=5.8
|
|
12
|
+
Requires-Dist: pycryptodome>=3.20
|
|
12
13
|
Requires-Dist: pytz
|
|
13
14
|
Requires-Dist: tabulate
|
|
14
15
|
Requires-Dist: pandas-market-calendars
|
|
15
|
-
Requires-Dist: importlib-resources>=5
|
|
16
|
+
Requires-Dist: importlib-resources>=5
|
|
16
17
|
Provides-Extra: dev
|
|
17
18
|
Requires-Dist: build>=1.0; extra == "dev"
|
|
18
19
|
Requires-Dist: twine>=5.0; extra == "dev"
|
|
@@ -101,11 +102,19 @@ Requires-Dist: pyzmq>=25; extra == "zmq"
|
|
|
101
102
|
新用户和生产环境优先使用源码包部署。原因很简单:cfquant 的 Web 控制台、QMT 入口脚本和本地配置是一起工作的,源码包保留完整项目目录,后续在网页里检查更新、更新 Web、回滚版本、提示 QMT 入口脚本变更都更方便。
|
|
102
103
|
|
|
103
104
|
1. 将项目解压到固定目录,例如 `D:\cfquant`。
|
|
104
|
-
2. 直接双击项目目录中的 `start_cfquant.bat`。启动脚本会使用项目 `.venv`(如果存在)或当前 Python
|
|
105
|
+
2. 直接双击项目目录中的 `start_cfquant.bat`。启动脚本会使用项目 `.venv`(如果存在)或当前 Python,先检查当前环境是否已经安装 `cfquant`;已通过 PyPI 或其他方式安装时直接跳过,缺失时会用等价于 `python -m pip install --editable .` 的参数列表自动安装当前源码版本,不需要用户手动执行安装命令。若 Web 端口上已经运行 cfquant,会直接复用已有实例并打开页面;若端口被其他程序占用,会提示换端口或停止占用进程。
|
|
105
106
|
|
|
106
107
|
自动安装失败时,启动窗口会保持打开,并把安装日志写入 `log\cfquant_startup.log`,修复 Python、网络或权限问题后重新启动即可。
|
|
107
108
|
|
|
108
|
-
|
|
109
|
+
项目默认使用清华 PyPI 镜像安装依赖,适合中国大陆网络环境。启动脚本、网页源码更新、`requirements.txt` 安装以及 LTtx 缺失依赖自动安装都会遵循这个设置。需要切换到企业私有源或其他镜像时,可在启动前设置 `CFQUANT_PIP_INDEX_URL` 环境变量。
|
|
110
|
+
|
|
111
|
+
通过 PyPI 安装后,可以使用下面任一命令启动本地 Web 控制台;`run` 和 `serve` 等价:
|
|
112
|
+
|
|
113
|
+
```powershell
|
|
114
|
+
cfquant run
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
启动后打开 <http://127.0.0.1:8765/>,按网页中的“新手初始化向导”完成账号、模式和 QMT 目录配置。开启“自动导入并管理 QMT 策略”可配置账号、模拟/实盘及 QMT 启动自运行;按绑定页进度完成 QMT 导入和重启,再验证资金、持仓、委托和行情。流程及模式互斥规则见 [Web 账号运行配置说明](docs/Web账号运行配置说明.md)。
|
|
109
118
|
|
|
110
119
|
重点:
|
|
111
120
|
|
|
@@ -118,42 +127,22 @@ Requires-Dist: pyzmq>=25; extra == "zmq"
|
|
|
118
127
|
|
|
119
128
|
### Web 控制台绑定与初始化流程
|
|
120
129
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
4. 关闭代码指引后,页面会进入“重启 QMT 并运行策略”步骤。重启对应的 QMT,在策略列表中运行刚刚保存的策略,然后点击“我已重启并运行,开始检测”。
|
|
127
|
-
5. 系统会持续检测 QMT 通道是否在线。检测过程中不能跳过或直接关闭,可以使用“返回上一步”回到代码指引重新复制;只有“强制关闭本次绑定流程”会结束本次检测,但已经保存的账号绑定不会丢失。
|
|
128
|
-
6. 所有必需通道上线后,页面进入接口测试步骤,并可直接打开“查资金”接口,点击“发送请求”确认 QMT 返回当前账号数据。
|
|
129
|
-
|
|
130
|
-
初始化向导和普通绑定使用同一套复制状态、重启提示和在线检测流程。编辑已有账号时,编辑窗口只显示账号配置,不显示策略源码;修改并保存后,页面会重新打开对应的代码指引。
|
|
130
|
+
1. 在初始化向导或“绑定”页面填写资金账号、账户类型、模式和 QMT 目录,勾选“自动导入并管理 QMT 策略”,确认模拟/实盘与策略自动运行设置。
|
|
131
|
+
2. 保存后系统自动部署核心包、身份配置和托管策略,弹窗显示部署结果及启动提醒,无需复制代码或手工新建策略。
|
|
132
|
+
3. 按提示重启并登录 QMT。如果勾选了“自动启动 QMT”,在启动后的 QMT 中登录即可;QMT 自身已设置自动登录时,等待自动登录完成。**国金证券 QMT 目前不支持自动登录,每次启动后需手动输入密码登录。**
|
|
133
|
+
4. 若提示等待退出,正常退出 QMT,保持 cfquant 运行,等待模型配置完成后再启动。若部署失败,修正目录、权限或模型账号 Key 后重新保存。
|
|
134
|
+
5. “知道了”直接关闭提醒;“检测连接”可进入通道检测,随后查询资金或持仓确认账号数据。
|
|
131
135
|
|
|
132
|
-
|
|
136
|
+
“自动启动 QMT”负责启动客户端;“QMT 启动后自动运行”负责运行托管策略。未勾选策略自动运行时,登录后需在“模型交易”运行已导入的托管策略。编辑已有绑定会保留这些选项,不会自动开启。
|
|
133
137
|
|
|
134
|
-
| 模式 |
|
|
138
|
+
| 模式 | 自动部署目标 | 在线检测要求 |
|
|
135
139
|
|---|---|---|
|
|
136
|
-
| 通用模式 |
|
|
137
|
-
| 极致模式 |
|
|
138
|
-
| 高级模式 |
|
|
139
|
-
|
|
140
|
-
例如极致模式的策略文件通常位于:
|
|
141
|
-
|
|
142
|
-
```text
|
|
143
|
-
D:\中信证券QMT交易终端\python\CFQUANT_LITE.py
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
高级模式必须使用两个不同的 QMT 目录,不能在一个 QMT 中同时加载普通入口和极速交易入口。
|
|
140
|
+
| 通用模式 | 单个 QMT 中的通用托管策略 | 查询通道和交易通道都在线 |
|
|
141
|
+
| 极致模式 | 单个 QMT 中的自包含托管策略 | 查询通道和交易通道都在线 |
|
|
142
|
+
| 高级模式 | 普通端与极速交易端两个不同的 QMT | 两端都在线 |
|
|
143
|
+
| 同账号独立市场 | 对应上海和深圳市场的 QMT | 沪市和深市交易通道都在线 |
|
|
147
144
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
开启同账号独立市场路由后,不能继续使用普通入口文件。页面会根据模式显示上海、深圳两份策略:
|
|
151
|
-
|
|
152
|
-
- 通用模式:`CFQUANT_CTYPE_ALL_LOWLAT_SH.py`、`CFQUANT_CTYPE_ALL_LOWLAT_SZ.py`
|
|
153
|
-
- 极致模式:`CFQUANT_LITE_SH.py`、`CFQUANT_LITE_SZ.py`
|
|
154
|
-
- 高级模式:`CFQUANT_TRADE_LOWLAT_SH.py`、`CFQUANT_TRADE_LOWLAT_SZ.py`
|
|
155
|
-
|
|
156
|
-
上海 QMT 只运行 `_SH.py`,深圳 QMT 只运行 `_SZ.py`。该模式只有沪市和深市两个交易通道都在线后,绑定检测才会通过。完整文件说明见[同账号独立市场说明](qmt_scripts/同账号独立市场/readme.md)。
|
|
145
|
+
多 QMT 部署需分别完成各终端登录,自动启动选项仅启动绑定的主 QMT 目录。同一资金账号在同一个 QMT 中只允许一种模式。完整配置及状态说明见 [Web 账号运行配置说明](docs/Web账号运行配置说明.md)。
|
|
157
146
|
|
|
158
147
|
## Web 控制台
|
|
159
148
|
|
|
@@ -167,16 +156,43 @@ stop_cfquant.bat 停止
|
|
|
167
156
|
restart_cfquant.bat 重启
|
|
168
157
|
```
|
|
169
158
|
|
|
159
|
+
## cftrader 100 单本地基准
|
|
160
|
+
|
|
161
|
+
2026-09-11 使用本地假 QMT 交易桥复测 100 单,5 次预热、30 次采样;该基准不连接 Web、LTtx、PipeHub 或真实 QMT,不产生真实委托,只衡量 SDK 到桥接分发和本地 `passorder` 循环的协议开销。
|
|
162
|
+
|
|
163
|
+
| 路径 | RPC 次数 | 中位耗时 | 平均耗时 |
|
|
164
|
+
|---|---:|---:|---:|
|
|
165
|
+
| 批量同步 `order_stock_batch` | 1 | 4.802 ms | 4.901 ms |
|
|
166
|
+
| 单笔同步循环 `order_stock` x100 | 100 | 9.169 ms | 8.930 ms |
|
|
167
|
+
| 批量异步 `order_stock_batch_async` | 1 | 7.093 ms | 7.122 ms |
|
|
168
|
+
| 单笔异步循环 `order_stock_async` x100 | 100 | 9.053 ms | 9.186 ms |
|
|
169
|
+
|
|
170
|
+
批量接口用于组合调仓、批量止盈止损和撤掉一组未成委托。它的原理是外部 Python 只发一次批量 RPC,Web/LTtx/ctypes 将整批请求路由到 QMT 后,由 QMT 本地连续调用 `passorder` 或 `cancel`,减少逐笔跨进程往返。`cftrader` 目前提供 `order_stock_batch`、`order_stock_batch_async`、`cancel_order_stock_batch` 和 `cancel_order_stock_batch_async`;批量返回只表示请求提交情况,最终成交或撤成仍以委托查询和回调为准。
|
|
171
|
+
|
|
172
|
+
## cftrader 模拟账号实测
|
|
173
|
+
|
|
174
|
+
2026-09-11 02:45 使用模拟信用账号 `900010001595` 通过 Web LTtx 统一路由连接 `acct_4b2b38c167`,对 `600000.SH` 以 8.88 元买入价、每笔 100 股测试。四条路径各提交 100 单,均返回 `submitted=100`;02:48 只读复核该批 400 笔委托状态均为 `54`(已撤),可撤数量为 0。
|
|
175
|
+
|
|
176
|
+
| 路径 | RPC 次数 | 提交耗时 | 单笔均摊 |
|
|
177
|
+
|---|---:|---:|---:|
|
|
178
|
+
| 批量同步 `order_stock_batch` | 1 | 963.252 ms | 9.6325 ms |
|
|
179
|
+
| 单笔同步循环 `order_stock` x100 | 100 | 23250.174 ms | 232.5017 ms |
|
|
180
|
+
| 批量异步 `order_stock_batch_async` | 1 | 52.578 ms | 0.5258 ms |
|
|
181
|
+
| 单笔异步循环 `order_stock_async` x100 | 100 | 2952.912 ms | 29.5291 ms |
|
|
182
|
+
|
|
170
183
|
## 文档
|
|
171
184
|
|
|
172
185
|
| 需求 | 文档 |
|
|
173
186
|
|---|---|
|
|
174
187
|
| QMT 综合部署教程 | [QMT 部署教程](docs/QMT部署教程.md) |
|
|
188
|
+
| cftrader 批量同步/异步下单与撤单 | [cftrader 批量交易与撤单](docs/cftrader批量交易.md),含 100 单本地基准 |
|
|
175
189
|
| 通用模式部署 | [通用模式部署指南](docs/通用模式部署指南.md) |
|
|
176
190
|
| 极致模式部署 | [极致模式部署指南](docs/极致模式部署指南.md) |
|
|
177
191
|
| 高级模式部署 | [高级模式部署指南](docs/高级模式部署指南.md) |
|
|
178
192
|
| 账号和 QMT 目录配置 | [Web 账号运行配置说明](docs/Web账号运行配置说明.md) |
|
|
179
193
|
| 从 miniQMT 迁移 | [miniQMT 迁移到大 QMT 指南](docs/miniQMT迁移到大QMT指南.md) |
|
|
194
|
+
| 官网 nativeApi 接口功能及适配状态 | [xtquant 原版接口适配清单](docs/xtquant原版接口适配清单.md) |
|
|
195
|
+
| Level2 六类行情、订阅回调与千档边界 | [Level2 行情适配说明](docs/Level2行情适配说明.md) |
|
|
180
196
|
| `xtdata` 兼容性 | [xtdata 平替追踪](docs/xtdata平替追踪.md) |
|
|
181
197
|
| `xttrader` 兼容性 | [xttrader 平替追踪](docs/xttrader平替追踪.md) |
|
|
182
198
|
| 接口能力范围 | [QMT 函数封装能力清单](docs/QMT函数封装能力清单.md) |
|
|
@@ -193,7 +209,7 @@ restart_cfquant.bat 重启
|
|
|
193
209
|
|
|
194
210
|
|
|
195
211
|
## 项目交流群
|
|
196
|
-
<img src="
|
|
212
|
+
<img src="631c6525c1a95aaf22ea46aeda3297f7.jpg" alt="cfquant 项目交流群二维码" width="280" />
|
|
197
213
|
|
|
198
214
|
|
|
199
215
|
## 联系作者
|
|
@@ -80,11 +80,19 @@
|
|
|
80
80
|
新用户和生产环境优先使用源码包部署。原因很简单:cfquant 的 Web 控制台、QMT 入口脚本和本地配置是一起工作的,源码包保留完整项目目录,后续在网页里检查更新、更新 Web、回滚版本、提示 QMT 入口脚本变更都更方便。
|
|
81
81
|
|
|
82
82
|
1. 将项目解压到固定目录,例如 `D:\cfquant`。
|
|
83
|
-
2. 直接双击项目目录中的 `start_cfquant.bat`。启动脚本会使用项目 `.venv`(如果存在)或当前 Python
|
|
83
|
+
2. 直接双击项目目录中的 `start_cfquant.bat`。启动脚本会使用项目 `.venv`(如果存在)或当前 Python,先检查当前环境是否已经安装 `cfquant`;已通过 PyPI 或其他方式安装时直接跳过,缺失时会用等价于 `python -m pip install --editable .` 的参数列表自动安装当前源码版本,不需要用户手动执行安装命令。若 Web 端口上已经运行 cfquant,会直接复用已有实例并打开页面;若端口被其他程序占用,会提示换端口或停止占用进程。
|
|
84
84
|
|
|
85
85
|
自动安装失败时,启动窗口会保持打开,并把安装日志写入 `log\cfquant_startup.log`,修复 Python、网络或权限问题后重新启动即可。
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
项目默认使用清华 PyPI 镜像安装依赖,适合中国大陆网络环境。启动脚本、网页源码更新、`requirements.txt` 安装以及 LTtx 缺失依赖自动安装都会遵循这个设置。需要切换到企业私有源或其他镜像时,可在启动前设置 `CFQUANT_PIP_INDEX_URL` 环境变量。
|
|
88
|
+
|
|
89
|
+
通过 PyPI 安装后,可以使用下面任一命令启动本地 Web 控制台;`run` 和 `serve` 等价:
|
|
90
|
+
|
|
91
|
+
```powershell
|
|
92
|
+
cfquant run
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
启动后打开 <http://127.0.0.1:8765/>,按网页中的“新手初始化向导”完成账号、模式和 QMT 目录配置。开启“自动导入并管理 QMT 策略”可配置账号、模拟/实盘及 QMT 启动自运行;按绑定页进度完成 QMT 导入和重启,再验证资金、持仓、委托和行情。流程及模式互斥规则见 [Web 账号运行配置说明](docs/Web账号运行配置说明.md)。
|
|
88
96
|
|
|
89
97
|
重点:
|
|
90
98
|
|
|
@@ -97,42 +105,22 @@
|
|
|
97
105
|
|
|
98
106
|
### Web 控制台绑定与初始化流程
|
|
99
107
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
4. 关闭代码指引后,页面会进入“重启 QMT 并运行策略”步骤。重启对应的 QMT,在策略列表中运行刚刚保存的策略,然后点击“我已重启并运行,开始检测”。
|
|
106
|
-
5. 系统会持续检测 QMT 通道是否在线。检测过程中不能跳过或直接关闭,可以使用“返回上一步”回到代码指引重新复制;只有“强制关闭本次绑定流程”会结束本次检测,但已经保存的账号绑定不会丢失。
|
|
107
|
-
6. 所有必需通道上线后,页面进入接口测试步骤,并可直接打开“查资金”接口,点击“发送请求”确认 QMT 返回当前账号数据。
|
|
108
|
-
|
|
109
|
-
初始化向导和普通绑定使用同一套复制状态、重启提示和在线检测流程。编辑已有账号时,编辑窗口只显示账号配置,不显示策略源码;修改并保存后,页面会重新打开对应的代码指引。
|
|
108
|
+
1. 在初始化向导或“绑定”页面填写资金账号、账户类型、模式和 QMT 目录,勾选“自动导入并管理 QMT 策略”,确认模拟/实盘与策略自动运行设置。
|
|
109
|
+
2. 保存后系统自动部署核心包、身份配置和托管策略,弹窗显示部署结果及启动提醒,无需复制代码或手工新建策略。
|
|
110
|
+
3. 按提示重启并登录 QMT。如果勾选了“自动启动 QMT”,在启动后的 QMT 中登录即可;QMT 自身已设置自动登录时,等待自动登录完成。**国金证券 QMT 目前不支持自动登录,每次启动后需手动输入密码登录。**
|
|
111
|
+
4. 若提示等待退出,正常退出 QMT,保持 cfquant 运行,等待模型配置完成后再启动。若部署失败,修正目录、权限或模型账号 Key 后重新保存。
|
|
112
|
+
5. “知道了”直接关闭提醒;“检测连接”可进入通道检测,随后查询资金或持仓确认账号数据。
|
|
110
113
|
|
|
111
|
-
|
|
114
|
+
“自动启动 QMT”负责启动客户端;“QMT 启动后自动运行”负责运行托管策略。未勾选策略自动运行时,登录后需在“模型交易”运行已导入的托管策略。编辑已有绑定会保留这些选项,不会自动开启。
|
|
112
115
|
|
|
113
|
-
| 模式 |
|
|
116
|
+
| 模式 | 自动部署目标 | 在线检测要求 |
|
|
114
117
|
|---|---|---|
|
|
115
|
-
| 通用模式 |
|
|
116
|
-
| 极致模式 |
|
|
117
|
-
| 高级模式 |
|
|
118
|
-
|
|
119
|
-
例如极致模式的策略文件通常位于:
|
|
120
|
-
|
|
121
|
-
```text
|
|
122
|
-
D:\中信证券QMT交易终端\python\CFQUANT_LITE.py
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
高级模式必须使用两个不同的 QMT 目录,不能在一个 QMT 中同时加载普通入口和极速交易入口。
|
|
118
|
+
| 通用模式 | 单个 QMT 中的通用托管策略 | 查询通道和交易通道都在线 |
|
|
119
|
+
| 极致模式 | 单个 QMT 中的自包含托管策略 | 查询通道和交易通道都在线 |
|
|
120
|
+
| 高级模式 | 普通端与极速交易端两个不同的 QMT | 两端都在线 |
|
|
121
|
+
| 同账号独立市场 | 对应上海和深圳市场的 QMT | 沪市和深市交易通道都在线 |
|
|
126
122
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
开启同账号独立市场路由后,不能继续使用普通入口文件。页面会根据模式显示上海、深圳两份策略:
|
|
130
|
-
|
|
131
|
-
- 通用模式:`CFQUANT_CTYPE_ALL_LOWLAT_SH.py`、`CFQUANT_CTYPE_ALL_LOWLAT_SZ.py`
|
|
132
|
-
- 极致模式:`CFQUANT_LITE_SH.py`、`CFQUANT_LITE_SZ.py`
|
|
133
|
-
- 高级模式:`CFQUANT_TRADE_LOWLAT_SH.py`、`CFQUANT_TRADE_LOWLAT_SZ.py`
|
|
134
|
-
|
|
135
|
-
上海 QMT 只运行 `_SH.py`,深圳 QMT 只运行 `_SZ.py`。该模式只有沪市和深市两个交易通道都在线后,绑定检测才会通过。完整文件说明见[同账号独立市场说明](qmt_scripts/同账号独立市场/readme.md)。
|
|
123
|
+
多 QMT 部署需分别完成各终端登录,自动启动选项仅启动绑定的主 QMT 目录。同一资金账号在同一个 QMT 中只允许一种模式。完整配置及状态说明见 [Web 账号运行配置说明](docs/Web账号运行配置说明.md)。
|
|
136
124
|
|
|
137
125
|
## Web 控制台
|
|
138
126
|
|
|
@@ -146,16 +134,43 @@ stop_cfquant.bat 停止
|
|
|
146
134
|
restart_cfquant.bat 重启
|
|
147
135
|
```
|
|
148
136
|
|
|
137
|
+
## cftrader 100 单本地基准
|
|
138
|
+
|
|
139
|
+
2026-09-11 使用本地假 QMT 交易桥复测 100 单,5 次预热、30 次采样;该基准不连接 Web、LTtx、PipeHub 或真实 QMT,不产生真实委托,只衡量 SDK 到桥接分发和本地 `passorder` 循环的协议开销。
|
|
140
|
+
|
|
141
|
+
| 路径 | RPC 次数 | 中位耗时 | 平均耗时 |
|
|
142
|
+
|---|---:|---:|---:|
|
|
143
|
+
| 批量同步 `order_stock_batch` | 1 | 4.802 ms | 4.901 ms |
|
|
144
|
+
| 单笔同步循环 `order_stock` x100 | 100 | 9.169 ms | 8.930 ms |
|
|
145
|
+
| 批量异步 `order_stock_batch_async` | 1 | 7.093 ms | 7.122 ms |
|
|
146
|
+
| 单笔异步循环 `order_stock_async` x100 | 100 | 9.053 ms | 9.186 ms |
|
|
147
|
+
|
|
148
|
+
批量接口用于组合调仓、批量止盈止损和撤掉一组未成委托。它的原理是外部 Python 只发一次批量 RPC,Web/LTtx/ctypes 将整批请求路由到 QMT 后,由 QMT 本地连续调用 `passorder` 或 `cancel`,减少逐笔跨进程往返。`cftrader` 目前提供 `order_stock_batch`、`order_stock_batch_async`、`cancel_order_stock_batch` 和 `cancel_order_stock_batch_async`;批量返回只表示请求提交情况,最终成交或撤成仍以委托查询和回调为准。
|
|
149
|
+
|
|
150
|
+
## cftrader 模拟账号实测
|
|
151
|
+
|
|
152
|
+
2026-09-11 02:45 使用模拟信用账号 `900010001595` 通过 Web LTtx 统一路由连接 `acct_4b2b38c167`,对 `600000.SH` 以 8.88 元买入价、每笔 100 股测试。四条路径各提交 100 单,均返回 `submitted=100`;02:48 只读复核该批 400 笔委托状态均为 `54`(已撤),可撤数量为 0。
|
|
153
|
+
|
|
154
|
+
| 路径 | RPC 次数 | 提交耗时 | 单笔均摊 |
|
|
155
|
+
|---|---:|---:|---:|
|
|
156
|
+
| 批量同步 `order_stock_batch` | 1 | 963.252 ms | 9.6325 ms |
|
|
157
|
+
| 单笔同步循环 `order_stock` x100 | 100 | 23250.174 ms | 232.5017 ms |
|
|
158
|
+
| 批量异步 `order_stock_batch_async` | 1 | 52.578 ms | 0.5258 ms |
|
|
159
|
+
| 单笔异步循环 `order_stock_async` x100 | 100 | 2952.912 ms | 29.5291 ms |
|
|
160
|
+
|
|
149
161
|
## 文档
|
|
150
162
|
|
|
151
163
|
| 需求 | 文档 |
|
|
152
164
|
|---|---|
|
|
153
165
|
| QMT 综合部署教程 | [QMT 部署教程](docs/QMT部署教程.md) |
|
|
166
|
+
| cftrader 批量同步/异步下单与撤单 | [cftrader 批量交易与撤单](docs/cftrader批量交易.md),含 100 单本地基准 |
|
|
154
167
|
| 通用模式部署 | [通用模式部署指南](docs/通用模式部署指南.md) |
|
|
155
168
|
| 极致模式部署 | [极致模式部署指南](docs/极致模式部署指南.md) |
|
|
156
169
|
| 高级模式部署 | [高级模式部署指南](docs/高级模式部署指南.md) |
|
|
157
170
|
| 账号和 QMT 目录配置 | [Web 账号运行配置说明](docs/Web账号运行配置说明.md) |
|
|
158
171
|
| 从 miniQMT 迁移 | [miniQMT 迁移到大 QMT 指南](docs/miniQMT迁移到大QMT指南.md) |
|
|
172
|
+
| 官网 nativeApi 接口功能及适配状态 | [xtquant 原版接口适配清单](docs/xtquant原版接口适配清单.md) |
|
|
173
|
+
| Level2 六类行情、订阅回调与千档边界 | [Level2 行情适配说明](docs/Level2行情适配说明.md) |
|
|
159
174
|
| `xtdata` 兼容性 | [xtdata 平替追踪](docs/xtdata平替追踪.md) |
|
|
160
175
|
| `xttrader` 兼容性 | [xttrader 平替追踪](docs/xttrader平替追踪.md) |
|
|
161
176
|
| 接口能力范围 | [QMT 函数封装能力清单](docs/QMT函数封装能力清单.md) |
|
|
@@ -172,7 +187,7 @@ restart_cfquant.bat 重启
|
|
|
172
187
|
|
|
173
188
|
|
|
174
189
|
## 项目交流群
|
|
175
|
-
<img src="
|
|
190
|
+
<img src="631c6525c1a95aaf22ea46aeda3297f7.jpg" alt="cfquant 项目交流群二维码" width="280" />
|
|
176
191
|
|
|
177
192
|
|
|
178
193
|
## 联系作者
|
|
@@ -9,14 +9,16 @@ cfquant: 面向 QMT 的 xtquant 兼容层。
|
|
|
9
9
|
from cfquant.xttype import StockAccount
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
|
-
from . import xtconstant, xtdata, xttrader, xttype
|
|
12
|
+
from . import xtconstant, xtdata, xttrader, xttype
|
|
13
|
+
from . import cftrader
|
|
13
14
|
from .client import CfquantError, CfquantTimeout, configure, get_client
|
|
14
15
|
from .version import __version__
|
|
15
16
|
|
|
16
17
|
__all__ = [
|
|
17
18
|
"xtconstant",
|
|
18
19
|
"xtdata",
|
|
19
|
-
"xttrader",
|
|
20
|
+
"xttrader",
|
|
21
|
+
"cftrader",
|
|
20
22
|
"xttype",
|
|
21
23
|
"configure",
|
|
22
24
|
"get_client",
|