cfquant 0.2.40__tar.gz → 0.2.41__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.
Files changed (159) hide show
  1. {cfquant-0.2.40 → cfquant-0.2.41}/PKG-INFO +169 -3
  2. {cfquant-0.2.40 → cfquant-0.2.41}/README.md +319 -153
  3. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/level2.py +19 -0
  4. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/normal_bridge.py +81 -5
  5. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/qmt_bridge.py +79 -8
  6. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/12_/350/256/242/345/215/225/345/244/207/346/263/250/346/265/213/350/257/225.py +1809 -1628
  7. cfquant-0.2.41/cfquant/tests/test_market_data_fallback.py +52 -0
  8. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/test_qmt_strategy_web.py +28 -0
  9. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tx_trade_bridge.py +2449 -2184
  10. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/version.py +2 -2
  11. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant.egg-info/PKG-INFO +169 -3
  12. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant.egg-info/SOURCES.txt +1 -0
  13. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant_web_server.py +46 -0
  14. {cfquant-0.2.40 → cfquant-0.2.41}/pyproject.toml +1 -1
  15. {cfquant-0.2.40 → cfquant-0.2.41}/qmt_scripts/CFQUANT.py +4 -1
  16. {cfquant-0.2.40 → cfquant-0.2.41}/qmt_scripts/CFQUANT_CTYPE_ALL_LOWLAT.py +9 -3
  17. {cfquant-0.2.40 → cfquant-0.2.41}/qmt_scripts/CFQUANT_LITE.py +315 -22
  18. {cfquant-0.2.40 → cfquant-0.2.41}/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 +5 -0
  19. {cfquant-0.2.40 → cfquant-0.2.41}/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 +5 -0
  20. {cfquant-0.2.40 → cfquant-0.2.41}/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 +315 -22
  21. {cfquant-0.2.40 → cfquant-0.2.41}/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 +315 -22
  22. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/app.js +1 -1
  23. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/index.html +2 -2
  24. {cfquant-0.2.40 → cfquant-0.2.41}/LICENSE +0 -0
  25. {cfquant-0.2.40 → cfquant-0.2.41}/LTtx/__init__.py +0 -0
  26. {cfquant-0.2.40 → cfquant-0.2.41}/LTtx/tx/Config.txt +0 -0
  27. {cfquant-0.2.40 → cfquant-0.2.41}/LTtx/tx/LTtx_server.py +0 -0
  28. {cfquant-0.2.40 → cfquant-0.2.41}/LTtx/tx/__init__.py +0 -0
  29. {cfquant-0.2.40 → cfquant-0.2.41}/LTtx/tx/tx.py +0 -0
  30. {cfquant-0.2.40 → cfquant-0.2.41}/MANIFEST.in +0 -0
  31. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/__init__.py +0 -0
  32. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/_editable_install.py +0 -0
  33. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/account_routing.py +0 -0
  34. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/batch_orders.py +0 -0
  35. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/build_info.py +0 -0
  36. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/callback_dispatcher.py +0 -0
  37. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/cftrader.py +0 -0
  38. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/channels.py +0 -0
  39. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/cli.py +0 -0
  40. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/client.py +0 -0
  41. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/config.py +0 -0
  42. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/hub.py +0 -0
  43. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/log_management.py +0 -0
  44. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/logging_i18n.py +0 -0
  45. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/order_meta.py +0 -0
  46. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/pipe_bridge.py +0 -0
  47. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/pipe_client.py +0 -0
  48. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/pipe_hub.py +0 -0
  49. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/pipe_transport.py +0 -0
  50. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/protocol.py +0 -0
  51. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/qmt_strategy_deploy.py +0 -0
  52. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/qmt_strategy_package.py +0 -0
  53. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/qmt_strategy_runtime.py +0 -0
  54. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/runtime_report.py +0 -0
  55. {cfquant-0.2.40 → cfquant-0.2.41}/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" +0 -0
  56. {cfquant-0.2.40 → cfquant-0.2.41}/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" +0 -0
  57. {cfquant-0.2.40 → cfquant-0.2.41}/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" +0 -0
  58. {cfquant-0.2.40 → cfquant-0.2.41}/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" +0 -0
  59. {cfquant-0.2.40 → cfquant-0.2.41}/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" +0 -0
  60. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/16_/345/220/257/345/212/250/345/256/211/350/243/205/346/265/213/350/257/225.py" +0 -0
  61. {cfquant-0.2.40 → cfquant-0.2.41}/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" +0 -0
  62. {cfquant-0.2.40 → cfquant-0.2.41}/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" +0 -0
  63. {cfquant-0.2.40 → cfquant-0.2.41}/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" +0 -0
  64. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/1_/350/241/214/346/203/205/346/216/245/346/224/266/346/265/213/350/257/225.py" +0 -0
  65. {cfquant-0.2.40 → cfquant-0.2.41}/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" +0 -0
  66. {cfquant-0.2.40 → cfquant-0.2.41}/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" +0 -0
  67. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/22_/350/277/236/346/216/245/350/257/212/346/226/255/346/265/213/350/257/225.py" +0 -0
  68. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/23_/347/244/272/344/276/213/351/205/215/347/275/256/346/265/213/350/257/225.py" +0 -0
  69. {cfquant-0.2.40 → cfquant-0.2.41}/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" +0 -0
  70. {cfquant-0.2.40 → cfquant-0.2.41}/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" +0 -0
  71. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/26_/345/205/250/346/216/250/350/256/242/351/230/205/346/265/213/350/257/225.py" +0 -0
  72. {cfquant-0.2.40 → cfquant-0.2.41}/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" +0 -0
  73. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/28_Level2/346/216/245/345/217/243/351/200/202/351/205/215/346/265/213/350/257/225.py" +0 -0
  74. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/29_Level2/350/241/214/346/203/205/346/265/213/350/257/225.py" +0 -0
  75. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/2_/346/225/260/346/215/256/350/216/267/345/217/226/346/265/213/350/257/225.py" +0 -0
  76. {cfquant-0.2.40 → cfquant-0.2.41}/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" +0 -0
  77. {cfquant-0.2.40 → cfquant-0.2.41}/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" +0 -0
  78. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/32_/345/274/202/346/255/245/344/270/213/345/215/225/346/265/213/350/257/225.py" +0 -0
  79. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/33_/345/220/214/346/255/245/344/270/213/345/215/225/345/233/236/350/260/203/346/265/213/350/257/225.py" +0 -0
  80. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/3_/346/225/260/346/215/256/344/270/213/350/275/275/346/265/213/350/257/225.py" +0 -0
  81. {cfquant-0.2.40 → cfquant-0.2.41}/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" +0 -0
  82. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/5_/347/234/237/345/256/236/344/270/213/345/215/225/346/265/213/350/257/225.py" +0 -0
  83. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/6_/345/233/236/350/260/203/346/265/213/350/257/225.py" +0 -0
  84. {cfquant-0.2.40 → cfquant-0.2.41}/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" +0 -0
  85. {cfquant-0.2.40 → cfquant-0.2.41}/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" +0 -0
  86. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/9_/345/217/257/346/222/244/350/256/242/345/215/225/346/265/213/350/257/225.py" +0 -0
  87. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/_helpers.py +0 -0
  88. {cfquant-0.2.40 → cfquant-0.2.41}/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" +0 -0
  89. {cfquant-0.2.40 → cfquant-0.2.41}/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_20260921_175732.md" +0 -0
  90. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/readme.md +0 -0
  91. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/test_api_tester_browser.py +0 -0
  92. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/test_api_tester_web.py +0 -0
  93. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/test_binding_delete_confirmation.py +0 -0
  94. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/test_callback_requests.py +0 -0
  95. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/test_cftrader.py +0 -0
  96. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/test_cftrader_tutorial.py +0 -0
  97. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/test_cftrader_web.py +0 -0
  98. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/test_credit_compat.py +0 -0
  99. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/test_json_serialization.py +0 -0
  100. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/test_log_management.py +0 -0
  101. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/test_management_batch.py +0 -0
  102. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/test_order_time_callback.py +0 -0
  103. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/test_project_updater.py +0 -0
  104. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/test_python_api_reference.py +0 -0
  105. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/test_qmt_strategy_browser.py +0 -0
  106. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/test_qmt_strategy_deploy.py +0 -0
  107. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/test_tutorial_reader.py +0 -0
  108. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tests/test_tx_auto_import.py +0 -0
  109. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/tx.py +0 -0
  110. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/xtconstant.py +0 -0
  111. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/xtdata.py +0 -0
  112. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/xttrader.py +0 -0
  113. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant/xttype.py +0 -0
  114. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant.egg-info/dependency_links.txt +0 -0
  115. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant.egg-info/entry_points.txt +0 -0
  116. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant.egg-info/requires.txt +0 -0
  117. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant.egg-info/top_level.txt +0 -0
  118. {cfquant-0.2.40 → cfquant-0.2.41}/cfquant_pipe_hub.py +0 -0
  119. {cfquant-0.2.40 → cfquant-0.2.41}/qmt_scripts/CFQUANT_TRADE_LOWLAT.py +0 -0
  120. {cfquant-0.2.40 → cfquant-0.2.41}/qmt_scripts/__init__.py +0 -0
  121. {cfquant-0.2.40 → cfquant-0.2.41}/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
  122. {cfquant-0.2.40 → cfquant-0.2.41}/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
  123. {cfquant-0.2.40 → cfquant-0.2.41}/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" +0 -0
  124. {cfquant-0.2.40 → cfquant-0.2.41}/requirements.txt +0 -0
  125. {cfquant-0.2.40 → cfquant-0.2.41}/setup.cfg +0 -0
  126. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/__init__.py +0 -0
  127. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/api-tester.js +0 -0
  128. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/avatars/amber-pulse.svg +0 -0
  129. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/avatars/copper-grid.svg +0 -0
  130. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/avatars/market-blue.svg +0 -0
  131. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/avatars/rose-circuit.svg +0 -0
  132. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/avatars/signal-green.svg +0 -0
  133. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/avatars/slate-wave.svg +0 -0
  134. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/avatars/teal-orbit.svg +0 -0
  135. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/avatars/violet-node.svg +0 -0
  136. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/cftrader-api-data.js +0 -0
  137. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/favicon.svg +0 -0
  138. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/image/qmt_deploy/image-10.png +0 -0
  139. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/image/qmt_deploy/image-11.png +0 -0
  140. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/image/qmt_deploy/image-12.png +0 -0
  141. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/image/qmt_deploy/image-13.png +0 -0
  142. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/image/qmt_deploy/image-14.png +0 -0
  143. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/image/qmt_deploy/image-15.png +0 -0
  144. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/image/qmt_deploy/image-16.png +0 -0
  145. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/image/qmt_deploy/image-17.png +0 -0
  146. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/image/qmt_deploy/image-18.png +0 -0
  147. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/image/qmt_deploy/image-19.png +0 -0
  148. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/image/qmt_deploy/image-20.png +0 -0
  149. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/image/qmt_deploy/image-21.png +0 -0
  150. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/image/qmt_deploy/image-4.png +0 -0
  151. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/image/qmt_deploy/image-5.png +0 -0
  152. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/image/qmt_deploy/image-6.png +0 -0
  153. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/image/qmt_deploy/image-7.png +0 -0
  154. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/image/qmt_deploy/image-8.png +0 -0
  155. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/image/qmt_deploy/image-9.png +0 -0
  156. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/python-api-data.js +0 -0
  157. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/python-api.js +0 -0
  158. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/styles.css +0 -0
  159. {cfquant-0.2.40 → cfquant-0.2.41}/web_dashboard/vendor/mermaid.min.js +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cfquant
3
- Version: 0.2.40
3
+ Version: 0.2.41
4
4
  Summary: QMT local bridge and xtquant-compatible Python client.
5
5
  License: MIT
6
6
  Requires-Python: >=3.8
@@ -69,6 +69,46 @@ Requires-Dist: pyzmq>=25; extra == "zmq"
69
69
  - 版本更新日志:[docs/版本日志.md](docs/版本日志.md)
70
70
  - 完整部署、模式选择和接口说明见下方“文档”目录
71
71
 
72
+ ## 新用户先看这里
73
+
74
+ 如果你第一次使用 cfquant,只需要先完成下面这条路径:
75
+
76
+ 1. 安装 Python 3.8–3.12,生产环境建议 Python 3.10 或 3.12;使用 Anaconda/Miniconda 时,先确定实际运行策略的环境名称。
77
+ 2. 按下方“安装方式”选择源码包或 PyPI。第一次部署、需要 Web 更新和 QMT 脚本管理时,优先选择源码包。
78
+ 3. 启动 `start_cfquant.bat`,或在已安装包的环境中执行 `cfquant run`。
79
+ 4. 打开 <http://127.0.0.1:8765/>,按初始化向导填写 QMT 目录、账号和运行模式。
80
+ 5. 在绑定页导入并运行 QMT 入口策略,等待页面显示通道在线。
81
+ 6. 先用“接口测试”验证行情、资金和持仓,再接入自己的策略。
82
+
83
+ ### 我应该选择哪种方式?
84
+
85
+ | 你的情况 | 推荐做法 |
86
+ |---|---|
87
+ | 第一次部署,希望系统自动管理 Web、QMT 脚本和更新 | 源码包 + 通用模式 |
88
+ | 已有 Python 项目,只需要调用 `xtdata` / `xttrader` | PyPI 安装 |
89
+ | 使用 Anaconda/Miniconda | 激活目标环境后执行 `python -m pip` 安装 |
90
+ | QMT 无法导入 `cfquant` 或受 Python 包白名单限制 | 极致模式 |
91
+ | 需要拆分行情与低延迟交易链路 | 高级模式,准备两个 QMT 环境 |
92
+
93
+ ### 这几个 Python 环境分别做什么?
94
+
95
+ 外部 Python 用来运行 Web 控制台、`cfquant` SDK 和你的外部策略;QMT 内部 Python 用来运行导入 QMT 的入口策略。两者可以不是同一个解释器,但 Web 配置中的 Python 路径、外部策略使用的 Python、以及你执行 `python -m pip install` 的 Python 必须对应清楚。遇到 `ModuleNotFoundError` 时,优先用同一个解释器执行:
96
+
97
+ ```powershell
98
+ python -c "import sys; print(sys.executable)"
99
+ python -m pip show cfquant
100
+ ```
101
+
102
+ ### 怎样判断部署完成?
103
+
104
+ 以下条件同时满足,才算完成基础部署:
105
+
106
+ - 浏览器可以打开 `http://127.0.0.1:8765/`。
107
+ - Web 页面状态中的 Web、LTtx 和需要的 PipeHub 通道在线。
108
+ - QMT 已登录,绑定页显示入口策略运行中。
109
+ - 接口测试可以返回至少一只证券的行情,以及资金或持仓查询结果。
110
+ - 外部 Python 能够导入 `cfquant`,并且使用的解释器路径与安装包的解释器一致。
111
+
72
112
  ## 快速开始
73
113
 
74
114
  ### 环境要求
@@ -104,16 +144,62 @@ Requires-Dist: pyzmq>=25; extra == "zmq"
104
144
  1. 将项目解压到固定目录,例如 `D:\cfquant`。
105
145
  2. 直接双击项目目录中的 `start_cfquant.bat`。启动脚本会使用项目 `.venv`(如果存在)或当前 Python,先检查当前环境是否已经安装 `cfquant`;已通过 PyPI 或其他方式安装时直接跳过,缺失时会用等价于 `python -m pip install --editable .` 的参数列表自动安装当前源码版本,不需要用户手动执行安装命令。若 Web 端口上已经运行 cfquant,会直接复用已有实例并打开页面;若端口被其他程序占用,会提示换端口或停止占用进程。
106
146
 
147
+ 首次启动时,Web 配置中可能还没有保存 Python 解释器。此时不需要先手工填写配置:`start_cfquant.bat` 会先寻找项目 `.venv`、`CFQUANT_PYTHON_EXE`、当前或常见 Conda 安装目录,以及 `%USERPROFILE%\.conda\environments.txt` 中登记的环境,找到后用该解释器启动 Web 控制台。
148
+
149
+ 如果 Anaconda/Miniconda 没有加入系统 PATH,首次启动仍可以自动识别常见安装位置。自动识别不到时,可以在启动前指定实际环境的 Python:
150
+
151
+ ```bat
152
+ set CFQUANT_PYTHON_EXE=C:\Users\用户名\anaconda3\envs\quant\python.exe
153
+ start_cfquant.bat
154
+ ```
155
+
156
+ Web 控制台启动后,请在初始化配置中确认或修改 Python 解释器路径。后续启动会优先使用已保存的路径;启动选择结果和失败原因记录在 `log\cfquant_startup.log`。
157
+
107
158
  自动安装失败时,启动窗口会保持打开,并把安装日志写入 `log\cfquant_startup.log`,修复 Python、网络或权限问题后重新启动即可。
108
159
 
109
160
  项目默认使用清华 PyPI 镜像安装依赖,适合中国大陆网络环境。启动脚本、网页源码更新、`requirements.txt` 安装以及 LTtx 缺失依赖自动安装都会遵循这个设置。需要切换到企业私有源或其他镜像时,可在启动前设置 `CFQUANT_PIP_INDEX_URL` 环境变量。
110
161
 
111
- 通过 PyPI 安装后,可以使用下面任一命令启动本地 Web 控制台;`run` 和 `serve` 等价:
162
+ #### 方式二:PyPI 安装(适合外部 Python 或不需要源码更新的环境)
163
+
164
+ PyPI 安装只负责安装 `cfquant` Python 包及其依赖,不会自动把 QMT 入口策略导入 QMT,也不会创建源码包中的 `start_cfquant.bat`。建议在目标 Python 环境中使用 `python -m pip`,避免把包装到另一个解释器:
165
+
166
+ ```powershell
167
+ python -m pip install --upgrade cfquant
168
+ # 需要 ZMQ 能力时:
169
+ python -m pip install --upgrade "cfquant[zmq]"
170
+ ```
171
+
172
+ 安装完成后,可以直接启动 Web 控制台:
173
+
174
+ ```powershell
175
+ cfquant run
176
+ ```
177
+
178
+ 也可以使用 `cfquant serve` 或 `cfquant-web`;三者启动的是同一个本地 Web 服务。首次启动后访问 <http://127.0.0.1:8765/>,在初始化向导中配置 QMT 目录、账号和运行模式。需要 QMT 入口脚本时,使用已安装包导出到 QMT 策略目录:
179
+
180
+ ```powershell
181
+ cfquant qmt-scripts --output D:\QMT\cfquant
182
+ ```
183
+
184
+ #### 方式三:Conda / Anaconda 环境
185
+
186
+ Conda 环境可以直接安装 PyPI 包。请先激活实际运行策略的环境,再执行安装和启动命令:
112
187
 
113
188
  ```powershell
189
+ conda activate quant
190
+ python -m pip install --upgrade cfquant
114
191
  cfquant run
115
192
  ```
116
193
 
194
+ 如果使用源码包,直接运行项目目录中的 `start_cfquant.bat`。即使 Conda 没有加入系统 PATH,启动脚本也会探测常见 Conda 目录;无法探测时可设置 `CFQUANT_PYTHON_EXE` 指向该环境的 `python.exe`。Web 初始化后请保存同一个解释器路径,避免 Web、外部策略和 QMT 使用不同环境。
195
+
196
+ #### 选择建议
197
+
198
+ - 需要 Web 控制台、QMT 入口脚本、网页更新和回滚:使用**源码包部署**。
199
+ - 只需要在已有 Python 项目中调用 `cfquant.xtdata` 或 `cfquant.xttrader`:使用 **PyPI 安装**。
200
+ - 使用 Anaconda/Miniconda:优先在目标 Conda 环境中执行 `python -m pip install`,不要使用未激活环境的裸 `pip`。
201
+ - 源码包和 PyPI 包不要在同一个解释器中反复混用;源码开发时使用 `python -m pip install --editable .`,正式使用时使用 PyPI 版本。
202
+
117
203
  启动后打开 <http://127.0.0.1:8765/>,按网页中的“新手初始化向导”完成账号、模式和 QMT 目录配置。开启“自动导入并管理 QMT 策略”可配置账号、模拟/实盘及 QMT 启动自运行;按绑定页进度完成 QMT 导入和重启,再验证资金、持仓、委托和行情。流程及模式互斥规则见 [Web 账号运行配置说明](docs/Web账号运行配置说明.md)。
118
204
 
119
205
  重点:
@@ -135,6 +221,8 @@ cfquant run
135
221
 
136
222
  “自动启动 QMT”负责启动客户端;“QMT 启动后自动运行”负责运行托管策略。未勾选策略自动运行时,登录后需在“模型交易”运行已导入的托管策略。编辑已有绑定会保留这些选项,不会自动开启。
137
223
 
224
+ cfquant Web 每次启动时都会读取已保存的绑定:只要账号处于启用状态并勾选了“自动启动 QMT”,就会检查对应 QMT 是否已经运行;未运行时自动拉起对应的 `XtItClient.exe`,已经运行的实例不会重复启动。首次登录、密码输入和 QMT 内的策略运行仍按页面提示完成。
225
+
138
226
  | 模式 | 自动部署目标 | 在线检测要求 |
139
227
  |---|---|---|
140
228
  | 通用模式 | 单个 QMT 中的通用托管策略 | 查询通道和交易通道都在线 |
@@ -144,6 +232,80 @@ cfquant run
144
232
 
145
233
  多 QMT 部署需分别完成各终端登录,自动启动选项仅启动绑定的主 QMT 目录。同一资金账号在同一个 QMT 中只允许一种模式。完整配置及状态说明见 [Web 账号运行配置说明](docs/Web账号运行配置说明.md)。
146
234
 
235
+ ## 常见问题先查哪里
236
+
237
+ | 现象 | 优先检查 |
238
+ |---|---|
239
+ | 双击启动窗口后立即退出 | 查看 `log\cfquant_startup.log`;确认 Python 路径存在,或设置 `CFQUANT_PYTHON_EXE`。 |
240
+ | 页面打不开 | 查看最新的 `log\cfquant_web_server.*.stderr.log`;确认 8765 端口没有被其他程序占用。 |
241
+ | 页面在线但 QMT 不在线 | 确认 QMT 已登录、QMT 目录正确,并按绑定页提示重新导入或启动入口策略。 |
242
+ | `ModuleNotFoundError: cfquant` | 在运行策略的同一个解释器中执行 `python -m pip install --upgrade cfquant`,再用 `python -c "import cfquant; print(cfquant.__file__)"` 验证。 |
243
+ | 行情为空 | 先用页面接口测试确认证券代码、周期和行情权限;标准行情异常时可对照 `xtdata.get_market_data_ex`。 |
244
+ | 不确定应该使用哪种模式 | 先选通用模式;极致模式用于 QMT 导入受限的情况,高级模式需要额外准备两个 QMT 环境。 |
245
+
246
+ 完整日志位于项目的 `log` 目录。提交问题时,请附上启动日志、页面状态和使用的 Python 版本,删除账号、密码、Token、订单和持仓等敏感信息后再提交。
247
+
248
+ ## 从 `xtquant` 迁移到 `cfquant`
249
+
250
+ 安装和初始化完成后,通常不需要重写原有策略。先把外部策略中指向 `xtquant` 的导入改成 `cfquant` 对应模块,再按下面的顺序验证。cfquant 负责外部 Python 与 QMT 之间的桥接,QMT 仍然需要登录并运行 Web 绑定页部署的入口策略。
251
+
252
+ ### 最小改动
253
+
254
+ ```python
255
+ # 原来的写法
256
+ from xtquant import xtdata, xtconstant
257
+ from xtquant.xttrader import XtQuantTrader
258
+ from xtquant.xttype import StockAccount
259
+
260
+ # 替换为 cfquant
261
+ from cfquant import xtdata, xtconstant
262
+ from cfquant.xttrader import XtQuantTrader
263
+ from cfquant.xttype import StockAccount
264
+ ```
265
+
266
+ 默认路由是 `auto`,外部策略通常不需要手工选择 Pipe、LTtx 或高级模式。需要固定传输方式时,再使用 `cfquant.configure(...)`;具体路由说明见 [外部 Python 接入](docs/外部Python接入.md)。
267
+
268
+ ### 先验证行情
269
+
270
+ ```python
271
+ from cfquant import xtdata
272
+
273
+ data = xtdata.get_market_data_ex(
274
+ field_list=["open", "close", "volume"],
275
+ stock_list=["000001.SZ"],
276
+ period="1d",
277
+ count=5,
278
+ )
279
+ print(data)
280
+ ```
281
+
282
+ `get_market_data_ex` 返回按证券代码组织的结果,适合先确认本地行情、证券代码和 QMT 行情权限。原有代码使用 `get_market_data` 时可以继续使用;如果某个 QMT 版本对标准接口返回空结果,cfquant 会尝试用扩展接口读取并转换结果。
283
+
284
+ ### 再验证交易连接
285
+
286
+ ```python
287
+ from cfquant.xttrader import XtQuantTrader
288
+ from cfquant.xttype import StockAccount
289
+
290
+ account = StockAccount("YOUR_ACCOUNT_ID", "STOCK")
291
+ trader = XtQuantTrader("", account=account)
292
+
293
+ if trader.connect() != 0:
294
+ raise RuntimeError(trader.last_connect_error or "cfquant connect failed")
295
+
296
+ print(trader.query_stock_asset(account))
297
+ print(trader.query_stock_positions(account))
298
+ trader.disconnect()
299
+ ```
300
+
301
+ 先完成行情、资金和持仓查询,再在模拟账号中验证委托和撤单。不要把第一次验证直接放在实盘账号上。
302
+
303
+ ### 回调和接口差异
304
+
305
+ `XtQuantTrader`、`StockAccount`、常用行情查询和交易方法保持接近 `xtquant` 的调用方式,原有回调类通常可以继续使用。仍有部分 QMT 专有接口、字段和返回结构存在兼容边界,使用前请查看 [xtquant 原版接口适配清单](docs/xtquant原版接口适配清单.md) 和 [QMT 函数封装能力清单](docs/QMT函数封装能力清单.md)。
306
+
307
+ 推荐迁移顺序:**行情查询 → 资金/持仓 → 回调 → 模拟委托 → 模拟撤单 → 正式策略**。每一步都先在 Web 控制台接口测试和日志中确认,再进入下一步。
308
+
147
309
  ## Web 控制台
148
310
 
149
311
  Web 控制台提供账号绑定、资金和持仓查询、委托和成交查询、下单和撤单、行情订阅、接口调试、部署指引以及版本更新管理。
@@ -156,7 +318,11 @@ stop_cfquant.bat 停止
156
318
  restart_cfquant.bat 重启
157
319
  ```
158
320
 
159
- ## cftrader 100 单本地基准
321
+ ## 性能参考(进阶)
322
+
323
+ 下面的测试用于帮助有性能需求的用户理解批量接口和不同链路的开销,不是安装或迁移成功的判断标准。
324
+
325
+ ### cftrader 100 单本地基准
160
326
 
161
327
  2026-09-11 使用本地假 QMT 交易桥复测 100 单,5 次预热、30 次采样;该基准不连接 Web、LTtx、PipeHub 或真实 QMT,不产生真实委托,只衡量 SDK 到桥接分发和本地 `passorder` 循环的协议开销。
162
328