cfquant 0.2.60__tar.gz → 0.2.62__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.60 → cfquant-0.2.62}/PKG-INFO +1 -1
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/pipe_bridge.py +37 -17
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/pipe_transport.py +102 -36
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/qmt_component_login.py +16 -7
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/qmt_pipe_runtime.py +42 -16
- cfquant-0.2.62/cfquant/qmt_strategy_agent.js +239 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/qmt_strategy_recovery.py +24 -25
- cfquant-0.2.62/cfquant/tests/test_pipe_shutdown.py +394 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_qmt_fileless.py +15 -1
- cfquant-0.2.62/cfquant/tests/test_qmt_strategy_capabilities.py +189 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_qmt_strategy_recovery.py +59 -4
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/version.py +2 -2
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant.egg-info/PKG-INFO +1 -1
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant.egg-info/SOURCES.txt +2 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/pyproject.toml +1 -1
- {cfquant-0.2.60 → cfquant-0.2.62}/qmt_scripts/CFQUANT_LITE.py +226 -114
- {cfquant-0.2.60 → cfquant-0.2.62}/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 +226 -114
- {cfquant-0.2.60 → cfquant-0.2.62}/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 +226 -114
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/app.js +1 -1
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/index.html +2 -2
- cfquant-0.2.60/cfquant/qmt_strategy_agent.js +0 -131
- {cfquant-0.2.60 → cfquant-0.2.62}/LICENSE +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/LTtx/__init__.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/LTtx/tx/Config.txt +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/LTtx/tx/LTtx_server.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/LTtx/tx/__init__.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/LTtx/tx/tx.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/MANIFEST.in +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/README.md +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/__init__.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/_editable_install.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/account_routing.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/algo.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/algo_broker.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/batch_orders.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/build_info.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/callback_dispatcher.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/cftrader.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/channels.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/cli.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/client.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/config.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/diagnostics.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/flow_control.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/hub.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/level2.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/log_management.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/logging_i18n.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/management.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/normal_bridge.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/order_identity.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/order_meta.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/pipe_client.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/pipe_hub.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/protocol.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/qmt_binding_defaults.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/qmt_binding_settings.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/qmt_bridge.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/qmt_component_agent.js +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/qmt_credentials.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/qmt_dependencies.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/qmt_native_worker.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/qmt_strategy_deploy.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/qmt_strategy_package.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/qmt_strategy_runtime.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/qmt_update.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/quote_history.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/quote_leases.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/quote_service.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/remote_adapter.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/remote_management.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/remote_supervisor.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/rpc_timing.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/runtime_report.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/shared_quotes.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/stock_connect.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/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
- {cfquant-0.2.60 → cfquant-0.2.62}/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
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/12_/350/256/242/345/215/225/345/244/207/346/263/250/346/265/213/350/257/225.py" +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/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
- {cfquant-0.2.60 → cfquant-0.2.62}/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
- {cfquant-0.2.60 → cfquant-0.2.62}/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
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/16_/345/220/257/345/212/250/345/256/211/350/243/205/346/265/213/350/257/225.py" +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/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
- {cfquant-0.2.60 → cfquant-0.2.62}/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
- {cfquant-0.2.60 → cfquant-0.2.62}/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
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/1_/350/241/214/346/203/205/346/216/245/346/224/266/346/265/213/350/257/225.py" +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/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
- {cfquant-0.2.60 → cfquant-0.2.62}/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
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/22_/350/277/236/346/216/245/350/257/212/346/226/255/346/265/213/350/257/225.py" +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/23_/347/244/272/344/276/213/351/205/215/347/275/256/346/265/213/350/257/225.py" +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/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
- {cfquant-0.2.60 → cfquant-0.2.62}/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
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/26_/345/205/250/346/216/250/350/256/242/351/230/205/346/265/213/350/257/225.py" +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/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
- {cfquant-0.2.60 → cfquant-0.2.62}/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
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/29_Level2/350/241/214/346/203/205/346/265/213/350/257/225.py" +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/2_/346/225/260/346/215/256/350/216/267/345/217/226/346/265/213/350/257/225.py" +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/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
- {cfquant-0.2.60 → cfquant-0.2.62}/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
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/32_/345/274/202/346/255/245/344/270/213/345/215/225/346/265/213/350/257/225.py" +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/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
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/34_/345/205/250/346/216/250/345/206/205/351/203/250/345/273/266/350/277/237/346/265/213/350/257/225.py" +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/3_/346/225/260/346/215/256/344/270/213/350/275/275/346/265/213/350/257/225.py" +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/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
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/5_/347/234/237/345/256/236/344/270/213/345/215/225/346/265/213/350/257/225.py" +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/6_/345/233/236/350/260/203/346/265/213/350/257/225.py" +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/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
- {cfquant-0.2.60 → cfquant-0.2.62}/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
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/9_/345/217/257/346/222/244/350/256/242/345/215/225/346/265/213/350/257/225.py" +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/_helpers.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/readme.md +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_account_query_timing.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_account_subscription_probe.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_advanced_parity.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_algo.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_algo_broker.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_api_tester_browser.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_api_tester_web.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_binding_delete_confirmation.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_binding_live_refresh_browser.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_binding_runtime_browser.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_callback_recovery.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_callback_requests.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_cftrader.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_cftrader_tutorial.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_cftrader_web.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_credit_compat.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_dataframe_encoding.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_json_serialization.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_latency_flow_control.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_lite_account_routing.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_lite_deployment_paths.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_lite_parity.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_lite_qmt_dispatch.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_local_trading_calendar.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_log_management.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_management.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_management_batch.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_market_data_fallback.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_market_timing.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_order_identity.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_order_time_callback.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_project_updater.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_python_api_reference.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_qmt_auto_login_browser.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_qmt_auto_login_integration.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_qmt_binding_defaults.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_qmt_binding_settings.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_qmt_component_login.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_qmt_dependencies.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_qmt_native_worker.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_qmt_strategy_browser.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_qmt_strategy_deploy.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_qmt_strategy_web.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_qmt_update.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_quote_latency.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_quote_latency_encoding.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_quote_service.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_remote_management.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_remote_management_browser.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_remote_version_check.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_setup_qmt_prompt.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_shared_quotes.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_shared_quotes_generated.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_startup_recovery.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_stock_connect.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_stock_connect_browser.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_subscription_congestion.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_table_conversion.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_trade_strategy_callback.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_trader_subscription_recovery.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_trading_dates.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_trading_monitor.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_trading_monitor_browser.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_tutorial_reader.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_tx_auto_import.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tests/test_tx_shutdown.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/trading_calendar.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/trading_monitor.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tx.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/tx_trade_bridge.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/xtconstant.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/xtdata.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/xttrader.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant/xttype.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant.egg-info/dependency_links.txt +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant.egg-info/entry_points.txt +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant.egg-info/requires.txt +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant.egg-info/top_level.txt +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant_pipe_hub.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/cfquant_web_server.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/qmt_scripts/CFQUANT.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/qmt_scripts/CFQUANT_CTYPE_ALL_LOWLAT.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/qmt_scripts/CFQUANT_TRADE_LOWLAT.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/qmt_scripts/__init__.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/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
- {cfquant-0.2.60 → cfquant-0.2.62}/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
- {cfquant-0.2.60 → cfquant-0.2.62}/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.60 → cfquant-0.2.62}/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.60 → cfquant-0.2.62}/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
- {cfquant-0.2.60 → cfquant-0.2.62}/requirements.txt +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/setup.cfg +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/__init__.py +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/api-tester.js +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/avatars/amber-pulse.svg +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/avatars/copper-grid.svg +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/avatars/market-blue.svg +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/avatars/rose-circuit.svg +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/avatars/signal-green.svg +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/avatars/slate-wave.svg +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/avatars/teal-orbit.svg +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/avatars/violet-node.svg +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/cftrader-api-data.js +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/docs.js +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/favicon.svg +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/image/qmt_deploy/image-10.png +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/image/qmt_deploy/image-11.png +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/image/qmt_deploy/image-12.png +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/image/qmt_deploy/image-13.png +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/image/qmt_deploy/image-14.png +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/image/qmt_deploy/image-15.png +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/image/qmt_deploy/image-16.png +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/image/qmt_deploy/image-17.png +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/image/qmt_deploy/image-18.png +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/image/qmt_deploy/image-19.png +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/image/qmt_deploy/image-20.png +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/image/qmt_deploy/image-21.png +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/image/qmt_deploy/image-4.png +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/image/qmt_deploy/image-5.png +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/image/qmt_deploy/image-6.png +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/image/qmt_deploy/image-7.png +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/image/qmt_deploy/image-8.png +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/image/qmt_deploy/image-9.png +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/python-api-data.js +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/python-api.js +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/remote-management.js +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/styles.css +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/trading-monitor.js +0 -0
- {cfquant-0.2.60 → cfquant-0.2.62}/web_dashboard/vendor/mermaid.min.js +0 -0
|
@@ -48,8 +48,16 @@ class PipeNormalQmtBridge(NormalQmtBridge):
|
|
|
48
48
|
self.pipe_name = pipe_name or DEFAULT_PIPE_NAME
|
|
49
49
|
self.request_channels = list(request_channels or [request_channel])
|
|
50
50
|
self.connect_timeout_ms = int(connect_timeout_ms)
|
|
51
|
+
self._pipe_lock = threading.RLock()
|
|
52
|
+
self._pipe_closed = False
|
|
51
53
|
|
|
52
54
|
def start(self):
|
|
55
|
+
with self._pipe_lock:
|
|
56
|
+
if self._pipe_closed:
|
|
57
|
+
raise RuntimeError("pipe bridge is closed")
|
|
58
|
+
return self._start_transport()
|
|
59
|
+
|
|
60
|
+
def _start_transport(self):
|
|
53
61
|
runtime = self.globals_dict.get("_managed_runtime")
|
|
54
62
|
if runtime is not None:
|
|
55
63
|
runtime.attach_bridge(self)
|
|
@@ -80,23 +88,31 @@ class PipeNormalQmtBridge(NormalQmtBridge):
|
|
|
80
88
|
self._publish_runtime_report("start")
|
|
81
89
|
return self
|
|
82
90
|
|
|
91
|
+
def stop_transport(self):
|
|
92
|
+
# This phase must not wait for QMT native work or dispatch_lock.
|
|
93
|
+
with self._pipe_lock:
|
|
94
|
+
self._pipe_closed = True
|
|
95
|
+
self.running = False
|
|
96
|
+
tx, self.tx = self.tx, None
|
|
97
|
+
event = getattr(self, "worker_event", None)
|
|
98
|
+
if event is not None:
|
|
99
|
+
event.set()
|
|
100
|
+
if tx is not None:
|
|
101
|
+
tx.close()
|
|
102
|
+
deadline = time.monotonic() + 0.5
|
|
103
|
+
for worker in (getattr(self, "recv_thread", None), getattr(self, "worker_thread", None)):
|
|
104
|
+
if worker is not None and worker is not threading.current_thread() and worker.is_alive():
|
|
105
|
+
worker.join(max(0.0, deadline - time.monotonic()))
|
|
106
|
+
|
|
83
107
|
def close(self):
|
|
108
|
+
self.stop_transport()
|
|
84
109
|
self._flush_pending_order_errors(force=True)
|
|
85
|
-
self.running = False
|
|
86
|
-
self.worker_event.set()
|
|
87
110
|
self._close_quote_subscriptions()
|
|
88
111
|
if self.context is not None and self.schedule_key:
|
|
89
112
|
try:
|
|
90
113
|
self.context.cancel_schedule_run(self.schedule_key)
|
|
91
114
|
except Exception:
|
|
92
115
|
pass
|
|
93
|
-
tx = self.tx
|
|
94
|
-
self.tx = None
|
|
95
|
-
if tx is not None:
|
|
96
|
-
try:
|
|
97
|
-
tx.close()
|
|
98
|
-
except Exception:
|
|
99
|
-
pass
|
|
100
116
|
self._log("pipe normal bridge stopped")
|
|
101
117
|
|
|
102
118
|
def _status_extra(self):
|
|
@@ -138,8 +154,16 @@ class PipeTradeBridge(TxTradeBridge):
|
|
|
138
154
|
)
|
|
139
155
|
self.pipe_name = pipe_name or DEFAULT_PIPE_NAME
|
|
140
156
|
self.connect_timeout_ms = int(connect_timeout_ms)
|
|
157
|
+
self._pipe_lock = threading.RLock()
|
|
158
|
+
self._pipe_closed = False
|
|
141
159
|
|
|
142
160
|
def start(self):
|
|
161
|
+
with self._pipe_lock:
|
|
162
|
+
if self._pipe_closed:
|
|
163
|
+
raise RuntimeError("pipe bridge is closed")
|
|
164
|
+
return self._start_transport()
|
|
165
|
+
|
|
166
|
+
def _start_transport(self):
|
|
143
167
|
runtime = self.globals_dict.get("_managed_runtime")
|
|
144
168
|
if runtime is not None:
|
|
145
169
|
runtime.attach_bridge(self)
|
|
@@ -166,15 +190,11 @@ class PipeTradeBridge(TxTradeBridge):
|
|
|
166
190
|
self._publish_runtime_report("start")
|
|
167
191
|
return self
|
|
168
192
|
|
|
193
|
+
def stop_transport(self):
|
|
194
|
+
PipeNormalQmtBridge.stop_transport(self)
|
|
195
|
+
|
|
169
196
|
def close(self):
|
|
170
|
-
self.
|
|
171
|
-
tx = self.tx
|
|
172
|
-
self.tx = None
|
|
173
|
-
if tx is not None:
|
|
174
|
-
try:
|
|
175
|
-
tx.close()
|
|
176
|
-
except Exception:
|
|
177
|
-
pass
|
|
197
|
+
self.stop_transport()
|
|
178
198
|
self._log("pipe trade bridge stopped")
|
|
179
199
|
|
|
180
200
|
def poll(self, max_messages=100, timeout=0):
|
|
@@ -254,12 +254,14 @@ class NamedPipeConnection(object):
|
|
|
254
254
|
offset += written.value
|
|
255
255
|
|
|
256
256
|
|
|
257
|
-
def connect_pipe(pipe_name=None, timeout_ms=3000):
|
|
257
|
+
def connect_pipe(pipe_name=None, timeout_ms=3000, stop_event=None):
|
|
258
258
|
pipe_name = normalize_pipe_name(pipe_name)
|
|
259
259
|
k32 = kernel32()
|
|
260
|
-
deadline = time.
|
|
260
|
+
deadline = time.monotonic() + max(float(timeout_ms), 1.0) / 1000.0
|
|
261
261
|
last_error = None
|
|
262
262
|
while True:
|
|
263
|
+
if stop_event is not None and stop_event.is_set():
|
|
264
|
+
raise ConnectionAbortedError("named pipe connection cancelled")
|
|
263
265
|
handle = k32.dll.CreateFileW(
|
|
264
266
|
pipe_name,
|
|
265
267
|
GENERIC_READ | GENERIC_WRITE,
|
|
@@ -270,16 +272,23 @@ def connect_pipe(pipe_name=None, timeout_ms=3000):
|
|
|
270
272
|
None,
|
|
271
273
|
)
|
|
272
274
|
if not k32.invalid_handle(handle):
|
|
273
|
-
|
|
275
|
+
conn = NamedPipeConnection(handle, pipe_name, owner_server_side=False)
|
|
276
|
+
if stop_event is not None and stop_event.is_set():
|
|
277
|
+
conn.close()
|
|
278
|
+
raise ConnectionAbortedError("named pipe connection cancelled")
|
|
279
|
+
return conn
|
|
274
280
|
last_error = k32.last_error()
|
|
275
281
|
if last_error == ERROR_PIPE_BUSY:
|
|
276
|
-
wait_ms = min(
|
|
282
|
+
wait_ms = min(50 if stop_event is not None else 250,
|
|
283
|
+
max(1, int((deadline - time.monotonic()) * 1000)))
|
|
277
284
|
k32.dll.WaitNamedPipeW(pipe_name, wait_ms)
|
|
278
|
-
elif
|
|
279
|
-
|
|
285
|
+
elif stop_event is not None:
|
|
286
|
+
stop_event.wait(0.05)
|
|
280
287
|
else:
|
|
281
288
|
time.sleep(0.05)
|
|
282
|
-
if
|
|
289
|
+
if stop_event is not None and stop_event.is_set():
|
|
290
|
+
raise ConnectionAbortedError("named pipe connection cancelled")
|
|
291
|
+
if time.monotonic() >= deadline:
|
|
283
292
|
raise OSError(last_error or 0, "connect named pipe timeout pipe=%s winerror=%s" % (pipe_name, last_error))
|
|
284
293
|
|
|
285
294
|
|
|
@@ -366,21 +375,27 @@ class PipeTxClient(object):
|
|
|
366
375
|
self._sender = None
|
|
367
376
|
self._sender_conn = None
|
|
368
377
|
self._stop_event = threading.Event()
|
|
378
|
+
self._closed = False
|
|
379
|
+
self._connecting_conns = set()
|
|
369
380
|
self.send_max_bytes = int(os.environ.get("CFQUANT_PIPE_SEND_MAX_BYTES", 128 * 1024 * 1024))
|
|
370
381
|
self.send_timeout = float(os.environ.get("CFQUANT_PIPE_SEND_TIMEOUT", "15"))
|
|
371
382
|
|
|
372
383
|
def start(self):
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
self.
|
|
382
|
-
self.
|
|
383
|
-
self.
|
|
384
|
+
with self.conn_lock:
|
|
385
|
+
# A strategy restart creates a new client. Reusing this stop event
|
|
386
|
+
# could reactivate workers still exiting from the previous run.
|
|
387
|
+
if self._closed:
|
|
388
|
+
raise RuntimeError("pipe tx client is closed")
|
|
389
|
+
if self.running:
|
|
390
|
+
return self
|
|
391
|
+
self.running = True
|
|
392
|
+
self.thread = threading.Thread(target=self._connect_loop, name="cfquant-pipe-connect")
|
|
393
|
+
self.thread.daemon = True
|
|
394
|
+
self.thread.start()
|
|
395
|
+
if self.heartbeat_interval > 0 or self.send_timeout > 0:
|
|
396
|
+
self.heartbeat_thread = threading.Thread(target=self._heartbeat_loop, name="cfquant-pipe-heartbeat")
|
|
397
|
+
self.heartbeat_thread.daemon = True
|
|
398
|
+
self.heartbeat_thread.start()
|
|
384
399
|
return self
|
|
385
400
|
|
|
386
401
|
def start_tx(self):
|
|
@@ -406,6 +421,8 @@ class PipeTxClient(object):
|
|
|
406
421
|
if not isinstance(payload, str):
|
|
407
422
|
raise TypeError("pipe publish payload must be an encoded string")
|
|
408
423
|
with self.conn_lock:
|
|
424
|
+
if self._closed:
|
|
425
|
+
return {"code": -1, "msg": "pipe tx client is closed"}
|
|
409
426
|
if (self.tx_conn, self.connection_generation) != (conn, generation):
|
|
410
427
|
raise RuntimeError("pipe connection changed before send")
|
|
411
428
|
if self._sender is None or self._sender_conn is not conn:
|
|
@@ -430,25 +447,59 @@ class PipeTxClient(object):
|
|
|
430
447
|
return {"code": -1, "msg": str(e)}
|
|
431
448
|
|
|
432
449
|
def close(self):
|
|
433
|
-
self.
|
|
434
|
-
|
|
450
|
+
with self.conn_lock:
|
|
451
|
+
self._closed = True
|
|
452
|
+
self.running = False
|
|
453
|
+
self._stop_event.set()
|
|
454
|
+
connecting = tuple(self._connecting_conns)
|
|
455
|
+
self._connecting_conns.clear()
|
|
456
|
+
sender = self._sender
|
|
457
|
+
workers = (self.thread, self.heartbeat_thread)
|
|
458
|
+
# Interrupt ReadFile/WriteFile, including either hello handshake,
|
|
459
|
+
# before joining. Native cleanup and joins must not hold conn_lock.
|
|
460
|
+
self._drop_pair(None, reason="pipe tx client closed", conns=connecting)
|
|
461
|
+
# A concurrent submit may have started the sender just before it was
|
|
462
|
+
# closed. Read its thread only after close prevents further submits.
|
|
463
|
+
workers += (getattr(sender, "_thread", None),)
|
|
435
464
|
try:
|
|
436
465
|
self.Q.put_nowait(None)
|
|
437
|
-
except
|
|
466
|
+
except queue.Full:
|
|
438
467
|
pass
|
|
439
|
-
|
|
468
|
+
deadline = time.monotonic() + 1.0
|
|
469
|
+
for worker in workers:
|
|
470
|
+
if worker is not None and worker is not threading.current_thread() and worker.is_alive():
|
|
471
|
+
worker.join(max(0.0, deadline - time.monotonic()))
|
|
472
|
+
|
|
473
|
+
def _open_connection(self, role):
|
|
474
|
+
conn = connect_pipe(self.pipe_name, timeout_ms=self.connect_timeout_ms,
|
|
475
|
+
stop_event=self._stop_event)
|
|
476
|
+
try:
|
|
477
|
+
with self.conn_lock:
|
|
478
|
+
if self._closed:
|
|
479
|
+
raise ConnectionAbortedError("pipe tx client is closed")
|
|
480
|
+
self._connecting_conns.add(conn)
|
|
481
|
+
conn.write_frame(dumps_pipe_message(self._pipe_envelope("hello", role)))
|
|
482
|
+
if self._stop_event.is_set():
|
|
483
|
+
raise ConnectionAbortedError("pipe tx client is closed")
|
|
484
|
+
return conn
|
|
485
|
+
except BaseException:
|
|
486
|
+
with self.conn_lock:
|
|
487
|
+
self._connecting_conns.discard(conn)
|
|
488
|
+
self._close_conns((conn,))
|
|
489
|
+
raise
|
|
440
490
|
|
|
441
491
|
def _connect_loop(self):
|
|
442
|
-
while self.running:
|
|
492
|
+
while self.running and not self._stop_event.is_set():
|
|
443
493
|
rx_conn = None
|
|
444
494
|
tx_conn = None
|
|
445
495
|
generation = None
|
|
446
496
|
try:
|
|
447
|
-
rx_conn =
|
|
448
|
-
|
|
449
|
-
tx_conn = connect_pipe(self.pipe_name, timeout_ms=self.connect_timeout_ms)
|
|
450
|
-
tx_conn.write_frame(dumps_pipe_message(self._pipe_envelope("hello", "qmt_tx")))
|
|
497
|
+
rx_conn = self._open_connection("qmt_rx")
|
|
498
|
+
tx_conn = self._open_connection("qmt_tx")
|
|
451
499
|
with self.conn_lock:
|
|
500
|
+
if self._closed:
|
|
501
|
+
raise ConnectionAbortedError("pipe tx client is closed")
|
|
502
|
+
self._connecting_conns.difference_update((rx_conn, tx_conn))
|
|
452
503
|
self.connection_generation += 1
|
|
453
504
|
generation = self.connection_generation
|
|
454
505
|
self.rx_conn = rx_conn
|
|
@@ -461,29 +512,44 @@ class PipeTxClient(object):
|
|
|
461
512
|
)
|
|
462
513
|
self._read_loop(rx_conn, generation)
|
|
463
514
|
except Exception as e:
|
|
464
|
-
self.
|
|
465
|
-
|
|
466
|
-
|
|
515
|
+
with self.conn_lock:
|
|
516
|
+
if self.running and not self._closed:
|
|
517
|
+
self.last_error = str(e)
|
|
518
|
+
self._log("pipe connect/read failed: %s" % e)
|
|
467
519
|
finally:
|
|
520
|
+
with self.conn_lock:
|
|
521
|
+
self._connecting_conns.difference_update((rx_conn, tx_conn))
|
|
468
522
|
if generation is None:
|
|
469
523
|
self._close_conns((rx_conn, tx_conn))
|
|
470
524
|
else:
|
|
471
525
|
self._drop_pair(generation, conns=(rx_conn, tx_conn))
|
|
472
|
-
if self.
|
|
473
|
-
|
|
526
|
+
if self._stop_event.wait(max(0.0, self.reconnect_interval)):
|
|
527
|
+
break
|
|
474
528
|
|
|
475
529
|
def _read_loop(self, conn, generation):
|
|
476
|
-
while self.running and self._get_rx_state() == (conn, generation):
|
|
530
|
+
while self.running and not self._stop_event.is_set() and self._get_rx_state() == (conn, generation):
|
|
477
531
|
raw = conn.read_frame()
|
|
478
532
|
if raw is None:
|
|
479
533
|
break
|
|
480
534
|
envelope = loads_pipe_message(raw)
|
|
481
535
|
if envelope:
|
|
482
536
|
payload = envelope.get("payload")
|
|
483
|
-
if payload:
|
|
484
|
-
|
|
537
|
+
if payload and not self._queue_received(payload):
|
|
538
|
+
return
|
|
485
539
|
continue
|
|
486
|
-
self.
|
|
540
|
+
if not self._queue_received(raw):
|
|
541
|
+
return
|
|
542
|
+
|
|
543
|
+
def _queue_received(self, payload):
|
|
544
|
+
# A stopped bridge no longer drains Q. Never leave the reader blocked
|
|
545
|
+
# forever in put() when its bounded queue is full at shutdown.
|
|
546
|
+
while self.running and not self._stop_event.is_set():
|
|
547
|
+
try:
|
|
548
|
+
self.Q.put(payload, timeout=0.1)
|
|
549
|
+
return True
|
|
550
|
+
except queue.Full:
|
|
551
|
+
pass
|
|
552
|
+
return False
|
|
487
553
|
|
|
488
554
|
def _get_rx_conn(self):
|
|
489
555
|
with self.conn_lock:
|
|
@@ -27,7 +27,7 @@ def verify_environment(directory):
|
|
|
27
27
|
verify_environment_isolated(directory)
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
def _verify_environment_native(directory):
|
|
30
|
+
def _verify_environment_native(directory, *, strategy=False):
|
|
31
31
|
"""Only invoked inside the native worker or the standalone login CLI."""
|
|
32
32
|
try:
|
|
33
33
|
from .qmt_dependencies import LOGIN_MODULES, import_login_module
|
|
@@ -38,14 +38,17 @@ def _verify_environment_native(directory):
|
|
|
38
38
|
directory = Path(directory)
|
|
39
39
|
for module in ("Qt5Core.dll", "Qt5Widgets.dll"):
|
|
40
40
|
version = win32api.GetFileVersionInfo(str(directory / module), "\\")
|
|
41
|
-
if
|
|
41
|
+
if strategy:
|
|
42
|
+
if version["FileVersionMS"] >> 16 != 5:
|
|
43
|
+
raise RuntimeError("QMT 策略检测需要兼容的 Qt 5 接口,当前组件 ABI 不受支持")
|
|
44
|
+
elif (version["FileVersionMS"], version["FileVersionLS"]) != ((5 << 16) | 6, 2 << 16):
|
|
42
45
|
raise RuntimeError("QMT 组件自动登录当前仅支持 Qt 5.6.2,请先适配此客户端版本")
|
|
43
46
|
with (directory / "XtItClient.exe").open("rb") as stream:
|
|
44
47
|
stream.seek(0x3C)
|
|
45
48
|
offset = int.from_bytes(stream.read(4), "little")
|
|
46
49
|
stream.seek(offset + 4)
|
|
47
50
|
if int.from_bytes(stream.read(2), "little") != 0x8664:
|
|
48
|
-
raise RuntimeError("QMT
|
|
51
|
+
raise RuntimeError("QMT 原生组件操作需要 64 位客户端")
|
|
49
52
|
|
|
50
53
|
|
|
51
54
|
def auto_login(backend, password_provider, *, retry_not_ready=False, login_account=None,
|
|
@@ -132,7 +135,7 @@ def select_binding(config_path, name):
|
|
|
132
135
|
|
|
133
136
|
|
|
134
137
|
class QtLoginBackend:
|
|
135
|
-
def __init__(self, directory, timeout=40, expected_pid=None, *, agent_extension=""):
|
|
138
|
+
def __init__(self, directory, timeout=40, expected_pid=None, *, agent_extension="", strategy=False):
|
|
136
139
|
try:
|
|
137
140
|
from .qmt_dependencies import import_login_module
|
|
138
141
|
except ImportError:
|
|
@@ -170,7 +173,10 @@ class QtLoginBackend:
|
|
|
170
173
|
self.pid = matches[0].pid
|
|
171
174
|
if expected_pid is not None and self.pid != expected_pid:
|
|
172
175
|
raise RuntimeError("QMT process changed; stopping this login attempt")
|
|
173
|
-
|
|
176
|
+
if strategy:
|
|
177
|
+
_verify_environment_native(directory, strategy=True)
|
|
178
|
+
else:
|
|
179
|
+
_verify_environment_native(directory)
|
|
174
180
|
self.mutex = win32event.CreateMutex(None, False, "Local\\CFQuantQmtComponentLogin_" + str(self.pid))
|
|
175
181
|
acquired = win32event.WaitForSingleObject(self.mutex, 0)
|
|
176
182
|
if acquired not in (0, 0x80):
|
|
@@ -179,13 +185,16 @@ class QtLoginBackend:
|
|
|
179
185
|
raise RuntimeError("Another component login is already running for this QMT")
|
|
180
186
|
try:
|
|
181
187
|
self.session = frida.attach(self.pid)
|
|
182
|
-
|
|
188
|
+
modules = ["Qt5Core.dll", "Qt5Widgets.dll"]
|
|
189
|
+
if not strategy:
|
|
190
|
+
modules.append("LoginDialog.dll")
|
|
191
|
+
readiness = self.session.create_script("rpc.exports.ready = () => %s.every(n => Process.findModuleByName(n) !== null);" % json.dumps(modules))
|
|
183
192
|
readiness.load()
|
|
184
193
|
ready = readiness.exports_sync.ready()
|
|
185
194
|
readiness.unload()
|
|
186
195
|
if not ready:
|
|
187
196
|
raise QmtNotReady("QMT login modules are still loading")
|
|
188
|
-
source = Path(__file__).with_name("qmt_component_agent.js").read_text(encoding="utf-8")
|
|
197
|
+
source = "" if strategy else Path(__file__).with_name("qmt_component_agent.js").read_text(encoding="utf-8")
|
|
189
198
|
script = self.session.create_script(source + "\n" + agent_extension)
|
|
190
199
|
script.on("message", lambda message, data: self.messages.append("agent_error") if message.get("type") == "error" else None)
|
|
191
200
|
script.load()
|
|
@@ -30,6 +30,7 @@ class ManagedPipeRuntime(object):
|
|
|
30
30
|
self.failure = ""
|
|
31
31
|
self.calls = 0
|
|
32
32
|
self.bridges_closed = False
|
|
33
|
+
self.closing = False
|
|
33
34
|
self.attached_bridges = []
|
|
34
35
|
self.mutex = _cq_threading.RLock()
|
|
35
36
|
|
|
@@ -129,8 +130,6 @@ class ManagedPipeRuntime(object):
|
|
|
129
130
|
return guarded
|
|
130
131
|
|
|
131
132
|
def bind(self, namespace):
|
|
132
|
-
if not self.descriptor:
|
|
133
|
-
return
|
|
134
133
|
self.namespace = namespace
|
|
135
134
|
self.original_stop = namespace.get("stop")
|
|
136
135
|
for name, value in list(namespace.items()):
|
|
@@ -166,24 +165,51 @@ class ManagedPipeRuntime(object):
|
|
|
166
165
|
|
|
167
166
|
def close(self, context=None):
|
|
168
167
|
with self.mutex:
|
|
169
|
-
if
|
|
168
|
+
if self.closing or self.bridges_closed:
|
|
170
169
|
return
|
|
170
|
+
self.closing = True
|
|
171
171
|
self.active = False
|
|
172
172
|
self.approved = False
|
|
173
|
+
errors = []
|
|
174
|
+
completed = False
|
|
175
|
+
bridges = list(self.attached_bridges)
|
|
176
|
+
for name in ("_normal_bridge", "_trade_bridge"):
|
|
177
|
+
bridge = self.namespace.get(name)
|
|
178
|
+
if bridge is not None and bridge not in bridges:
|
|
179
|
+
bridges.append(bridge)
|
|
173
180
|
try:
|
|
181
|
+
# Stop ALL Pipe workers before the entry cancels QMT timers or
|
|
182
|
+
# unsubscribes quotes. Either native operation may block or fail.
|
|
183
|
+
for bridge in bridges:
|
|
184
|
+
stop_transport = getattr(bridge, "stop_transport", None)
|
|
185
|
+
if callable(stop_transport):
|
|
186
|
+
try:
|
|
187
|
+
stop_transport()
|
|
188
|
+
except Exception as error:
|
|
189
|
+
errors.append(str(error))
|
|
190
|
+
original_failed = False
|
|
174
191
|
if self.original_stop is not None:
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
bridges.append(bridge)
|
|
192
|
+
try:
|
|
193
|
+
self.original_stop(context)
|
|
194
|
+
except Exception as error:
|
|
195
|
+
original_failed = True
|
|
196
|
+
errors.append(str(error))
|
|
197
|
+
if self.original_stop is None or original_failed:
|
|
182
198
|
for bridge in bridges:
|
|
183
|
-
|
|
199
|
+
try:
|
|
200
|
+
bridge.close()
|
|
201
|
+
except Exception as error:
|
|
202
|
+
errors.append(str(error))
|
|
203
|
+
worker = self.namespace.get("_trade_thread")
|
|
204
|
+
if worker is not None and worker is not _cq_threading.current_thread() and worker.is_alive():
|
|
205
|
+
worker.join(0.5)
|
|
206
|
+
completed = True
|
|
207
|
+
finally:
|
|
184
208
|
with self.mutex:
|
|
185
|
-
self.
|
|
186
|
-
self.
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
209
|
+
self.closing = False
|
|
210
|
+
self.bridges_closed = completed and not errors
|
|
211
|
+
if self.bridges_closed:
|
|
212
|
+
self.release_if_idle()
|
|
213
|
+
if errors:
|
|
214
|
+
self.failure = "; ".join(errors)
|
|
215
|
+
print("cfquant strategy shutdown failed: %s" % self.failure)
|