ctpbee-opt-api 0.1.0__cp310-cp310-win_amd64.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 (414) hide show
  1. ctpbee_api/__init__.py +17 -0
  2. ctpbee_api/ctp/__init__.py +3 -0
  3. ctpbee_api/ctp/ctp_constant.py +1253 -0
  4. ctpbee_api/ctp/generator/concat.py +93 -0
  5. ctpbee_api/ctp/generator/const.py +325 -0
  6. ctpbee_api/ctp/generator/ctp_constant.py +1274 -0
  7. ctpbee_api/ctp/generator/ctp_md_header_define.h +13 -0
  8. ctpbee_api/ctp/generator/ctp_md_header_function.h +6 -0
  9. ctpbee_api/ctp/generator/ctp_md_header_on.h +26 -0
  10. ctpbee_api/ctp/generator/ctp_md_header_process.h +26 -0
  11. ctpbee_api/ctp/generator/ctp_md_source_function.cpp +42 -0
  12. ctpbee_api/ctp/generator/ctp_md_source_module.cpp +18 -0
  13. ctpbee_api/ctp/generator/ctp_md_source_on.cpp +156 -0
  14. ctpbee_api/ctp/generator/ctp_md_source_process.cpp +282 -0
  15. ctpbee_api/ctp/generator/ctp_md_source_switch.cpp +78 -0
  16. ctpbee_api/ctp/generator/ctp_md_source_task.cpp +211 -0
  17. ctpbee_api/ctp/generator/ctp_struct.py +5640 -0
  18. ctpbee_api/ctp/generator/ctp_td_header_define.h +130 -0
  19. ctpbee_api/ctp/generator/ctp_td_header_function.h +174 -0
  20. ctpbee_api/ctp/generator/ctp_td_header_on.h +260 -0
  21. ctpbee_api/ctp/generator/ctp_td_header_process.h +260 -0
  22. ctpbee_api/ctp/generator/ctp_td_source_function.cpp +1456 -0
  23. ctpbee_api/ctp/generator/ctp_td_source_module.cpp +222 -0
  24. ctpbee_api/ctp/generator/ctp_td_source_on.cpp +1572 -0
  25. ctpbee_api/ctp/generator/ctp_td_source_process.cpp +5472 -0
  26. ctpbee_api/ctp/generator/ctp_td_source_switch.cpp +780 -0
  27. ctpbee_api/ctp/generator/ctp_td_source_task.cpp +2444 -0
  28. ctpbee_api/ctp/generator/ctp_typedef.py +800 -0
  29. ctpbee_api/ctp/generator/generate_api_functions.py +345 -0
  30. ctpbee_api/ctp/generator/generate_data_type.py +76 -0
  31. ctpbee_api/ctp/generator/generate_struct.py +84 -0
  32. ctpbee_api/ctp/include/mac/ctp/ThostFtdcMdApi.h +168 -0
  33. ctpbee_api/ctp/include/mac/ctp/ThostFtdcTraderApi.h +770 -0
  34. ctpbee_api/ctp/include/mac/ctp/ThostFtdcUserApiDataType.h +6878 -0
  35. ctpbee_api/ctp/include/mac/ctp/ThostFtdcUserApiStruct.h +10915 -0
  36. ctpbee_api/ctp/include/mac/pybind11/attr.h +690 -0
  37. ctpbee_api/ctp/include/mac/pybind11/buffer_info.h +208 -0
  38. ctpbee_api/ctp/include/mac/pybind11/cast.h +1704 -0
  39. ctpbee_api/ctp/include/mac/pybind11/chrono.h +225 -0
  40. ctpbee_api/ctp/include/mac/pybind11/common.h +2 -0
  41. ctpbee_api/ctp/include/mac/pybind11/complex.h +74 -0
  42. ctpbee_api/ctp/include/mac/pybind11/detail/class.h +743 -0
  43. ctpbee_api/ctp/include/mac/pybind11/detail/common.h +1255 -0
  44. ctpbee_api/ctp/include/mac/pybind11/detail/descr.h +171 -0
  45. ctpbee_api/ctp/include/mac/pybind11/detail/init.h +434 -0
  46. ctpbee_api/ctp/include/mac/pybind11/detail/internals.h +656 -0
  47. ctpbee_api/ctp/include/mac/pybind11/detail/type_caster_base.h +1177 -0
  48. ctpbee_api/ctp/include/mac/pybind11/detail/typeid.h +65 -0
  49. ctpbee_api/ctp/include/mac/pybind11/eigen/common.h +9 -0
  50. ctpbee_api/ctp/include/mac/pybind11/eigen/matrix.h +714 -0
  51. ctpbee_api/ctp/include/mac/pybind11/eigen/tensor.h +516 -0
  52. ctpbee_api/ctp/include/mac/pybind11/eigen.h +12 -0
  53. ctpbee_api/ctp/include/mac/pybind11/embed.h +316 -0
  54. ctpbee_api/ctp/include/mac/pybind11/eval.h +156 -0
  55. ctpbee_api/ctp/include/mac/pybind11/functional.h +137 -0
  56. ctpbee_api/ctp/include/mac/pybind11/gil.h +239 -0
  57. ctpbee_api/ctp/include/mac/pybind11/iostream.h +265 -0
  58. ctpbee_api/ctp/include/mac/pybind11/numpy.h +1998 -0
  59. ctpbee_api/ctp/include/mac/pybind11/operators.h +202 -0
  60. ctpbee_api/ctp/include/mac/pybind11/options.h +92 -0
  61. ctpbee_api/ctp/include/mac/pybind11/pybind11.h +2890 -0
  62. ctpbee_api/ctp/include/mac/pybind11/pytypes.h +2557 -0
  63. ctpbee_api/ctp/include/mac/pybind11/stl/filesystem.h +116 -0
  64. ctpbee_api/ctp/include/mac/pybind11/stl.h +447 -0
  65. ctpbee_api/ctp/include/mac/pybind11/stl_bind.h +851 -0
  66. ctpbee_api/ctp/include/mac/pybind11/type_caster_pyobject_ptr.h +61 -0
  67. ctpbee_api/ctp/include/new/ctp/ThostFtdcMdApi.h +168 -0
  68. ctpbee_api/ctp/include/new/ctp/ThostFtdcTraderApi.h +770 -0
  69. ctpbee_api/ctp/include/new/ctp/ThostFtdcUserApiDataType.h +6878 -0
  70. ctpbee_api/ctp/include/new/ctp/ThostFtdcUserApiStruct.h +10915 -0
  71. ctpbee_api/ctp/include/new/pybind11/attr.h +690 -0
  72. ctpbee_api/ctp/include/new/pybind11/buffer_info.h +208 -0
  73. ctpbee_api/ctp/include/new/pybind11/cast.h +1704 -0
  74. ctpbee_api/ctp/include/new/pybind11/chrono.h +225 -0
  75. ctpbee_api/ctp/include/new/pybind11/common.h +2 -0
  76. ctpbee_api/ctp/include/new/pybind11/complex.h +74 -0
  77. ctpbee_api/ctp/include/new/pybind11/detail/class.h +743 -0
  78. ctpbee_api/ctp/include/new/pybind11/detail/common.h +1255 -0
  79. ctpbee_api/ctp/include/new/pybind11/detail/descr.h +171 -0
  80. ctpbee_api/ctp/include/new/pybind11/detail/init.h +434 -0
  81. ctpbee_api/ctp/include/new/pybind11/detail/internals.h +656 -0
  82. ctpbee_api/ctp/include/new/pybind11/detail/type_caster_base.h +1177 -0
  83. ctpbee_api/ctp/include/new/pybind11/detail/typeid.h +65 -0
  84. ctpbee_api/ctp/include/new/pybind11/eigen/common.h +9 -0
  85. ctpbee_api/ctp/include/new/pybind11/eigen/matrix.h +714 -0
  86. ctpbee_api/ctp/include/new/pybind11/eigen/tensor.h +516 -0
  87. ctpbee_api/ctp/include/new/pybind11/eigen.h +12 -0
  88. ctpbee_api/ctp/include/new/pybind11/embed.h +316 -0
  89. ctpbee_api/ctp/include/new/pybind11/eval.h +156 -0
  90. ctpbee_api/ctp/include/new/pybind11/functional.h +137 -0
  91. ctpbee_api/ctp/include/new/pybind11/gil.h +239 -0
  92. ctpbee_api/ctp/include/new/pybind11/iostream.h +265 -0
  93. ctpbee_api/ctp/include/new/pybind11/numpy.h +1998 -0
  94. ctpbee_api/ctp/include/new/pybind11/operators.h +202 -0
  95. ctpbee_api/ctp/include/new/pybind11/options.h +92 -0
  96. ctpbee_api/ctp/include/new/pybind11/pybind11.h +2890 -0
  97. ctpbee_api/ctp/include/new/pybind11/pytypes.h +2557 -0
  98. ctpbee_api/ctp/include/new/pybind11/stl/filesystem.h +116 -0
  99. ctpbee_api/ctp/include/new/pybind11/stl.h +447 -0
  100. ctpbee_api/ctp/include/new/pybind11/stl_bind.h +851 -0
  101. ctpbee_api/ctp/include/new/pybind11/type_caster_pyobject_ptr.h +61 -0
  102. ctpbee_api/ctp/include/previous/ctp/ThostFtdcMdApi.h +168 -0
  103. ctpbee_api/ctp/include/previous/ctp/ThostFtdcTraderApi.h +770 -0
  104. ctpbee_api/ctp/include/previous/ctp/ThostFtdcUserApiDataType.h +6878 -0
  105. ctpbee_api/ctp/include/previous/ctp/ThostFtdcUserApiStruct.h +10915 -0
  106. ctpbee_api/ctp/include/previous/pybind11/attr.h +489 -0
  107. ctpbee_api/ctp/include/previous/pybind11/buffer_info.h +108 -0
  108. ctpbee_api/ctp/include/previous/pybind11/cast.h +2067 -0
  109. ctpbee_api/ctp/include/previous/pybind11/chrono.h +162 -0
  110. ctpbee_api/ctp/include/previous/pybind11/common.h +2 -0
  111. ctpbee_api/ctp/include/previous/pybind11/complex.h +61 -0
  112. ctpbee_api/ctp/include/previous/pybind11/detail/class.h +626 -0
  113. ctpbee_api/ctp/include/previous/pybind11/detail/common.h +803 -0
  114. ctpbee_api/ctp/include/previous/pybind11/detail/descr.h +185 -0
  115. ctpbee_api/ctp/include/previous/pybind11/detail/init.h +335 -0
  116. ctpbee_api/ctp/include/previous/pybind11/detail/internals.h +285 -0
  117. ctpbee_api/ctp/include/previous/pybind11/detail/typeid.h +53 -0
  118. ctpbee_api/ctp/include/previous/pybind11/eigen.h +604 -0
  119. ctpbee_api/ctp/include/previous/pybind11/embed.h +194 -0
  120. ctpbee_api/ctp/include/previous/pybind11/eval.h +117 -0
  121. ctpbee_api/ctp/include/previous/pybind11/functional.h +85 -0
  122. ctpbee_api/ctp/include/previous/pybind11/iostream.h +200 -0
  123. ctpbee_api/ctp/include/previous/pybind11/numpy.h +1601 -0
  124. ctpbee_api/ctp/include/previous/pybind11/operators.h +168 -0
  125. ctpbee_api/ctp/include/previous/pybind11/options.h +65 -0
  126. ctpbee_api/ctp/include/previous/pybind11/pybind11.h +1965 -0
  127. ctpbee_api/ctp/include/previous/pybind11/pytypes.h +1332 -0
  128. ctpbee_api/ctp/include/previous/pybind11/stl.h +376 -0
  129. ctpbee_api/ctp/include/previous/pybind11/stl_bind.h +599 -0
  130. ctpbee_api/ctp/libs/libcomunicationkey.a +0 -0
  131. ctpbee_api/ctp/libs/libcrypto.a +0 -0
  132. ctpbee_api/ctp/libs/libssl.a +0 -0
  133. ctpbee_api/ctp/libs/thostmduserapi_se.lib +0 -0
  134. ctpbee_api/ctp/libs/thosttraderapi_se.lib +0 -0
  135. ctpbee_api/ctp/libthostmduserapi_se.so +0 -0
  136. ctpbee_api/ctp/libthosttraderapi_se.so +0 -0
  137. ctpbee_api/ctp/thostmduserapi_se.dll +0 -0
  138. ctpbee_api/ctp/thosttraderapi_se.dll +0 -0
  139. ctpbee_api/ctp/vnctp/vnctp.h +189 -0
  140. ctpbee_api/ctp/vnctp/vnctp.sln +41 -0
  141. ctpbee_api/ctp/vnctp/vnctpmd/dllmain.cpp +19 -0
  142. ctpbee_api/ctp/vnctp/vnctpmd/stdafx.cpp +1 -0
  143. ctpbee_api/ctp/vnctp/vnctpmd/stdafx.h +17 -0
  144. ctpbee_api/ctp/vnctp/vnctpmd/targetver.h +8 -0
  145. ctpbee_api/ctp/vnctp/vnctpmd/vnctpmd.cpp +953 -0
  146. ctpbee_api/ctp/vnctp/vnctpmd/vnctpmd.h +209 -0
  147. ctpbee_api/ctp/vnctp/vnctpmd/vnctpmd.vcxproj +200 -0
  148. ctpbee_api/ctp/vnctp/vnctpmd/vnctpmd.vcxproj.filters +54 -0
  149. ctpbee_api/ctp/vnctp/vnctpmd/vnctpmd.vcxproj.user +4 -0
  150. ctpbee_api/ctp/vnctp/vnctptd/dllmain.cpp +19 -0
  151. ctpbee_api/ctp/vnctp/vnctptd/stdafx.cpp +1 -0
  152. ctpbee_api/ctp/vnctp/vnctptd/stdafx.h +16 -0
  153. ctpbee_api/ctp/vnctp/vnctptd/targetver.h +8 -0
  154. ctpbee_api/ctp/vnctp/vnctptd/vnctptd.cpp +12148 -0
  155. ctpbee_api/ctp/vnctp/vnctptd/vnctptd.h +1329 -0
  156. ctpbee_api/ctp/vnctp/vnctptd/vnctptd.vcxproj +198 -0
  157. ctpbee_api/ctp/vnctp/vnctptd/vnctptd.vcxproj.filters +54 -0
  158. ctpbee_api/ctp/vnctp/vnctptd/vnctptd.vcxproj.user +4 -0
  159. ctpbee_api/ctp/vnctpmd.cp310-win_amd64.pyd +0 -0
  160. ctpbee_api/ctp/vnctptd.cp310-win_amd64.pyd +0 -0
  161. ctpbee_api/ctp_mini/__init__.py +3 -0
  162. ctpbee_api/ctp_mini/generator/generate_api_functions.py +343 -0
  163. ctpbee_api/ctp_mini/generator/generate_data_type.py +76 -0
  164. ctpbee_api/ctp_mini/generator/generate_struct.py +85 -0
  165. ctpbee_api/ctp_mini/generator/mini_constant.py +1186 -0
  166. ctpbee_api/ctp_mini/generator/mini_md_header_define.h +13 -0
  167. ctpbee_api/ctp_mini/generator/mini_md_header_function.h +4 -0
  168. ctpbee_api/ctp_mini/generator/mini_md_header_on.h +26 -0
  169. ctpbee_api/ctp_mini/generator/mini_md_header_process.h +26 -0
  170. ctpbee_api/ctp_mini/generator/mini_md_source_function.cpp +29 -0
  171. ctpbee_api/ctp_mini/generator/mini_md_source_module.cpp +17 -0
  172. ctpbee_api/ctp_mini/generator/mini_md_source_on.cpp +156 -0
  173. ctpbee_api/ctp_mini/generator/mini_md_source_process.cpp +264 -0
  174. ctpbee_api/ctp_mini/generator/mini_md_source_switch.cpp +78 -0
  175. ctpbee_api/ctp_mini/generator/mini_md_source_task.cpp +203 -0
  176. ctpbee_api/ctp_mini/generator/mini_struct.py +4599 -0
  177. ctpbee_api/ctp_mini/generator/mini_td_header_define.h +63 -0
  178. ctpbee_api/ctp_mini/generator/mini_td_header_function.h +84 -0
  179. ctpbee_api/ctp_mini/generator/mini_td_header_on.h +126 -0
  180. ctpbee_api/ctp_mini/generator/mini_td_header_process.h +126 -0
  181. ctpbee_api/ctp_mini/generator/mini_td_source_function.cpp +663 -0
  182. ctpbee_api/ctp_mini/generator/mini_td_source_module.cpp +107 -0
  183. ctpbee_api/ctp_mini/generator/mini_td_source_on.cpp +756 -0
  184. ctpbee_api/ctp_mini/generator/mini_td_source_process.cpp +2492 -0
  185. ctpbee_api/ctp_mini/generator/mini_td_source_switch.cpp +378 -0
  186. ctpbee_api/ctp_mini/generator/mini_td_source_task.cpp +1193 -0
  187. ctpbee_api/ctp_mini/generator/mini_typedef.py +755 -0
  188. ctpbee_api/ctp_mini/generator/package/vnminimd.cpp +886 -0
  189. ctpbee_api/ctp_mini/generator/package/vnminimd.h +205 -0
  190. ctpbee_api/ctp_mini/include/new/mini/ThostFtdcMdApi.h +148 -0
  191. ctpbee_api/ctp_mini/include/new/mini/ThostFtdcTraderApi.h +419 -0
  192. ctpbee_api/ctp_mini/include/new/mini/ThostFtdcUserApiDataType.h +6458 -0
  193. ctpbee_api/ctp_mini/include/new/mini/ThostFtdcUserApiStruct.h +8890 -0
  194. ctpbee_api/ctp_mini/include/new/pybind11/attr.h +690 -0
  195. ctpbee_api/ctp_mini/include/new/pybind11/buffer_info.h +208 -0
  196. ctpbee_api/ctp_mini/include/new/pybind11/cast.h +1704 -0
  197. ctpbee_api/ctp_mini/include/new/pybind11/chrono.h +225 -0
  198. ctpbee_api/ctp_mini/include/new/pybind11/common.h +2 -0
  199. ctpbee_api/ctp_mini/include/new/pybind11/complex.h +74 -0
  200. ctpbee_api/ctp_mini/include/new/pybind11/detail/class.h +743 -0
  201. ctpbee_api/ctp_mini/include/new/pybind11/detail/common.h +1255 -0
  202. ctpbee_api/ctp_mini/include/new/pybind11/detail/descr.h +171 -0
  203. ctpbee_api/ctp_mini/include/new/pybind11/detail/init.h +434 -0
  204. ctpbee_api/ctp_mini/include/new/pybind11/detail/internals.h +656 -0
  205. ctpbee_api/ctp_mini/include/new/pybind11/detail/type_caster_base.h +1177 -0
  206. ctpbee_api/ctp_mini/include/new/pybind11/detail/typeid.h +65 -0
  207. ctpbee_api/ctp_mini/include/new/pybind11/eigen/common.h +9 -0
  208. ctpbee_api/ctp_mini/include/new/pybind11/eigen/matrix.h +714 -0
  209. ctpbee_api/ctp_mini/include/new/pybind11/eigen/tensor.h +516 -0
  210. ctpbee_api/ctp_mini/include/new/pybind11/eigen.h +12 -0
  211. ctpbee_api/ctp_mini/include/new/pybind11/embed.h +316 -0
  212. ctpbee_api/ctp_mini/include/new/pybind11/eval.h +156 -0
  213. ctpbee_api/ctp_mini/include/new/pybind11/functional.h +137 -0
  214. ctpbee_api/ctp_mini/include/new/pybind11/gil.h +239 -0
  215. ctpbee_api/ctp_mini/include/new/pybind11/iostream.h +265 -0
  216. ctpbee_api/ctp_mini/include/new/pybind11/numpy.h +1998 -0
  217. ctpbee_api/ctp_mini/include/new/pybind11/operators.h +202 -0
  218. ctpbee_api/ctp_mini/include/new/pybind11/options.h +92 -0
  219. ctpbee_api/ctp_mini/include/new/pybind11/pybind11.h +2890 -0
  220. ctpbee_api/ctp_mini/include/new/pybind11/pytypes.h +2557 -0
  221. ctpbee_api/ctp_mini/include/new/pybind11/stl/filesystem.h +116 -0
  222. ctpbee_api/ctp_mini/include/new/pybind11/stl.h +447 -0
  223. ctpbee_api/ctp_mini/include/new/pybind11/stl_bind.h +851 -0
  224. ctpbee_api/ctp_mini/include/new/pybind11/type_caster_pyobject_ptr.h +61 -0
  225. ctpbee_api/ctp_mini/include/previous/mini/ThostFtdcMdApi.h +148 -0
  226. ctpbee_api/ctp_mini/include/previous/mini/ThostFtdcTraderApi.h +419 -0
  227. ctpbee_api/ctp_mini/include/previous/mini/ThostFtdcUserApiDataType.h +6458 -0
  228. ctpbee_api/ctp_mini/include/previous/mini/ThostFtdcUserApiStruct.h +8890 -0
  229. ctpbee_api/ctp_mini/include/previous/pybind11/attr.h +489 -0
  230. ctpbee_api/ctp_mini/include/previous/pybind11/buffer_info.h +108 -0
  231. ctpbee_api/ctp_mini/include/previous/pybind11/cast.h +2067 -0
  232. ctpbee_api/ctp_mini/include/previous/pybind11/chrono.h +162 -0
  233. ctpbee_api/ctp_mini/include/previous/pybind11/common.h +2 -0
  234. ctpbee_api/ctp_mini/include/previous/pybind11/complex.h +61 -0
  235. ctpbee_api/ctp_mini/include/previous/pybind11/detail/class.h +626 -0
  236. ctpbee_api/ctp_mini/include/previous/pybind11/detail/common.h +803 -0
  237. ctpbee_api/ctp_mini/include/previous/pybind11/detail/descr.h +185 -0
  238. ctpbee_api/ctp_mini/include/previous/pybind11/detail/init.h +335 -0
  239. ctpbee_api/ctp_mini/include/previous/pybind11/detail/internals.h +285 -0
  240. ctpbee_api/ctp_mini/include/previous/pybind11/detail/typeid.h +53 -0
  241. ctpbee_api/ctp_mini/include/previous/pybind11/eigen.h +604 -0
  242. ctpbee_api/ctp_mini/include/previous/pybind11/embed.h +194 -0
  243. ctpbee_api/ctp_mini/include/previous/pybind11/eval.h +117 -0
  244. ctpbee_api/ctp_mini/include/previous/pybind11/functional.h +85 -0
  245. ctpbee_api/ctp_mini/include/previous/pybind11/iostream.h +200 -0
  246. ctpbee_api/ctp_mini/include/previous/pybind11/numpy.h +1601 -0
  247. ctpbee_api/ctp_mini/include/previous/pybind11/operators.h +168 -0
  248. ctpbee_api/ctp_mini/include/previous/pybind11/options.h +65 -0
  249. ctpbee_api/ctp_mini/include/previous/pybind11/pybind11.h +1965 -0
  250. ctpbee_api/ctp_mini/include/previous/pybind11/pytypes.h +1332 -0
  251. ctpbee_api/ctp_mini/include/previous/pybind11/stl.h +376 -0
  252. ctpbee_api/ctp_mini/include/previous/pybind11/stl_bind.h +599 -0
  253. ctpbee_api/ctp_mini/libs/thostmduserapi.lib +0 -0
  254. ctpbee_api/ctp_mini/libs/thosttraderapi.lib +0 -0
  255. ctpbee_api/ctp_mini/libthostmduserapi.so +0 -0
  256. ctpbee_api/ctp_mini/libthosttraderapi.so +0 -0
  257. ctpbee_api/ctp_mini/mini_constant.py +1186 -0
  258. ctpbee_api/ctp_mini/thostmduserapi.dll +0 -0
  259. ctpbee_api/ctp_mini/thosttraderapi.dll +0 -0
  260. ctpbee_api/ctp_mini/vnctp_mini/vnctp_mini.h +146 -0
  261. ctpbee_api/ctp_mini/vnctp_mini/vnctp_mini.sln +41 -0
  262. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/dllmain.cpp +0 -0
  263. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/stdafx.cpp +0 -0
  264. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/stdafx.h +0 -0
  265. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/targetver.h +0 -0
  266. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/vnctp_minimd.cpp +886 -0
  267. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/vnctp_minimd.h +203 -0
  268. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/vnctp_minimd.vcxproj +183 -0
  269. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/vnctp_minimd.vcxproj.filters +54 -0
  270. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/vnctp_minimd.vcxproj.user +4 -0
  271. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/dllmain.cpp +0 -0
  272. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/stdafx.cpp +0 -0
  273. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/stdafx.h +0 -0
  274. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/targetver.h +0 -0
  275. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/vnctp_minitd.cpp +5716 -0
  276. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/vnctp_minitd.h +680 -0
  277. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/vnctp_minitd.vcxproj +180 -0
  278. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/vnctp_minitd.vcxproj.filters +54 -0
  279. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/vnctp_minitd.vcxproj.user +4 -0
  280. ctpbee_api/ctp_mini/vnctp_minimd.cp310-win_amd64.pyd +0 -0
  281. ctpbee_api/ctp_mini/vnctp_minitd.cp310-win_amd64.pyd +0 -0
  282. ctpbee_api/ctp_mini/vnctp_minitd.lib +0 -0
  283. ctpbee_api/rohon/RohonBaseV64.dll +0 -0
  284. ctpbee_api/rohon/WinDataCollect.dll +0 -0
  285. ctpbee_api/rohon/__init__.py +3 -0
  286. ctpbee_api/rohon/generator/generate_api_functions.py +348 -0
  287. ctpbee_api/rohon/generator/generate_data_type.py +76 -0
  288. ctpbee_api/rohon/generator/generate_struct.py +84 -0
  289. ctpbee_api/rohon/generator/rohon_constant.py +1242 -0
  290. ctpbee_api/rohon/generator/rohon_md_header_define.h +13 -0
  291. ctpbee_api/rohon/generator/rohon_md_header_function.h +6 -0
  292. ctpbee_api/rohon/generator/rohon_md_header_on.h +26 -0
  293. ctpbee_api/rohon/generator/rohon_md_header_process.h +26 -0
  294. ctpbee_api/rohon/generator/rohon_md_source_function.cpp +40 -0
  295. ctpbee_api/rohon/generator/rohon_md_source_module.cpp +18 -0
  296. ctpbee_api/rohon/generator/rohon_md_source_on.cpp +156 -0
  297. ctpbee_api/rohon/generator/rohon_md_source_process.cpp +271 -0
  298. ctpbee_api/rohon/generator/rohon_md_source_switch.cpp +78 -0
  299. ctpbee_api/rohon/generator/rohon_md_source_task.cpp +211 -0
  300. ctpbee_api/rohon/generator/rohon_struct.py +4958 -0
  301. ctpbee_api/rohon/generator/rohon_td_header_define.h +125 -0
  302. ctpbee_api/rohon/generator/rohon_td_header_function.h +164 -0
  303. ctpbee_api/rohon/generator/rohon_td_header_on.h +250 -0
  304. ctpbee_api/rohon/generator/rohon_td_header_process.h +250 -0
  305. ctpbee_api/rohon/generator/rohon_td_source_function.cpp +1338 -0
  306. ctpbee_api/rohon/generator/rohon_td_source_module.cpp +209 -0
  307. ctpbee_api/rohon/generator/rohon_td_source_on.cpp +1500 -0
  308. ctpbee_api/rohon/generator/rohon_td_source_process.cpp +5125 -0
  309. ctpbee_api/rohon/generator/rohon_td_source_switch.cpp +750 -0
  310. ctpbee_api/rohon/generator/rohon_td_source_task.cpp +2339 -0
  311. ctpbee_api/rohon/generator/rohon_typedef.py +781 -0
  312. ctpbee_api/rohon/include/new/pybind11/attr.h +690 -0
  313. ctpbee_api/rohon/include/new/pybind11/buffer_info.h +208 -0
  314. ctpbee_api/rohon/include/new/pybind11/cast.h +1704 -0
  315. ctpbee_api/rohon/include/new/pybind11/chrono.h +225 -0
  316. ctpbee_api/rohon/include/new/pybind11/common.h +2 -0
  317. ctpbee_api/rohon/include/new/pybind11/complex.h +74 -0
  318. ctpbee_api/rohon/include/new/pybind11/detail/class.h +743 -0
  319. ctpbee_api/rohon/include/new/pybind11/detail/common.h +1255 -0
  320. ctpbee_api/rohon/include/new/pybind11/detail/descr.h +171 -0
  321. ctpbee_api/rohon/include/new/pybind11/detail/init.h +434 -0
  322. ctpbee_api/rohon/include/new/pybind11/detail/internals.h +656 -0
  323. ctpbee_api/rohon/include/new/pybind11/detail/type_caster_base.h +1177 -0
  324. ctpbee_api/rohon/include/new/pybind11/detail/typeid.h +65 -0
  325. ctpbee_api/rohon/include/new/pybind11/eigen/common.h +9 -0
  326. ctpbee_api/rohon/include/new/pybind11/eigen/matrix.h +714 -0
  327. ctpbee_api/rohon/include/new/pybind11/eigen/tensor.h +516 -0
  328. ctpbee_api/rohon/include/new/pybind11/eigen.h +12 -0
  329. ctpbee_api/rohon/include/new/pybind11/embed.h +316 -0
  330. ctpbee_api/rohon/include/new/pybind11/eval.h +156 -0
  331. ctpbee_api/rohon/include/new/pybind11/functional.h +137 -0
  332. ctpbee_api/rohon/include/new/pybind11/gil.h +239 -0
  333. ctpbee_api/rohon/include/new/pybind11/iostream.h +265 -0
  334. ctpbee_api/rohon/include/new/pybind11/numpy.h +1998 -0
  335. ctpbee_api/rohon/include/new/pybind11/operators.h +202 -0
  336. ctpbee_api/rohon/include/new/pybind11/options.h +92 -0
  337. ctpbee_api/rohon/include/new/pybind11/pybind11.h +2890 -0
  338. ctpbee_api/rohon/include/new/pybind11/pytypes.h +2557 -0
  339. ctpbee_api/rohon/include/new/pybind11/stl/filesystem.h +116 -0
  340. ctpbee_api/rohon/include/new/pybind11/stl.h +447 -0
  341. ctpbee_api/rohon/include/new/pybind11/stl_bind.h +851 -0
  342. ctpbee_api/rohon/include/new/pybind11/type_caster_pyobject_ptr.h +61 -0
  343. ctpbee_api/rohon/include/new/rohon/ThostFtdcMdApi.h +168 -0
  344. ctpbee_api/rohon/include/new/rohon/ThostFtdcTraderApi.h +739 -0
  345. ctpbee_api/rohon/include/new/rohon/ThostFtdcUserApiDataType.h +6708 -0
  346. ctpbee_api/rohon/include/new/rohon/ThostFtdcUserApiStruct.h +9580 -0
  347. ctpbee_api/rohon/include/previous/pybind11/attr.h +489 -0
  348. ctpbee_api/rohon/include/previous/pybind11/buffer_info.h +108 -0
  349. ctpbee_api/rohon/include/previous/pybind11/cast.h +2067 -0
  350. ctpbee_api/rohon/include/previous/pybind11/chrono.h +162 -0
  351. ctpbee_api/rohon/include/previous/pybind11/common.h +2 -0
  352. ctpbee_api/rohon/include/previous/pybind11/complex.h +61 -0
  353. ctpbee_api/rohon/include/previous/pybind11/detail/class.h +626 -0
  354. ctpbee_api/rohon/include/previous/pybind11/detail/common.h +803 -0
  355. ctpbee_api/rohon/include/previous/pybind11/detail/descr.h +185 -0
  356. ctpbee_api/rohon/include/previous/pybind11/detail/init.h +335 -0
  357. ctpbee_api/rohon/include/previous/pybind11/detail/internals.h +285 -0
  358. ctpbee_api/rohon/include/previous/pybind11/detail/typeid.h +53 -0
  359. ctpbee_api/rohon/include/previous/pybind11/eigen.h +604 -0
  360. ctpbee_api/rohon/include/previous/pybind11/embed.h +194 -0
  361. ctpbee_api/rohon/include/previous/pybind11/eval.h +117 -0
  362. ctpbee_api/rohon/include/previous/pybind11/functional.h +85 -0
  363. ctpbee_api/rohon/include/previous/pybind11/iostream.h +200 -0
  364. ctpbee_api/rohon/include/previous/pybind11/numpy.h +1601 -0
  365. ctpbee_api/rohon/include/previous/pybind11/operators.h +168 -0
  366. ctpbee_api/rohon/include/previous/pybind11/options.h +65 -0
  367. ctpbee_api/rohon/include/previous/pybind11/pybind11.h +1965 -0
  368. ctpbee_api/rohon/include/previous/pybind11/pytypes.h +1332 -0
  369. ctpbee_api/rohon/include/previous/pybind11/stl.h +376 -0
  370. ctpbee_api/rohon/include/previous/pybind11/stl_bind.h +599 -0
  371. ctpbee_api/rohon/include/previous/rohon/ThostFtdcMdApi.h +168 -0
  372. ctpbee_api/rohon/include/previous/rohon/ThostFtdcTraderApi.h +739 -0
  373. ctpbee_api/rohon/include/previous/rohon/ThostFtdcUserApiDataType.h +6708 -0
  374. ctpbee_api/rohon/include/previous/rohon/ThostFtdcUserApiStruct.h +9580 -0
  375. ctpbee_api/rohon/libLinuxDataCollect.so +0 -0
  376. ctpbee_api/rohon/librohonbase.so +0 -0
  377. ctpbee_api/rohon/librohonbase.so.1.1 +0 -0
  378. ctpbee_api/rohon/librohonbase.so.1.1.0.1 +0 -0
  379. ctpbee_api/rohon/libs/thostmduserapi_se.lib +0 -0
  380. ctpbee_api/rohon/libs/thosttraderapi_se.lib +0 -0
  381. ctpbee_api/rohon/libthostmduserapi_se.so +0 -0
  382. ctpbee_api/rohon/libthosttraderapi_se.so +0 -0
  383. ctpbee_api/rohon/rohon_constant.py +1242 -0
  384. ctpbee_api/rohon/thostmduserapi_se.dll +0 -0
  385. ctpbee_api/rohon/thosttraderapi_se.dll +0 -0
  386. ctpbee_api/rohon/vnrohon/.vs/vnrohon/v15/.suo +0 -0
  387. ctpbee_api/rohon/vnrohon/.vs/vnrohon/v15/Browse.VC.db +0 -0
  388. ctpbee_api/rohon/vnrohon/.vs/vnrohon/v15/Solution.VC.db +0 -0
  389. ctpbee_api/rohon/vnrohon/vnrohon.h +147 -0
  390. ctpbee_api/rohon/vnrohon/vnrohon.sln +41 -0
  391. ctpbee_api/rohon/vnrohon/vnrohonmd/dllmain.cpp +19 -0
  392. ctpbee_api/rohon/vnrohon/vnrohonmd/framework.h +5 -0
  393. ctpbee_api/rohon/vnrohon/vnrohonmd/pch.cpp +5 -0
  394. ctpbee_api/rohon/vnrohon/vnrohonmd/pch.h +13 -0
  395. ctpbee_api/rohon/vnrohon/vnrohonmd/vnrohonmd.cpp +931 -0
  396. ctpbee_api/rohon/vnrohon/vnrohonmd/vnrohonmd.h +207 -0
  397. ctpbee_api/rohon/vnrohon/vnrohonmd/vnrohonmd.vcxproj +188 -0
  398. ctpbee_api/rohon/vnrohon/vnrohonmd/vnrohonmd.vcxproj.filters +54 -0
  399. ctpbee_api/rohon/vnrohon/vnrohonmd/vnrohonmd.vcxproj.user +4 -0
  400. ctpbee_api/rohon/vnrohon/vnrohontd/dllmain.cpp +19 -0
  401. ctpbee_api/rohon/vnrohon/vnrohontd/framework.h +5 -0
  402. ctpbee_api/rohon/vnrohon/vnrohontd/pch.cpp +5 -0
  403. ctpbee_api/rohon/vnrohon/vnrohontd/pch.h +13 -0
  404. ctpbee_api/rohon/vnrohon/vnrohontd/vnrohontd.cpp +11395 -0
  405. ctpbee_api/rohon/vnrohon/vnrohontd/vnrohontd.h +1259 -0
  406. ctpbee_api/rohon/vnrohon/vnrohontd/vnrohontd.vcxproj +188 -0
  407. ctpbee_api/rohon/vnrohon/vnrohontd/vnrohontd.vcxproj.filters +54 -0
  408. ctpbee_api/rohon/vnrohon/vnrohontd/vnrohontd.vcxproj.user +4 -0
  409. ctpbee_api/rohon/vnrohonmd.cp310-win_amd64.pyd +0 -0
  410. ctpbee_api/rohon/vnrohontd.cp310-win_amd64.pyd +0 -0
  411. ctpbee_opt_api-0.1.0.dist-info/METADATA +46 -0
  412. ctpbee_opt_api-0.1.0.dist-info/RECORD +414 -0
  413. ctpbee_opt_api-0.1.0.dist-info/WHEEL +5 -0
  414. ctpbee_opt_api-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,345 @@
1
+ """"""
2
+ import importlib
3
+
4
+
5
+ class ApiGenerator:
6
+ """API生成器"""""
7
+
8
+ def __init__(self, filename: str, prefix: str, name: str, class_name: str):
9
+ """Constructor"""
10
+ self.filename = filename
11
+ self.prefix = prefix
12
+ self.name = name
13
+ self.class_name = class_name
14
+
15
+ self.callbacks = {}
16
+ self.functions = {}
17
+ self.lines = {}
18
+
19
+ self.structs = {}
20
+ self.load_struct()
21
+
22
+ def load_struct(self):
23
+ """加载Struct"""
24
+ module_name = f"{self.prefix}_struct"
25
+ module = importlib.import_module(module_name)
26
+
27
+ for name in dir(module):
28
+ if "__" not in name:
29
+ self.structs[name] = getattr(module, name)
30
+
31
+ def run(self):
32
+ """运行生成"""
33
+ self.f_cpp = open(self.filename, "r")
34
+
35
+ for line in self.f_cpp:
36
+ self.process_line(line)
37
+
38
+ self.f_cpp.close()
39
+
40
+ self.generate_header_define()
41
+ self.generate_header_process()
42
+ self.generate_header_on()
43
+ self.generate_header_function()
44
+
45
+ self.generate_source_task()
46
+ self.generate_source_switch()
47
+ self.generate_source_process()
48
+ self.generate_source_function()
49
+ self.generate_source_on()
50
+ self.generate_source_module()
51
+
52
+ print("API生成成功")
53
+
54
+ def process_line(self, line: str):
55
+ """处理每行"""
56
+ line = line.replace(";", "")
57
+ line = line.replace("\n", "")
58
+ line = line.replace("\t", "")
59
+ line = line.replace("{}", "")
60
+
61
+ if "virtual void On" in line:
62
+ self.process_callback(line)
63
+ elif "virtual int Req" in line:
64
+ self.process_function(line)
65
+
66
+ def process_callback(self, line: str):
67
+ """处理回掉函数"""
68
+ name = line[line.index("On"):line.index("(")]
69
+ self.lines[name] = line
70
+
71
+ d = self.generate_arg_dict(line)
72
+ self.callbacks[name] = d
73
+
74
+ def process_function(self, line: str):
75
+ """处理主动函数"""
76
+ name = line[line.index("Req"):line.index("(")]
77
+
78
+ d = self.generate_arg_dict(line)
79
+ self.functions[name] = d
80
+
81
+ def generate_arg_dict(self, line: str):
82
+ """生成参数字典"""
83
+ args_str = line[line.index("(") + 1:line.index(")")]
84
+ if not args_str:
85
+ return {}
86
+ args = args_str.split(",")
87
+
88
+ d = {}
89
+ for arg in args:
90
+ words = arg.split(" ")
91
+ words = [word for word in words if word]
92
+ d[words[1].replace("*", "")] = words[0]
93
+ return d
94
+
95
+ def generate_header_define(self):
96
+ """"""
97
+ filename = f"{self.prefix}_{self.name}_header_define.h"
98
+ with open(filename, "w") as f:
99
+ for n, name in enumerate(self.callbacks.keys()):
100
+ line = f"#define {name.upper()} {n}\n"
101
+ f.write(line)
102
+
103
+ def generate_header_process(self):
104
+ """"""
105
+ filename = f"{self.prefix}_{self.name}_header_process.h"
106
+ with open(filename, "w") as f:
107
+ for name in self.callbacks.keys():
108
+ name = name.replace("On", "process")
109
+ line = f"void {name}(Task *task);\n\n"
110
+ f.write(line)
111
+
112
+ def generate_header_on(self):
113
+ """"""
114
+ filename = f"{self.prefix}_{self.name}_header_on.h"
115
+ with open(filename, "w") as f:
116
+ for name, d in self.callbacks.items():
117
+ name = name.replace("On", "on")
118
+
119
+ args_list = []
120
+ for type_ in d.values():
121
+ if type_ == "int":
122
+ args_list.append("int reqid")
123
+ elif type_ == "bool":
124
+ args_list.append("bool last")
125
+ elif type_ == "char*":
126
+ args_list.append("string data")
127
+ elif type_ == "CThostFtdcRspInfoField":
128
+ args_list.append("const dict &error")
129
+ else:
130
+ args_list.append("const dict &data")
131
+
132
+ args_str = ", ".join(args_list)
133
+ line = f"virtual void {name}({args_str}) {{}};\n\n"
134
+
135
+ f.write(line)
136
+
137
+ def generate_header_function(self):
138
+ """"""
139
+ filename = f"{self.prefix}_{self.name}_header_function.h"
140
+ with open(filename, "w") as f:
141
+ for name in self.functions.keys():
142
+ name = name.replace("Req", "req")
143
+ line = f"int {name}(const dict &req, int reqid);\n\n"
144
+ f.write(line)
145
+
146
+ def generate_source_task(self):
147
+ """"""
148
+ filename = f"{self.prefix}_{self.name}_source_task.cpp"
149
+ with open(filename, "w") as f:
150
+ for name, d in self.callbacks.items():
151
+ line = self.lines[name]
152
+
153
+ f.write(line.replace("virtual void ",
154
+ f"void {self.class_name}::") + "\n")
155
+ f.write("{\n")
156
+ f.write("\tTask task = Task();\n")
157
+ f.write(f"\ttask.task_name = {name.upper()};\n")
158
+
159
+ for field, type_ in d.items():
160
+ if type_ == "int":
161
+ f.write(f"\ttask.task_id = {field};\n")
162
+ elif type_ == "bool":
163
+ f.write(f"\ttask.task_last = {field};\n")
164
+ elif type_ == "CThostFtdcRspInfoField":
165
+ f.write(f"\tif ({field})\n")
166
+ f.write("\t{\n")
167
+ f.write(f"\t\t{type_} *task_error = new {type_}();\n")
168
+ f.write(f"\t\t*task_error = *{field};\n")
169
+ f.write(f"\t\ttask.task_error = task_error;\n")
170
+ f.write("\t}\n")
171
+ else:
172
+ f.write(f"\tif ({field})\n")
173
+ f.write("\t{\n")
174
+ f.write(f"\t\t{type_} *task_data = new {type_}();\n")
175
+ f.write(f"\t\t*task_data = *{field};\n")
176
+ f.write(f"\t\ttask.task_data = task_data;\n")
177
+ f.write("\t}\n")
178
+
179
+ f.write(f"\tthis->task_queue.push(task);\n")
180
+ f.write("};\n\n")
181
+
182
+ def generate_source_switch(self):
183
+ """"""
184
+ filename = f"{self.prefix}_{self.name}_source_switch.cpp"
185
+ with open(filename, "w") as f:
186
+ for name in self.callbacks.keys():
187
+ process_name = name.replace("On", "process")
188
+ f.write(f"case {name.upper()}:\n")
189
+ f.write("{\n")
190
+ f.write(f"\tthis->{process_name}(&task);\n")
191
+ f.write(f"\tbreak;\n")
192
+ f.write("}\n\n")
193
+
194
+ def generate_source_process(self):
195
+ """"""
196
+ filename = f"{self.prefix}_{self.name}_source_process.cpp"
197
+ with open(filename, "w") as f:
198
+ for name, d in self.callbacks.items():
199
+ process_name = name.replace("On", "process")
200
+ on_name = name.replace("On", "on")
201
+
202
+ f.write(
203
+ f"void {self.class_name}::{process_name}(Task *task)\n")
204
+ f.write("{\n")
205
+ f.write("\tgil_scoped_acquire acquire;\n")
206
+
207
+ args = []
208
+
209
+ for field, type_ in d.items():
210
+ if type_ == "int":
211
+ args.append("task->task_id")
212
+ elif type_ == "bool":
213
+ args.append("task->task_last")
214
+ elif type_ == "CThostFtdcRspInfoField":
215
+ args.append("error")
216
+
217
+ f.write("\tdict error;\n")
218
+ f.write("\tif (task->task_error)\n")
219
+ f.write("\t{\n")
220
+ f.write(
221
+ f"\t\t{type_} *task_error = ({type_}*)task->task_error;\n")
222
+
223
+ struct_fields = self.structs[type_]
224
+ for struct_field, struct_type in struct_fields.items():
225
+ if struct_type == "string":
226
+ f.write(
227
+ f"\t\terror[\"{struct_field}\"] = toUtf(task_error->{struct_field});\n")
228
+ else:
229
+ f.write(
230
+ f"\t\terror[\"{struct_field}\"] = task_error->{struct_field};\n")
231
+
232
+ f.write("\t\tdelete task_error;\n")
233
+ f.write("\t}\n")
234
+ else:
235
+ args.append("data")
236
+
237
+ f.write("\tdict data;\n")
238
+ f.write("\tif (task->task_data)\n")
239
+ f.write("\t{\n")
240
+ f.write(
241
+ f"\t\t{type_} *task_data = ({type_}*)task->task_data;\n")
242
+
243
+ struct_fields = self.structs[type_]
244
+ for struct_field, struct_type in struct_fields.items():
245
+ if struct_type == "string":
246
+ f.write(
247
+ f"\t\tdata[\"{struct_field}\"] = toUtf(task_data->{struct_field});\n")
248
+ else:
249
+ f.write(
250
+ f"\t\tdata[\"{struct_field}\"] = task_data->{struct_field};\n")
251
+
252
+ f.write("\t\tdelete task_data;\n")
253
+ f.write("\t}\n")
254
+
255
+ args_str = ", ".join(args)
256
+ f.write(f"\tthis->{on_name}({args_str});\n")
257
+ f.write("};\n\n")
258
+
259
+ def generate_source_function(self):
260
+ """"""
261
+ filename = f"{self.prefix}_{self.name}_source_function.cpp"
262
+ with open(filename, "w") as f:
263
+ for name, d in self.functions.items():
264
+ req_name = name.replace("Req", "req")
265
+ type_ = list(d.values())[0]
266
+
267
+ f.write(
268
+ f"int {self.class_name}::{req_name}(const dict &req, int reqid)\n")
269
+ f.write("{\n")
270
+ f.write(f"\t{type_} myreq = {type_}();\n")
271
+ f.write("\tmemset(&myreq, 0, sizeof(myreq));\n")
272
+
273
+ struct_fields = self.structs[type_]
274
+ for struct_field, struct_type in struct_fields.items():
275
+ if struct_type == "string":
276
+ line = f"\tgetString(req, \"{struct_field}\", myreq.{struct_field});\n"
277
+ else:
278
+ line = f"\tget{struct_type.capitalize()}(req, \"{struct_field}\", &myreq.{struct_field});\n"
279
+ f.write(line)
280
+
281
+ f.write(f"\tint i = this->api->{name}(&myreq, reqid);\n")
282
+ f.write("\treturn i;\n")
283
+ f.write("};\n\n")
284
+
285
+ def generate_source_on(self):
286
+ """"""
287
+ filename = f"{self.prefix}_{self.name}_source_on.cpp"
288
+ with open(filename, "w") as f:
289
+ for name, d in self.callbacks.items():
290
+ on_name = name.replace("On", "on")
291
+
292
+ args = []
293
+ bind_args = ["void", self.class_name, on_name]
294
+ for field, type_ in d.items():
295
+ if type_ == "int":
296
+ args.append("int reqid")
297
+ bind_args.append("reqid")
298
+ elif type_ == "bool":
299
+ args.append("bool last")
300
+ bind_args.append("last")
301
+ elif type_ == "CThostFtdcRspInfoField":
302
+ args.append("const dict &error")
303
+ bind_args.append("error")
304
+ else:
305
+ args.append("const dict &data")
306
+ bind_args.append("data")
307
+
308
+ args_str = ", ".join(args)
309
+ bind_args_str = ", ".join(bind_args)
310
+
311
+ f.write(f"void {on_name}({args_str}) override\n")
312
+ f.write("{\n")
313
+ f.write("\ttry\n")
314
+ f.write("\t{\n")
315
+ f.write(f"\t\tPYBIND11_OVERLOAD({bind_args_str});\n")
316
+ f.write("\t}\n")
317
+ f.write("\tcatch (const error_already_set &e)\n")
318
+ f.write("\t{\n")
319
+ f.write(f"\t\tcout << e.what() << endl;\n")
320
+ f.write("\t}\n")
321
+ f.write("};\n\n")
322
+
323
+ def generate_source_module(self):
324
+ """"""
325
+ filename = f"{self.prefix}_{self.name}_source_module.cpp"
326
+ with open(filename, "w") as f:
327
+ for name in self.functions.keys():
328
+ name = name.replace("Req", "req")
329
+ f.write(f".def(\"{name}\", &{self.class_name}::{name})\n")
330
+
331
+ f.write("\n")
332
+
333
+ for name in self.callbacks.keys():
334
+ name = name.replace("On", "on")
335
+ f.write(f".def(\"{name}\", &{self.class_name}::{name})\n")
336
+
337
+ f.write(";\n")
338
+
339
+
340
+ if __name__ == "__main__":
341
+ md_generator = ApiGenerator("../include/ctp/ThostFtdcMdApi.h", "ctp", "md", "MdApi")
342
+ md_generator.run()
343
+
344
+ td_generator = ApiGenerator("../include/ctp/ThostFtdcTraderApi.h", "ctp", "td", "TdApi")
345
+ td_generator.run()
@@ -0,0 +1,76 @@
1
+ """"""
2
+
3
+ TYPE_CPP2PY = {
4
+ "int": "int",
5
+ "char": "char",
6
+ "double": "double",
7
+ "short": "int",
8
+ }
9
+
10
+
11
+ class DataTypeGenerator:
12
+ """DataType生成器"""
13
+
14
+ def __init__(self, filename: str, prefix: str):
15
+ """Constructor"""
16
+ self.filename = filename
17
+ self.prefix = prefix
18
+
19
+ def run(self):
20
+ """主函数"""
21
+ self.f_cpp = open(self.filename, "r")
22
+ self.f_define = open(f"{self.prefix}_constant.py", "w")
23
+ self.f_typedef = open(f"{self.prefix}_typedef.py", "w")
24
+
25
+ for line in self.f_cpp:
26
+ self.process_line(line)
27
+
28
+ self.f_cpp.close()
29
+ self.f_define.close()
30
+ self.f_typedef.close()
31
+
32
+ print("DataType生成完毕")
33
+
34
+ def process_line(self, line: str):
35
+ """处理每行"""
36
+ line = line.replace("\n", "")
37
+ line = line.replace(";", "")
38
+
39
+ if line.startswith("#define"):
40
+ self.process_define(line)
41
+ elif line.startswith("typedef"):
42
+ self.process_typedef(line)
43
+
44
+ def process_define(self, line: str):
45
+ """处理常量定义"""
46
+ words = line.split(" ")
47
+ words = [word for word in words if word]
48
+ if len(words) < 3:
49
+ return
50
+
51
+ name = words[1]
52
+ value = words[2]
53
+
54
+ new_line = f"{name} = {value}\n"
55
+ self.f_define.write(new_line)
56
+
57
+ def process_typedef(self, line: str):
58
+ """处理类型定义"""
59
+ words = line.split(" ")
60
+ words = [word for word in words if word != " "]
61
+
62
+ name = words[2]
63
+ typedef = TYPE_CPP2PY[words[1]]
64
+
65
+ if typedef == "char":
66
+ if "[" in name:
67
+ typedef = "string"
68
+ name = name[:name.index("[")]
69
+
70
+ new_line = f"{name} = \"{typedef}\"\n"
71
+ self.f_typedef.write(new_line)
72
+
73
+
74
+ if __name__ == "__main__":
75
+ generator = DataTypeGenerator("../include/ctp/ThostFtdcUserApiDataType.h", "ctp")
76
+ generator.run()
@@ -0,0 +1,84 @@
1
+ """"""
2
+ import importlib
3
+
4
+
5
+ class StructGenerator:
6
+ """Struct生成器"""
7
+
8
+ def __init__(self, filename: str, prefix: str):
9
+ """Constructor"""
10
+ self.filename = filename
11
+ self.prefix = prefix
12
+ self.typedefs = {}
13
+
14
+ self.load_constant()
15
+
16
+ def load_constant(self):
17
+ """"""
18
+ module_name = f"{self.prefix}_typedef"
19
+ module = importlib.import_module(module_name)
20
+
21
+ for name in dir(module):
22
+ if "__" not in name:
23
+ self.typedefs[name] = getattr(module, name)
24
+
25
+ def run(self):
26
+ """运行生成"""
27
+ self.f_cpp = open(self.filename, "r")
28
+ self.f_struct = open(f"{self.prefix}_struct.py", "w")
29
+
30
+ for line in self.f_cpp:
31
+ self.process_line(line)
32
+
33
+ self.f_cpp.close()
34
+ self.f_struct.close()
35
+
36
+ print("Struct生成成功")
37
+
38
+ def process_line(self, line: str):
39
+ """处理每行"""
40
+ line = line.replace(";", "")
41
+ line = line.replace("\n", "")
42
+
43
+ if line.startswith("struct"):
44
+ self.process_declare(line)
45
+ elif line.startswith("{"):
46
+ self.process_start(line)
47
+ elif line.startswith("}"):
48
+ self.process_end(line)
49
+ elif "\t" in line and "///" not in line:
50
+ self.process_member(line)
51
+
52
+ def process_declare(self, line: str):
53
+ """处理声明"""
54
+ words = line.split(" ")
55
+ name = words[1]
56
+ end = "{"
57
+
58
+ new_line = f"{name} = {end}\n"
59
+ self.f_struct.write(new_line)
60
+
61
+ def process_start(self, line: str):
62
+ """处理开始"""
63
+ pass
64
+
65
+ def process_end(self, line: str):
66
+ """处理结束"""
67
+ new_line = "}\n\n"
68
+ self.f_struct.write(new_line)
69
+
70
+ def process_member(self, line: str):
71
+ """处理成员"""
72
+ words = line.split("\t")
73
+ words = [word for word in words if word]
74
+
75
+ py_type = self.typedefs[words[0]]
76
+ name = words[1]
77
+
78
+ new_line = f" \"{name}\": \"{py_type}\",\n"
79
+ self.f_struct.write(new_line)
80
+
81
+
82
+ if __name__ == "__main__":
83
+ generator = StructGenerator("../include/ctp/ThostFtdcUserApiStruct.h", "ctp")
84
+ generator.run()
@@ -0,0 +1,168 @@
1
+ /////////////////////////////////////////////////////////////////////////
2
+ ///@system ��һ��������ϵͳ
3
+ ///@company �Ϻ��ڻ���Ϣ�������޹�˾
4
+ ///@file ThostFtdcMdApi.h
5
+ ///@brief �����˿ͻ��˽ӿ�
6
+ ///@history
7
+ ///20060106 �Ժ�� �������ļ�
8
+ /////////////////////////////////////////////////////////////////////////
9
+
10
+ #if !defined(THOST_FTDCMDAPI_H)
11
+ #define THOST_FTDCMDAPI_H
12
+
13
+ #if _MSC_VER > 1000
14
+ #pragma once
15
+ #endif // _MSC_VER > 1000
16
+
17
+ #include "ThostFtdcUserApiStruct.h"
18
+
19
+ #if defined(ISLIB) && defined(WIN32)
20
+ #ifdef LIB_MD_API_EXPORT
21
+ #define MD_API_EXPORT __declspec(dllexport)
22
+ #else
23
+ #define MD_API_EXPORT __declspec(dllimport)
24
+ #endif
25
+ #else
26
+ #define MD_API_EXPORT
27
+ #endif
28
+
29
+ class CThostFtdcMdSpi
30
+ {
31
+ public:
32
+ ///���ͻ����뽻�׺�̨������ͨ������ʱ����δ��¼ǰ�����÷��������á�
33
+ virtual void OnFrontConnected(){};
34
+
35
+ ///���ͻ����뽻�׺�̨ͨ�����ӶϿ�ʱ���÷��������á���������������API���Զ��������ӣ��ͻ��˿ɲ���������
36
+ ///@param nReason ����ԭ��
37
+ /// 0x1001 �����ʧ��
38
+ /// 0x1002 ����дʧ��
39
+ /// 0x2001 ����������ʱ
40
+ /// 0x2002 ��������ʧ��
41
+ /// 0x2003 �յ�������
42
+ virtual void OnFrontDisconnected(int nReason){};
43
+
44
+ ///������ʱ���档����ʱ��δ�յ�����ʱ���÷��������á�
45
+ ///@param nTimeLapse �����ϴν��ձ��ĵ�ʱ��
46
+ virtual void OnHeartBeatWarning(int nTimeLapse){};
47
+
48
+
49
+ ///��¼������Ӧ
50
+ virtual void OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
51
+
52
+ ///�dz�������Ӧ
53
+ virtual void OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
54
+
55
+ ///�����ѯ�鲥��Լ��Ӧ
56
+ virtual void OnRspQryMulticastInstrument(CThostFtdcMulticastInstrumentField *pMulticastInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
57
+
58
+ ///����Ӧ��
59
+ virtual void OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
60
+
61
+ ///��������Ӧ��
62
+ virtual void OnRspSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
63
+
64
+ ///ȡ����������Ӧ��
65
+ virtual void OnRspUnSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
66
+
67
+ ///����ѯ��Ӧ��
68
+ virtual void OnRspSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
69
+
70
+ ///ȡ������ѯ��Ӧ��
71
+ virtual void OnRspUnSubForQuoteRsp(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
72
+
73
+ ///�������֪ͨ
74
+ virtual void OnRtnDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData) {};
75
+
76
+ ///ѯ��֪ͨ
77
+ virtual void OnRtnForQuoteRsp(CThostFtdcForQuoteRspField *pForQuoteRsp) {};
78
+ };
79
+
80
+ class MD_API_EXPORT CThostFtdcMdApi
81
+ {
82
+ public:
83
+ ///����MdApi
84
+ ///@param pszFlowPath ����������Ϣ�ļ���Ŀ¼��Ĭ��Ϊ��ǰĿ¼
85
+ ///@return ��������UserApi
86
+ ///modify for udp marketdata
87
+ static CThostFtdcMdApi *CreateFtdcMdApi(const char *pszFlowPath = "", const bool bIsUsingUdp=false, const bool bIsMulticast=false);
88
+
89
+ ///��ȡAPI�İ汾��Ϣ
90
+ ///@retrun ��ȡ���İ汾��
91
+ static const char *GetApiVersion();
92
+
93
+ ///ɾ���ӿڶ�����
94
+ ///@remark ����ʹ�ñ��ӿڶ���ʱ,���øú���ɾ���ӿڶ���
95
+ virtual void Release() = 0;
96
+
97
+ ///��ʼ��
98
+ ///@remark ��ʼ�����л���,ֻ�е��ú�,�ӿڲſ�ʼ����
99
+ virtual void Init() = 0;
100
+
101
+ ///�ȴ��ӿ��߳̽�������
102
+ ///@return �߳��˳�����
103
+ virtual int Join() = 0;
104
+
105
+ ///��ȡ��ǰ������
106
+ ///@retrun ��ȡ���Ľ�����
107
+ ///@remark ֻ�е�¼�ɹ���,���ܵõ���ȷ�Ľ�����
108
+ virtual const char *GetTradingDay() = 0;
109
+
110
+ ///ע��ǰ�û������ַ
111
+ ///@param pszFrontAddress��ǰ�û������ַ��
112
+ ///@remark �����ַ�ĸ�ʽΪ����protocol://ipaddress:port�����磺��tcp://127.0.0.1:17001����
113
+ ///@remark ��tcp����������Э�飬��127.0.0.1��������������ַ����17001�������������˿ںš�
114
+ virtual void RegisterFront(char *pszFrontAddress) = 0;
115
+
116
+ ///ע�����ַ����������ַ
117
+ ///@param pszNsAddress�����ַ����������ַ��
118
+ ///@remark �����ַ�ĸ�ʽΪ����protocol://ipaddress:port�����磺��tcp://127.0.0.1:12001����
119
+ ///@remark ��tcp����������Э�飬��127.0.0.1��������������ַ����12001�������������˿ںš�
120
+ ///@remark RegisterNameServer������RegisterFront
121
+ virtual void RegisterNameServer(char *pszNsAddress) = 0;
122
+
123
+ ///ע�����ַ������û���Ϣ
124
+ ///@param pFensUserInfo���û���Ϣ��
125
+ virtual void RegisterFensUserInfo(CThostFtdcFensUserInfoField * pFensUserInfo) = 0;
126
+
127
+ ///ע��ص��ӿ�
128
+ ///@param pSpi �����Իص��ӿ����ʵ��
129
+ virtual void RegisterSpi(CThostFtdcMdSpi *pSpi) = 0;
130
+
131
+ ///�������顣
132
+ ///@param ppInstrumentID ��ԼID
133
+ ///@param nCount Ҫ����/�˶�����ĺ�Լ����
134
+ ///@remark
135
+ virtual int SubscribeMarketData(char *ppInstrumentID[], int nCount) = 0;
136
+
137
+ ///�˶����顣
138
+ ///@param ppInstrumentID ��ԼID
139
+ ///@param nCount Ҫ����/�˶�����ĺ�Լ����
140
+ ///@remark
141
+ virtual int UnSubscribeMarketData(char *ppInstrumentID[], int nCount) = 0;
142
+
143
+ ///����ѯ�ۡ�
144
+ ///@param ppInstrumentID ��ԼID
145
+ ///@param nCount Ҫ����/�˶�����ĺ�Լ����
146
+ ///@remark
147
+ virtual int SubscribeForQuoteRsp(char *ppInstrumentID[], int nCount) = 0;
148
+
149
+ ///�˶�ѯ�ۡ�
150
+ ///@param ppInstrumentID ��ԼID
151
+ ///@param nCount Ҫ����/�˶�����ĺ�Լ����
152
+ ///@remark
153
+ virtual int UnSubscribeForQuoteRsp(char *ppInstrumentID[], int nCount) = 0;
154
+
155
+ ///�û���¼����
156
+ virtual int ReqUserLogin(CThostFtdcReqUserLoginField *pReqUserLoginField, int nRequestID) = 0;
157
+
158
+
159
+ ///�dz�����
160
+ virtual int ReqUserLogout(CThostFtdcUserLogoutField *pUserLogout, int nRequestID) = 0;
161
+
162
+ ///�����ѯ�鲥��Լ
163
+ virtual int ReqQryMulticastInstrument(CThostFtdcQryMulticastInstrumentField *pQryMulticastInstrument, int nRequestID) = 0;
164
+ protected:
165
+ ~CThostFtdcMdApi(){};
166
+ };
167
+
168
+ #endif