cfquant 0.2.41__tar.gz → 0.2.43__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 (164) hide show
  1. {cfquant-0.2.41 → cfquant-0.2.43}/PKG-INFO +1 -1
  2. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/account_routing.py +20 -19
  3. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/batch_orders.py +7 -4
  4. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/normal_bridge.py +527 -394
  5. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/order_meta.py +2 -1
  6. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/pipe_bridge.py +1 -0
  7. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/qmt_bridge.py +774 -766
  8. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/qmt_strategy_deploy.py +13 -7
  9. cfquant-0.2.43/cfquant/stock_connect.py +80 -0
  10. {cfquant-0.2.41 → cfquant-0.2.43}/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 +23 -6
  11. {cfquant-0.2.41 → cfquant-0.2.43}/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 +1 -1
  12. {cfquant-0.2.41 → cfquant-0.2.43}/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 +28 -0
  13. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/2_/346/225/260/346/215/256/350/216/267/345/217/226/346/265/213/350/257/225.py +4 -5
  14. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/readme.md +1 -1
  15. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/test_cftrader.py +2 -1
  16. cfquant-0.2.43/cfquant/tests/test_stock_connect.py +250 -0
  17. cfquant-0.2.43/cfquant/tests/test_stock_connect_browser.py +24 -0
  18. cfquant-0.2.43/cfquant/tests/test_trading_dates.py +93 -0
  19. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tx_trade_bridge.py +221 -114
  20. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/version.py +2 -2
  21. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/xtconstant.py +131 -128
  22. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/xtdata.py +44 -15
  23. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/xttrader.py +91 -83
  24. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/xttype.py +418 -401
  25. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant.egg-info/PKG-INFO +1 -1
  26. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant.egg-info/SOURCES.txt +5 -0
  27. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant_web_server.py +7756 -7683
  28. {cfquant-0.2.41 → cfquant-0.2.43}/pyproject.toml +1 -1
  29. {cfquant-0.2.41 → cfquant-0.2.43}/qmt_scripts/CFQUANT.py +5 -4
  30. {cfquant-0.2.41 → cfquant-0.2.43}/qmt_scripts/CFQUANT_LITE.py +153 -10
  31. {cfquant-0.2.41 → cfquant-0.2.43}/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 +153 -10
  32. {cfquant-0.2.41 → cfquant-0.2.43}/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 +153 -10
  33. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/api-tester.js +9 -1
  34. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/app.js +28 -4
  35. cfquant-0.2.43/web_dashboard/docs.js +48 -0
  36. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/index.html +16 -4
  37. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/python-api-data.js +11 -11
  38. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/styles.css +30 -1
  39. {cfquant-0.2.41 → cfquant-0.2.43}/LICENSE +0 -0
  40. {cfquant-0.2.41 → cfquant-0.2.43}/LTtx/__init__.py +0 -0
  41. {cfquant-0.2.41 → cfquant-0.2.43}/LTtx/tx/Config.txt +0 -0
  42. {cfquant-0.2.41 → cfquant-0.2.43}/LTtx/tx/LTtx_server.py +0 -0
  43. {cfquant-0.2.41 → cfquant-0.2.43}/LTtx/tx/__init__.py +0 -0
  44. {cfquant-0.2.41 → cfquant-0.2.43}/LTtx/tx/tx.py +0 -0
  45. {cfquant-0.2.41 → cfquant-0.2.43}/MANIFEST.in +0 -0
  46. {cfquant-0.2.41 → cfquant-0.2.43}/README.md +0 -0
  47. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/__init__.py +0 -0
  48. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/_editable_install.py +0 -0
  49. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/build_info.py +0 -0
  50. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/callback_dispatcher.py +0 -0
  51. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/cftrader.py +0 -0
  52. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/channels.py +0 -0
  53. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/cli.py +0 -0
  54. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/client.py +0 -0
  55. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/config.py +0 -0
  56. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/hub.py +0 -0
  57. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/level2.py +0 -0
  58. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/log_management.py +0 -0
  59. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/logging_i18n.py +0 -0
  60. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/pipe_client.py +0 -0
  61. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/pipe_hub.py +0 -0
  62. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/pipe_transport.py +0 -0
  63. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/protocol.py +0 -0
  64. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/qmt_strategy_package.py +0 -0
  65. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/qmt_strategy_runtime.py +0 -0
  66. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/runtime_report.py +0 -0
  67. {cfquant-0.2.41 → cfquant-0.2.43}/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
  68. {cfquant-0.2.41 → cfquant-0.2.43}/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
  69. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/12_/350/256/242/345/215/225/345/244/207/346/263/250/346/265/213/350/257/225.py" +0 -0
  70. {cfquant-0.2.41 → cfquant-0.2.43}/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
  71. {cfquant-0.2.41 → cfquant-0.2.43}/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
  72. {cfquant-0.2.41 → cfquant-0.2.43}/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
  73. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/16_/345/220/257/345/212/250/345/256/211/350/243/205/346/265/213/350/257/225.py" +0 -0
  74. {cfquant-0.2.41 → cfquant-0.2.43}/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
  75. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/1_/350/241/214/346/203/205/346/216/245/346/224/266/346/265/213/350/257/225.py" +0 -0
  76. {cfquant-0.2.41 → cfquant-0.2.43}/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
  77. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/22_/350/277/236/346/216/245/350/257/212/346/226/255/346/265/213/350/257/225.py" +0 -0
  78. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/23_/347/244/272/344/276/213/351/205/215/347/275/256/346/265/213/350/257/225.py" +0 -0
  79. {cfquant-0.2.41 → cfquant-0.2.43}/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
  80. {cfquant-0.2.41 → cfquant-0.2.43}/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
  81. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/26_/345/205/250/346/216/250/350/256/242/351/230/205/346/265/213/350/257/225.py" +0 -0
  82. {cfquant-0.2.41 → cfquant-0.2.43}/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
  83. {cfquant-0.2.41 → cfquant-0.2.43}/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
  84. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/29_Level2/350/241/214/346/203/205/346/265/213/350/257/225.py" +0 -0
  85. {cfquant-0.2.41 → cfquant-0.2.43}/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
  86. {cfquant-0.2.41 → cfquant-0.2.43}/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
  87. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/32_/345/274/202/346/255/245/344/270/213/345/215/225/346/265/213/350/257/225.py" +0 -0
  88. {cfquant-0.2.41 → cfquant-0.2.43}/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
  89. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/3_/346/225/260/346/215/256/344/270/213/350/275/275/346/265/213/350/257/225.py" +0 -0
  90. {cfquant-0.2.41 → cfquant-0.2.43}/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
  91. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/5_/347/234/237/345/256/236/344/270/213/345/215/225/346/265/213/350/257/225.py" +0 -0
  92. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/6_/345/233/236/350/260/203/346/265/213/350/257/225.py" +0 -0
  93. {cfquant-0.2.41 → cfquant-0.2.43}/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
  94. {cfquant-0.2.41 → cfquant-0.2.43}/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
  95. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/9_/345/217/257/346/222/244/350/256/242/345/215/225/346/265/213/350/257/225.py" +0 -0
  96. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/_helpers.py +0 -0
  97. {cfquant-0.2.41 → cfquant-0.2.43}/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
  98. {cfquant-0.2.41 → cfquant-0.2.43}/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
  99. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/test_api_tester_browser.py +0 -0
  100. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/test_api_tester_web.py +0 -0
  101. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/test_binding_delete_confirmation.py +0 -0
  102. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/test_callback_requests.py +0 -0
  103. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/test_cftrader_tutorial.py +0 -0
  104. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/test_cftrader_web.py +0 -0
  105. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/test_credit_compat.py +0 -0
  106. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/test_json_serialization.py +0 -0
  107. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/test_log_management.py +0 -0
  108. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/test_management_batch.py +0 -0
  109. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/test_market_data_fallback.py +0 -0
  110. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/test_order_time_callback.py +0 -0
  111. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/test_project_updater.py +0 -0
  112. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/test_python_api_reference.py +0 -0
  113. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/test_qmt_strategy_browser.py +0 -0
  114. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/test_qmt_strategy_deploy.py +0 -0
  115. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/test_qmt_strategy_web.py +0 -0
  116. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/test_tutorial_reader.py +0 -0
  117. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tests/test_tx_auto_import.py +0 -0
  118. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant/tx.py +0 -0
  119. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant.egg-info/dependency_links.txt +0 -0
  120. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant.egg-info/entry_points.txt +0 -0
  121. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant.egg-info/requires.txt +0 -0
  122. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant.egg-info/top_level.txt +0 -0
  123. {cfquant-0.2.41 → cfquant-0.2.43}/cfquant_pipe_hub.py +0 -0
  124. {cfquant-0.2.41 → cfquant-0.2.43}/qmt_scripts/CFQUANT_CTYPE_ALL_LOWLAT.py +0 -0
  125. {cfquant-0.2.41 → cfquant-0.2.43}/qmt_scripts/CFQUANT_TRADE_LOWLAT.py +0 -0
  126. {cfquant-0.2.41 → cfquant-0.2.43}/qmt_scripts/__init__.py +0 -0
  127. {cfquant-0.2.41 → cfquant-0.2.43}/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" +0 -0
  128. {cfquant-0.2.41 → cfquant-0.2.43}/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" +0 -0
  129. {cfquant-0.2.41 → cfquant-0.2.43}/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
  130. {cfquant-0.2.41 → cfquant-0.2.43}/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
  131. {cfquant-0.2.41 → cfquant-0.2.43}/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
  132. {cfquant-0.2.41 → cfquant-0.2.43}/requirements.txt +0 -0
  133. {cfquant-0.2.41 → cfquant-0.2.43}/setup.cfg +0 -0
  134. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/__init__.py +0 -0
  135. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/avatars/amber-pulse.svg +0 -0
  136. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/avatars/copper-grid.svg +0 -0
  137. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/avatars/market-blue.svg +0 -0
  138. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/avatars/rose-circuit.svg +0 -0
  139. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/avatars/signal-green.svg +0 -0
  140. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/avatars/slate-wave.svg +0 -0
  141. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/avatars/teal-orbit.svg +0 -0
  142. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/avatars/violet-node.svg +0 -0
  143. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/cftrader-api-data.js +0 -0
  144. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/favicon.svg +0 -0
  145. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/image/qmt_deploy/image-10.png +0 -0
  146. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/image/qmt_deploy/image-11.png +0 -0
  147. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/image/qmt_deploy/image-12.png +0 -0
  148. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/image/qmt_deploy/image-13.png +0 -0
  149. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/image/qmt_deploy/image-14.png +0 -0
  150. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/image/qmt_deploy/image-15.png +0 -0
  151. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/image/qmt_deploy/image-16.png +0 -0
  152. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/image/qmt_deploy/image-17.png +0 -0
  153. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/image/qmt_deploy/image-18.png +0 -0
  154. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/image/qmt_deploy/image-19.png +0 -0
  155. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/image/qmt_deploy/image-20.png +0 -0
  156. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/image/qmt_deploy/image-21.png +0 -0
  157. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/image/qmt_deploy/image-4.png +0 -0
  158. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/image/qmt_deploy/image-5.png +0 -0
  159. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/image/qmt_deploy/image-6.png +0 -0
  160. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/image/qmt_deploy/image-7.png +0 -0
  161. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/image/qmt_deploy/image-8.png +0 -0
  162. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/image/qmt_deploy/image-9.png +0 -0
  163. {cfquant-0.2.41 → cfquant-0.2.43}/web_dashboard/python-api.js +0 -0
  164. {cfquant-0.2.41 → cfquant-0.2.43}/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.41
3
+ Version: 0.2.43
4
4
  Summary: QMT local bridge and xtquant-compatible Python client.
5
5
  License: MIT
6
6
  Requires-Python: >=3.8
@@ -1,5 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  import threading
3
+ from .stock_connect import connect_account_type
3
4
 
4
5
 
5
6
  _lock = threading.RLock()
@@ -8,25 +9,25 @@ _client_accounts = {}
8
9
 
9
10
 
10
11
  def _account_type(account_type):
11
- value = str(account_type or "STOCK").strip().upper()
12
- mapping = {
13
- "1": "FUTURE",
14
- "FUTURE_ACCOUNT": "FUTURE",
15
- "2": "STOCK",
16
- "SECURITY": "STOCK",
17
- "SECURITY_ACCOUNT": "STOCK",
18
- "STOCK_ACCOUNT": "STOCK",
19
- "3": "CREDIT",
20
- "CREDIT_ACCOUNT": "CREDIT",
21
- "MARGIN": "CREDIT",
22
- "5": "FUTURE_OPTION",
23
- "FUTURE_OPTION_ACCOUNT": "FUTURE_OPTION",
24
- "FUTUREOPTION": "FUTURE_OPTION",
25
- "6": "STOCK_OPTION",
26
- "STOCK_OPTION_ACCOUNT": "STOCK_OPTION",
27
- "STOCKOPTION": "STOCK_OPTION",
28
- "OPTION": "STOCK_OPTION",
29
- }
12
+ value = connect_account_type(account_type or "STOCK")
13
+ mapping = {
14
+ "1": "FUTURE",
15
+ "FUTURE_ACCOUNT": "FUTURE",
16
+ "2": "STOCK",
17
+ "SECURITY": "STOCK",
18
+ "SECURITY_ACCOUNT": "STOCK",
19
+ "STOCK_ACCOUNT": "STOCK",
20
+ "3": "CREDIT",
21
+ "CREDIT_ACCOUNT": "CREDIT",
22
+ "MARGIN": "CREDIT",
23
+ "5": "FUTURE_OPTION",
24
+ "FUTURE_OPTION_ACCOUNT": "FUTURE_OPTION",
25
+ "FUTUREOPTION": "FUTURE_OPTION",
26
+ "6": "STOCK_OPTION",
27
+ "STOCK_OPTION_ACCOUNT": "STOCK_OPTION",
28
+ "STOCKOPTION": "STOCK_OPTION",
29
+ "OPTION": "STOCK_OPTION",
30
+ }
30
31
  return mapping.get(value, value or "STOCK")
31
32
 
32
33
 
@@ -5,6 +5,7 @@ import os
5
5
  import time
6
6
  from collections.abc import Mapping
7
7
  from numbers import Integral, Real
8
+ from .stock_connect import normalize_connect_code, validate_connect_market
8
9
 
9
10
 
10
11
  CFTRADER_BATCH_ORDER_ACTIONS = frozenset(("cftrader.order_stock_batch", "cftrader.order_stock_batch_async"))
@@ -50,7 +51,7 @@ def prepare_batch_orders(orders, batch_id, strategy_name="", order_remark="", st
50
51
  row = dict(order)
51
52
  if not isinstance(row["stock_code"], str) or not row["stock_code"].strip():
52
53
  raise ValueError("%s.stock_code is required" % label)
53
- row["stock_code"] = row["stock_code"].strip()
54
+ row["stock_code"] = normalize_connect_code(row["stock_code"].strip())
54
55
  for name in ("order_type", "order_volume", "price_type"):
55
56
  value = row[name]
56
57
  if isinstance(value, bool) or not isinstance(value, Integral):
@@ -85,7 +86,7 @@ def _infer_stock_market(stock_code):
85
86
  text = str(stock_code or "").strip().upper()
86
87
  if "." in text:
87
88
  suffix = text.rsplit(".", 1)[1]
88
- if suffix in ("SH", "SZ", "BJ"):
89
+ if suffix in ("SH", "SZ", "BJ", "HGT", "SGT"):
89
90
  return suffix
90
91
  code = text.split(".", 1)[0]
91
92
  if len(code) >= 2:
@@ -123,8 +124,8 @@ def prepare_batch_cancels(cancels, batch_id, stop_on_error=False):
123
124
  row["order_id"] = str(order_id).strip()
124
125
  stock_code = str(row.get("stock_code") or "").strip().upper()
125
126
  market = str(row.get("market") or "").strip().upper()
126
- if market and market not in ("SH", "SZ", "BJ"):
127
- raise ValueError("%s.market must be SH, SZ or BJ" % label)
127
+ if market and market not in ("SH", "SZ", "BJ", "HGT", "SGT"):
128
+ raise ValueError("%s.market must be SH, SZ, BJ, HGT or SGT" % label)
128
129
  if not market:
129
130
  market = _infer_stock_market(stock_code)
130
131
  row["stock_code"] = stock_code
@@ -341,6 +342,8 @@ def execute_qmt_cancel_batch(bridge, params, msg, asynchronous):
341
342
  cancels = prepare_batch_cancel_request(params, asynchronous)
342
343
  account = params["account"]
343
344
  results = batch_cancel_result_rows(cancels, params.get("seqs") if asynchronous else None)
345
+ for cancel in cancels:
346
+ validate_connect_market(account.get("account_type"), cancel.get("stock_code"), cancel.get("market"))
344
347
  started = time.perf_counter()
345
348
  for index, (cancel, row) in enumerate(zip(cancels, results)):
346
349
  request = dict(cancel, account=account)