cfquant 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. LTtx/__init__.py +2 -0
  2. LTtx/tx/Config.txt +8 -0
  3. LTtx/tx/LTtx_server.py +1177 -0
  4. LTtx/tx/__init__.py +5 -0
  5. LTtx/tx/tx.py +1935 -0
  6. cfquant/__init__.py +26 -0
  7. cfquant/account_routing.py +119 -0
  8. cfquant/channels.py +76 -0
  9. cfquant/cli.py +266 -0
  10. cfquant/client.py +365 -0
  11. cfquant/config.py +86 -0
  12. cfquant/hub.py +304 -0
  13. cfquant/logging_i18n.py +348 -0
  14. cfquant/normal_bridge.py +676 -0
  15. cfquant/pipe_bridge.py +249 -0
  16. cfquant/pipe_client.py +223 -0
  17. cfquant/pipe_hub.py +602 -0
  18. cfquant/pipe_transport.py +493 -0
  19. cfquant/protocol.py +238 -0
  20. cfquant/qmt_bridge.py +1081 -0
  21. cfquant/runtime_report.py +334 -0
  22. cfquant/tx.py +1898 -0
  23. cfquant/tx_trade_bridge.py +1905 -0
  24. cfquant/version.py +5 -0
  25. cfquant/xtconstant.py +262 -0
  26. cfquant/xtdata.py +462 -0
  27. cfquant/xttrader.py +955 -0
  28. cfquant/xttype.py +586 -0
  29. cfquant-0.2.0.dist-info/LICENSE +21 -0
  30. cfquant-0.2.0.dist-info/METADATA +144 -0
  31. cfquant-0.2.0.dist-info/RECORD +90 -0
  32. cfquant-0.2.0.dist-info/WHEEL +5 -0
  33. cfquant-0.2.0.dist-info/entry_points.txt +4 -0
  34. cfquant-0.2.0.dist-info/top_level.txt +6 -0
  35. cfquant_pipe_hub.py +45 -0
  36. cfquant_web_server.py +12137 -0
  37. qmt_scripts/CFQUANT.py +507 -0
  38. qmt_scripts/CFQUANT_CTYPE_ALL_LOWLAT.py +830 -0
  39. qmt_scripts/CFQUANT_LITE.py +4928 -0
  40. qmt_scripts/CFQUANT_TRADE_LOWLAT.py +382 -0
  41. qmt_scripts/__init__.py +1 -0
  42. qmt_scripts//321/205/320/240/320/234/321/210/342/224/244/320/266/321/205/320/237/342/225/226/321/207/320/233/320/274/321/207/320/273/320/233/321/205/342/225/225/320/222/321/205/320/254/342/225/221/CFQUANT_CTYPE_ALL_LOWLAT_SH.py +866 -0
  43. qmt_scripts//321/205/320/240/320/234/321/210/342/224/244/320/266/321/205/320/237/342/225/226/321/207/320/233/320/274/321/207/320/273/320/233/321/205/342/225/225/320/222/321/205/320/254/342/225/221/CFQUANT_CTYPE_ALL_LOWLAT_SZ.py +866 -0
  44. qmt_scripts//321/205/320/240/320/234/321/210/342/224/244/320/266/321/205/320/237/342/225/226/321/207/320/233/320/274/321/207/320/273/320/233/321/205/342/225/225/320/222/321/205/320/254/342/225/221/CFQUANT_LITE_SH.py +5020 -0
  45. qmt_scripts//321/205/320/240/320/234/321/210/342/224/244/320/266/321/205/320/237/342/225/226/321/207/320/233/320/274/321/207/320/273/320/233/321/205/342/225/225/320/222/321/205/320/254/342/225/221/CFQUANT_LITE_SZ.py +5020 -0
  46. qmt_scripts//321/205/320/240/320/234/321/210/342/224/244/320/266/321/205/320/237/342/225/226/321/207/320/233/320/274/321/207/320/273/320/233/321/205/342/225/225/320/222/321/205/320/254/342/225/221/CFQUANT_TRADE_LOWLAT_SH.py +436 -0
  47. qmt_scripts//321/205/320/240/320/234/321/210/342/224/244/320/266/321/205/320/237/342/225/226/321/207/320/233/320/274/321/207/320/273/320/233/321/205/342/225/225/320/222/321/205/320/254/342/225/221/CFQUANT_TRADE_LOWLAT_SZ.py +436 -0
  48. qmt_scripts//321/205/320/240/320/234/321/210/342/224/244/320/266/321/205/320/237/342/225/226/321/207/320/233/320/274/321/207/320/273/320/233/321/205/342/225/225/320/222/321/205/320/254/342/225/221/readme.md +95 -0
  49. web_dashboard/__init__.py +1 -0
  50. web_dashboard/app.js +9847 -0
  51. web_dashboard/avatars/amber-pulse.svg +15 -0
  52. web_dashboard/avatars/copper-grid.svg +15 -0
  53. web_dashboard/avatars/market-blue.svg +15 -0
  54. web_dashboard/avatars/rose-circuit.svg +15 -0
  55. web_dashboard/avatars/signal-green.svg +15 -0
  56. web_dashboard/avatars/slate-wave.svg +15 -0
  57. web_dashboard/avatars/teal-orbit.svg +16 -0
  58. web_dashboard/avatars/violet-node.svg +15 -0
  59. web_dashboard/favicon.svg +5 -0
  60. web_dashboard/image/qmt_deploy/image-10.png +0 -0
  61. web_dashboard/image/qmt_deploy/image-11.png +0 -0
  62. web_dashboard/image/qmt_deploy/image-12.png +0 -0
  63. web_dashboard/image/qmt_deploy/image-13.png +0 -0
  64. web_dashboard/image/qmt_deploy/image-14.png +0 -0
  65. web_dashboard/image/qmt_deploy/image-15.png +0 -0
  66. web_dashboard/image/qmt_deploy/image-16.png +0 -0
  67. web_dashboard/image/qmt_deploy/image-17.png +0 -0
  68. web_dashboard/image/qmt_deploy/image-18.png +0 -0
  69. web_dashboard/image/qmt_deploy/image-19.png +0 -0
  70. web_dashboard/image/qmt_deploy/image-20.png +0 -0
  71. web_dashboard/image/qmt_deploy/image-21.png +0 -0
  72. web_dashboard/image/qmt_deploy/image-4.png +0 -0
  73. web_dashboard/image/qmt_deploy/image-5.png +0 -0
  74. web_dashboard/image/qmt_deploy/image-6.png +0 -0
  75. web_dashboard/image/qmt_deploy/image-7.png +0 -0
  76. web_dashboard/image/qmt_deploy/image-8.png +0 -0
  77. web_dashboard/image/qmt_deploy/image-9.png +0 -0
  78. web_dashboard/image//321/211/320/220/320/252/321/207/320/244/320/270/321/206/320/270/320/261/321/205/342/225/235/320/237/321/211/320/223/320/270/321/207/342/225/234/342/226/223/321/206/320/234/320/227/321/205/320/235/320/247/image-1.png +0 -0
  79. web_dashboard/image//321/211/320/220/320/252/321/207/320/244/320/270/321/206/320/270/320/261/321/205/342/225/235/320/237/321/211/320/223/320/270/321/207/342/225/234/342/226/223/321/206/320/234/320/227/321/205/320/235/320/247/image-2.png +0 -0
  80. web_dashboard/image//321/211/320/220/320/252/321/207/320/244/320/270/321/206/320/270/320/261/321/205/342/225/235/320/237/321/211/320/223/320/270/321/207/342/225/234/342/226/223/321/206/320/234/320/227/321/205/320/235/320/247/image-3.png +0 -0
  81. web_dashboard/image//321/211/320/220/320/252/321/207/320/244/320/270/321/206/320/270/320/261/321/205/342/225/235/320/237/321/211/320/223/320/270/321/207/342/225/234/342/226/223/321/206/320/234/320/227/321/205/320/235/320/247/image.png +0 -0
  82. web_dashboard/image//321/211/320/223/320/270/321/207/342/225/234/342/226/223/321/206/320/234/320/227/321/205/320/235/320/247/1783479325179.png +0 -0
  83. web_dashboard/image//321/211/320/223/320/270/321/207/342/225/234/342/226/223/321/206/320/234/320/227/321/205/320/235/320/247/1783479745262.png +0 -0
  84. web_dashboard/image//321/211/320/223/320/270/321/207/342/225/234/342/226/223/321/206/320/234/320/227/321/205/320/235/320/247/1783480178700.png +0 -0
  85. web_dashboard/image//321/211/320/223/320/270/321/207/342/225/234/342/226/223/321/206/320/234/320/227/321/205/320/235/320/247/1783480428759.png +0 -0
  86. web_dashboard/image//321/211/320/223/320/270/321/207/342/225/234/342/226/223/321/206/320/234/320/227/321/205/320/235/320/247/1783489807217.png +0 -0
  87. web_dashboard/image//321/211/320/223/320/270/321/207/342/225/234/342/226/223/321/206/320/234/320/227/321/205/320/235/320/247/1783490503491.png +0 -0
  88. web_dashboard/index.html +2317 -0
  89. web_dashboard/styles.css +7817 -0
  90. web_dashboard/vendor/mermaid.min.js +2029 -0
cfquant/version.py ADDED
@@ -0,0 +1,5 @@
1
+ # -*- coding: utf-8 -*-
2
+ """cfquant core version metadata."""
3
+
4
+ __version__ = "core_20260904_01"
5
+ WEB_VERSION = "web_20260904_09"
cfquant/xtconstant.py ADDED
@@ -0,0 +1,262 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ import contextlib
4
+ import importlib
5
+ import io
6
+
7
+ FUTURE_ACCOUNT = 1
8
+ SECURITY_ACCOUNT = 2
9
+ STOCK_ACCOUNT = SECURITY_ACCOUNT
10
+ CREDIT_ACCOUNT = 3
11
+ FUTURE_OPTION_ACCOUNT = 5
12
+ STOCK_OPTION_ACCOUNT = 6
13
+ HUGANGTONG_ACCOUNT = 7
14
+ INCOME_SWAP_ACCOUNT = 8
15
+ NEW3BOARD_ACCOUNT = 10
16
+ SHENGANGTONG_ACCOUNT = 11
17
+ AT_OFFSITEBANKING = 13
18
+ AT_OUTTER_FUTURE = 1001
19
+ AT_IB = 1002
20
+ AT_NS_TRUSTBANK = 15001
21
+ AT_INTERBANK = 15002
22
+ AT_BANK = 15003
23
+ AT_OTC = 15005
24
+
25
+ ACCOUNT_TYPE_DICT = {
26
+ 1: "FUTURE",
27
+ 2: "STOCK",
28
+ 3: "CREDIT",
29
+ 5: "FUTURE_OPTION",
30
+ 6: "STOCK_OPTION",
31
+ 7: "HUGANGTONG",
32
+ 8: "INCOME_SWAP",
33
+ 10: "NEW3BOARD",
34
+ 11: "SHENGANGTONG",
35
+ 13: "OFFSITEBANKING",
36
+ 1001: "OUTTER_FUTURE",
37
+ 1002: "IB",
38
+ 15001: "NS_TRUSTBANK",
39
+ 15002: "INTERBANK",
40
+ 15003: "BANK",
41
+ 15005: "OTC",
42
+ }
43
+
44
+ STOCK_BUY = 23
45
+ STOCK_SELL = 24
46
+ CREDIT_BUY = 23
47
+ CREDIT_SELL = 24
48
+ CREDIT_FIN_BUY = 27
49
+ CREDIT_SLO_SELL = 28
50
+ CREDIT_BUY_SECU_REPAY = 29
51
+ CREDIT_DIRECT_SECU_REPAY = 30
52
+ CREDIT_SELL_SECU_REPAY = 31
53
+ CREDIT_DIRECT_CASH_REPAY = 32
54
+ CREDIT_FIN_BUY_SPECIAL = 40
55
+ CREDIT_SLO_SELL_SPECIAL = 41
56
+ CREDIT_BUY_SECU_REPAY_SPECIAL = 42
57
+ CREDIT_DIRECT_SECU_REPAY_SPECIAL = 43
58
+ CREDIT_SELL_SECU_REPAY_SPECIAL = 44
59
+ CREDIT_DIRECT_CASH_REPAY_SPECIAL = 45
60
+ FUTURE_OPEN_LONG = 0
61
+ FUTURE_CLOSE_LONG_HISTORY = 1
62
+ FUTURE_CLOSE_LONG_TODAY = 2
63
+ FUTURE_OPEN_SHORT = 3
64
+ FUTURE_CLOSE_SHORT_HISTORY = 4
65
+ FUTURE_CLOSE_SHORT_TODAY = 5
66
+ FUTURE_CLOSE_LONG_TODAY_FIRST = 6
67
+ FUTURE_CLOSE_LONG_HISTORY_FIRST = 7
68
+ FUTURE_CLOSE_SHORT_TODAY_FIRST = 8
69
+ FUTURE_CLOSE_SHORT_HISTORY_FIRST = 9
70
+ FUTURE_CLOSE_LONG_TODAY_HISTORY_THEN_OPEN_SHORT = 10
71
+ FUTURE_CLOSE_LONG_HISTORY_TODAY_THEN_OPEN_SHORT = 11
72
+ FUTURE_CLOSE_SHORT_TODAY_HISTORY_THEN_OPEN_LONG = 12
73
+ FUTURE_CLOSE_SHORT_HISTORY_TODAY_THEN_OPEN_LONG = 13
74
+ FUTURE_OPEN = 14
75
+ FUTURE_CLOSE = 15
76
+ FUTURE_ARBITRAGE_OPEN = 16
77
+ FUTURE_ARBITRAGE_CLOSE_HISTORY_FIRST = 17
78
+ FUTURE_ARBITRAGE_CLOSE_TODAY_FIRST = 18
79
+ FUTURE_RENEW_LONG_CLOSE_HISTORY_FIRST = 19
80
+ FUTURE_RENEW_LONG_CLOSE_TODAY_FIRST = 20
81
+ FUTURE_RENEW_SHORT_CLOSE_HISTORY_FIRST = 21
82
+ FUTURE_RENEW_SHORT_CLOSE_TODAY_FIRST = 22
83
+ STOCK_OPTION_BUY_OPEN = 48
84
+ STOCK_OPTION_SELL_CLOSE = 49
85
+ STOCK_OPTION_SELL_OPEN = 50
86
+ STOCK_OPTION_BUY_CLOSE = 51
87
+ STOCK_OPTION_COVERED_OPEN = 52
88
+ STOCK_OPTION_COVERED_CLOSE = 53
89
+ STOCK_OPTION_CALL_EXERCISE = 54
90
+ STOCK_OPTION_PUT_EXERCISE = 55
91
+ STOCK_OPTION_SECU_LOCK = 56
92
+ STOCK_OPTION_SECU_UNLOCK = 57
93
+ OPTION_FUTURE_OPTION_EXERCISE = 100
94
+ COMPOSE_OPEN_LONG = 110
95
+ COMPOSE_OPEN_SHORT = 111
96
+ COMPOSE_CLOSE_LONG_TODAY_FIRST = 112
97
+ COMPOSE_CLOSE_LONG_HISTORY_FIRST = 113
98
+ COMPOSE_CLOSE_SHORT_TODAY_FIRST = 114
99
+ COMPOSE_CLOSE_SHORT_HISTORY_FIRST = 115
100
+ COMPOSE_ONEKEY_FUTURE_TODAY_FIRST = 116
101
+ COMPOSE_ONEKEY_FUTURE_HISTORY_FIRST = 117
102
+ COMPOSE_FUTURE_ADJUST_TODAY_FIRST = 118
103
+ COMPOSE_FUTURE_ADJUST_HISTORY_FIRST = 119
104
+ COMPOSE_OPTION_COMB_EXERCISE = 137
105
+ COMPOSE_OPTION_BUILD_COMB_STRATEGY = 138
106
+ COMPOSE_OPTION_RELEASE_COMB_STRATEGY = 139
107
+ FUTURE_HEDGE = 400
108
+ ETF_PURCHASE = 134
109
+ ETF_REDEMPTION = 135
110
+ ORDER_TYPE_SET = {
111
+ STOCK_BUY,
112
+ STOCK_SELL,
113
+ CREDIT_BUY,
114
+ CREDIT_SELL,
115
+ CREDIT_FIN_BUY,
116
+ CREDIT_SLO_SELL,
117
+ CREDIT_BUY_SECU_REPAY,
118
+ CREDIT_DIRECT_SECU_REPAY,
119
+ CREDIT_SELL_SECU_REPAY,
120
+ CREDIT_DIRECT_CASH_REPAY,
121
+ CREDIT_FIN_BUY_SPECIAL,
122
+ CREDIT_SLO_SELL_SPECIAL,
123
+ CREDIT_BUY_SECU_REPAY_SPECIAL,
124
+ CREDIT_DIRECT_SECU_REPAY_SPECIAL,
125
+ CREDIT_SELL_SECU_REPAY_SPECIAL,
126
+ CREDIT_DIRECT_CASH_REPAY_SPECIAL,
127
+ }
128
+
129
+ FIX_PRICE = 11
130
+ LATEST_PRICE = 5
131
+ PRTP_FIX = FIX_PRICE
132
+ PRTP_LATEST = LATEST_PRICE
133
+ PRTP_MARKET = 12
134
+
135
+ MARKET_SHANGHAI = "SH"
136
+ MARKET_SHENZHEN = "SZ"
137
+ MARKET_BEIJING = "BJ"
138
+ MARKET_SHANGHAI_FUTURE = "SF"
139
+ MARKET_DALIANG_FUTURE = "DF"
140
+ MARKET_ZHENGZHOU_FUTURE = "ZF"
141
+ MARKET_INDEX_FUTURE = "IF"
142
+ MARKET_INTL_ENERGY_FUTURE = "INE"
143
+ MARKET_GUANGZHOU_FUTURE = "GF"
144
+ MARKET_SHANGHAI_STOCK_OPTION = "SHO"
145
+ MARKET_SHENZHEN_STOCK_OPTION = "SZO"
146
+ SH_MARKET = 0
147
+ SZ_MARKET = 1
148
+ MARKET_ENUM_INDEX_FUTURE = 2
149
+ MARKET_ENUM_SHANGHAI_FUTURE = 3
150
+ MARKET_ENUM_DALIANG_FUTURE = 4
151
+ MARKET_ENUM_ZHENGZHOU_FUTURE = 5
152
+ MARKET_ENUM_INTL_ENERGY_FUTURE = 6
153
+ MARKET_ENUM_SHANGHAI_STOCK_OPTION = 7
154
+ MARKET_ENUM_SHENZHEN_STOCK_OPTION = 67
155
+ MARKET_ENUM_BEIJING = 70
156
+ MARKET_ENUM_GUANGZHOU_FUTURE = 75
157
+ MARKET_STR_TO_ENUM_MAPPING = {
158
+ "SH": SH_MARKET,
159
+ "SZ": SZ_MARKET,
160
+ "BJ": MARKET_ENUM_BEIJING,
161
+ "SF": MARKET_ENUM_SHANGHAI_FUTURE,
162
+ "DF": MARKET_ENUM_DALIANG_FUTURE,
163
+ "ZF": MARKET_ENUM_ZHENGZHOU_FUTURE,
164
+ "IF": MARKET_ENUM_INDEX_FUTURE,
165
+ "INE": MARKET_ENUM_INTL_ENERGY_FUTURE,
166
+ "GF": MARKET_ENUM_GUANGZHOU_FUTURE,
167
+ "SHO": MARKET_ENUM_SHANGHAI_STOCK_OPTION,
168
+ "SZO": MARKET_ENUM_SHENZHEN_STOCK_OPTION,
169
+ }
170
+
171
+ MARKET_BEST = 18
172
+ MARKET_CANCEL = 19
173
+ MARKET_CANCEL_ALL = 20
174
+ MARKET_CANCEL_1 = 21
175
+ MARKET_CANCEL_5 = 22
176
+ MARKET_CONVERT_1 = 23
177
+ MARKET_CONVERT_5 = 24
178
+ MARKET_PEER_PRICE_FIRST = 44
179
+ MARKET_MINE_PRICE_FIRST = 45
180
+ MARKET_SZ_INSTBUSI_RESTCANCEL = 46
181
+ MARKET_SZ_CONVERT_5_CANCEL = 47
182
+ MARKET_SZ_FULL_OR_CANCEL = 48
183
+ MARKET_SH_CONVERT_5_CANCEL = 42
184
+ MARKET_SH_CONVERT_5_LIMIT = 43
185
+
186
+ ORDER_UNREPORTED = 48
187
+ ORDER_WAIT_REPORTING = 49
188
+ ORDER_REPORTED = 50
189
+ ORDER_REPORTED_CANCEL = 51
190
+ ORDER_PARTSUCC_CANCEL = 52
191
+ ORDER_PART_CANCEL = 53
192
+ ORDER_CANCELED = 54
193
+ ORDER_PART_SUCC = 55
194
+ ORDER_SUCCEEDED = 56
195
+ ORDER_JUNK = 57
196
+ ORDER_UNKNOWN = 255
197
+
198
+ DIRECTION_FLAG_BUY = 48
199
+ DIRECTION_FLAG_SELL = 49
200
+ DIRECTION_FLAG_LONG = 48
201
+ DIRECTION_FLAG_SHORT = 49
202
+ OFFSET_FLAG_OPEN = 48
203
+ OFFSET_FLAG_CLOSE = 49
204
+ OFFSET_FLAG_FORCECLOSE = 50
205
+ OFFSET_FLAG_CLOSETODAY = 51
206
+ OFFSET_FLAG_FORCEOFF = 53
207
+ OFFSET_FLAG_LOCALFORCECLOSE = 54
208
+
209
+ ACCOUNT_STATUS_OK = 0
210
+ ACCOUNT_STATUS_WAITING_LOGIN = 1
211
+ ACCOUNT_STATUSING = 2
212
+ ACCOUNT_STATUS_FAIL = 3
213
+ ACCOUNT_STATUS_INITING = 4
214
+ ACCOUNT_STATUS_CORRECTING = 5
215
+ ACCOUNT_STATUS_CLOSED = 6
216
+ ACCOUNT_STATUS_ASSIS_FAIL = 7
217
+ ACCOUNT_STATUS_DISABLEBYSYS = 8
218
+ ACCOUNT_STATUS_DISABLEBYUSER = 9
219
+ ACCOUNT_STATUS_INVALID = -1
220
+
221
+
222
+ _UPSTREAM_XTCONSTANT = None
223
+ _UPSTREAM_XTCONSTANT_LOADED = False
224
+
225
+
226
+ def _upstream_xtconstant_module():
227
+ global _UPSTREAM_XTCONSTANT
228
+ global _UPSTREAM_XTCONSTANT_LOADED
229
+ if _UPSTREAM_XTCONSTANT_LOADED:
230
+ return _UPSTREAM_XTCONSTANT
231
+ _UPSTREAM_XTCONSTANT_LOADED = True
232
+ try:
233
+ with contextlib.redirect_stdout(io.StringIO()), contextlib.redirect_stderr(io.StringIO()):
234
+ _UPSTREAM_XTCONSTANT = importlib.import_module("xtquant.xtconstant")
235
+ except Exception:
236
+ _UPSTREAM_XTCONSTANT = None
237
+ return _UPSTREAM_XTCONSTANT
238
+
239
+
240
+ def _load_upstream_xtquant_constants():
241
+ module = _upstream_xtconstant_module()
242
+ if module is None:
243
+ return
244
+ for name in dir(module):
245
+ if not name.isupper() or name.startswith("_") or name in globals():
246
+ continue
247
+ try:
248
+ globals()[name] = getattr(module, name)
249
+ except Exception:
250
+ pass
251
+
252
+
253
+ def __getattr__(name):
254
+ if name.isupper() and not name.startswith("_"):
255
+ module = _upstream_xtconstant_module()
256
+ if module is not None and hasattr(module, name):
257
+ value = getattr(module, name)
258
+ globals()[name] = value
259
+ return value
260
+ raise AttributeError("module %r has no attribute %r" % (__name__, name))
261
+
262
+ __all__ = sorted(name for name in globals() if name.isupper() and not name.startswith("_"))