mootdx2 0.11.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. mootdx2-0.11.8/.coveragerc +9 -0
  2. mootdx2-0.11.8/.drone.yml +54 -0
  3. mootdx2-0.11.8/.editorconfig +20 -0
  4. mootdx2-0.11.8/.gitignore +72 -0
  5. mootdx2-0.11.8/.pre-commit-config.yaml +84 -0
  6. mootdx2-0.11.8/.readthedocs.yaml +20 -0
  7. mootdx2-0.11.8/AUTHORS.rst +7 -0
  8. mootdx2-0.11.8/Dockerfile +46 -0
  9. mootdx2-0.11.8/LICENSE +10 -0
  10. mootdx2-0.11.8/Makefile +135 -0
  11. mootdx2-0.11.8/PKG-INFO +135 -0
  12. mootdx2-0.11.8/README.md +106 -0
  13. mootdx2-0.11.8/docs/api/affair.md +76 -0
  14. mootdx2-0.11.8/docs/api/extras.md +158 -0
  15. mootdx2-0.11.8/docs/api/fields.md +1043 -0
  16. mootdx2-0.11.8/docs/api/quote1.md +326 -0
  17. mootdx2-0.11.8/docs/api/quote2.md +188 -0
  18. mootdx2-0.11.8/docs/api/reader.md +112 -0
  19. mootdx2-0.11.8/docs/chlog.md +206 -0
  20. mootdx2-0.11.8/docs/cli/affair.md +82 -0
  21. mootdx2-0.11.8/docs/cli/bestip.md +62 -0
  22. mootdx2-0.11.8/docs/cli/bundle.md +29 -0
  23. mootdx2-0.11.8/docs/cli/quotes.md +28 -0
  24. mootdx2-0.11.8/docs/cli/reader.md +55 -0
  25. mootdx2-0.11.8/docs/faq/py_mini_racer.md +0 -0
  26. mootdx2-0.11.8/docs/history.md +280 -0
  27. mootdx2-0.11.8/docs/img/IMG_2851.JPG +0 -0
  28. mootdx2-0.11.8/docs/img/todo.md +72 -0
  29. mootdx2-0.11.8/docs/index.md +31 -0
  30. mootdx2-0.11.8/docs/quick.md +63 -0
  31. mootdx2-0.11.8/docs/requirements.txt +1 -0
  32. mootdx2-0.11.8/docs/setup.md +33 -0
  33. mootdx2-0.11.8/docs/todo.md +47 -0
  34. mootdx2-0.11.8/mkdocs.yml +29 -0
  35. mootdx2-0.11.8/mootdx/__init__.py +9 -0
  36. mootdx2-0.11.8/mootdx/__main__.py +193 -0
  37. mootdx2-0.11.8/mootdx/affair.py +120 -0
  38. mootdx2-0.11.8/mootdx/cache/__init__.py +3 -0
  39. mootdx2-0.11.8/mootdx/cache/compat.py +4 -0
  40. mootdx2-0.11.8/mootdx/cache/file.py +38 -0
  41. mootdx2-0.11.8/mootdx/cache/timed.py +60 -0
  42. mootdx2-0.11.8/mootdx/cache/timer.py +20 -0
  43. mootdx2-0.11.8/mootdx/config.py +124 -0
  44. mootdx2-0.11.8/mootdx/consts.py +118 -0
  45. mootdx2-0.11.8/mootdx/contrib/__init__.py +5 -0
  46. mootdx2-0.11.8/mootdx/contrib/adjust.py +79 -0
  47. mootdx2-0.11.8/mootdx/contrib/compat.py +172 -0
  48. mootdx2-0.11.8/mootdx/exceptions.py +33 -0
  49. mootdx2-0.11.8/mootdx/financial/__init__.py +0 -0
  50. mootdx2-0.11.8/mootdx/financial/base.py +80 -0
  51. mootdx2-0.11.8/mootdx/financial/columns.py +583 -0
  52. mootdx2-0.11.8/mootdx/financial/financial.py +230 -0
  53. mootdx2-0.11.8/mootdx/logger.py +11 -0
  54. mootdx2-0.11.8/mootdx/parse.py +61 -0
  55. mootdx2-0.11.8/mootdx/quotes.py +768 -0
  56. mootdx2-0.11.8/mootdx/reader.py +203 -0
  57. mootdx2-0.11.8/mootdx/server.py +193 -0
  58. mootdx2-0.11.8/mootdx/tools/DownloadTDXCaiWu.py +215 -0
  59. mootdx2-0.11.8/mootdx/tools/__init__.py +3 -0
  60. mootdx2-0.11.8/mootdx/tools/customize.py +205 -0
  61. mootdx2-0.11.8/mootdx/tools/reversion.py +229 -0
  62. mootdx2-0.11.8/mootdx/tools/tdx2csv.py +61 -0
  63. mootdx2-0.11.8/mootdx/utils/__init__.py +353 -0
  64. mootdx2-0.11.8/mootdx/utils/adjust.py +144 -0
  65. mootdx2-0.11.8/mootdx/utils/demjson.py +6320 -0
  66. mootdx2-0.11.8/mootdx/utils/factor.py +41 -0
  67. mootdx2-0.11.8/mootdx/utils/holiday.js +287 -0
  68. mootdx2-0.11.8/mootdx/utils/holiday.py +140 -0
  69. mootdx2-0.11.8/mootdx/utils/pandas_cache.py +95 -0
  70. mootdx2-0.11.8/mootdx/utils/timer.py +33 -0
  71. mootdx2-0.11.8/mootdx/version.py +3 -0
  72. mootdx2-0.11.8/pyproject.toml +70 -0
  73. mootdx2-0.11.8/requirements.txt +22 -0
  74. mootdx2-0.11.8/sample/README.md +117 -0
  75. mootdx2-0.11.8/sample/basic_adjust.py +16 -0
  76. mootdx2-0.11.8/sample/basic_affairs.py +14 -0
  77. mootdx2-0.11.8/sample/basic_quotes.py +39 -0
  78. mootdx2-0.11.8/sample/basic_reader.py +16 -0
  79. mootdx2-0.11.8/sample/candlestick_qfq.py +149 -0
  80. mootdx2-0.11.8/sample/etf_dividend_yield.py +175 -0
  81. mootdx2-0.11.8/sample/fq.py +502 -0
  82. mootdx2-0.11.8/sample/fuquan.py +193 -0
  83. mootdx2-0.11.8/sample/hk_quotes.py +32 -0
  84. mootdx2-0.11.8/sample/list_ext_markets.py +4 -0
  85. mootdx2-0.11.8/sample/lru_cache.py +24 -0
  86. mootdx2-0.11.8/sample/parse_affairs_all.py +31 -0
  87. mootdx2-0.11.8/sample/repro_bug.py +18 -0
  88. mootdx2-0.11.8/sample/verify_server.py +7 -0
  89. mootdx2-0.11.8/scripts/fabfile.py +50 -0
  90. mootdx2-0.11.8/tests/__init__.py +1 -0
  91. mootdx2-0.11.8/tests/cache/test_file.py +73 -0
  92. mootdx2-0.11.8/tests/conftest.py +20 -0
  93. mootdx2-0.11.8/tests/financial/__init__.py +0 -0
  94. mootdx2-0.11.8/tests/financial/test_affairs.py +47 -0
  95. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/block_fg.dat +0 -0
  96. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/block_gn.dat +0 -0
  97. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/block_zs.dat +0 -0
  98. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/brkcomp.dat +807 -0
  99. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/brkseat.dat +2850 -0
  100. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/code2gp.dat +908 -0
  101. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/code2name.ini +73 -0
  102. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/code2name_qq.ini +22 -0
  103. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/ds_code.dat +0 -0
  104. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/ds_mrk.dat +0 -0
  105. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/ds_tinf.dat +0 -0
  106. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/funddiv.dat +0 -0
  107. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/fundhold.dat +0 -0
  108. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/fundinfo.dat +0 -0
  109. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/ggqqcode.txt +315 -0
  110. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/hkblock.dat +6968 -0
  111. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/hkcwdata.dat +0 -0
  112. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/hkqxinfo.dat +0 -0
  113. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/hkqxinfo2.dat +0 -0
  114. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/hkxgsg.cfg +1 -0
  115. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/hkzsinfo.cfg +152 -0
  116. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/hqrule.dat +7 -0
  117. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/hspy.dat +19 -0
  118. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/importzs.cfg +10 -0
  119. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/infoharbor_spec.cfg +58 -0
  120. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/itcomte.dat +0 -0
  121. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/jjblock.dat +1895 -0
  122. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/mgblock.dat +5336 -0
  123. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/mgcwdata.dat +0 -0
  124. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/mgqxinfo.dat +0 -0
  125. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/neednote.dat +51 -0
  126. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/neeqcode.txt +7107 -0
  127. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/nscomte.dat +0 -0
  128. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/othersg.cfg +32 -0
  129. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/profile.dat +0 -0
  130. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/pttab.dat +1014 -0
  131. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/relation.dat +0 -0
  132. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/sbblock.dat +4441 -0
  133. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/sh.tcu +0 -0
  134. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/sh.tfz +0 -0
  135. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/sh.th2 +0 -0
  136. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/shm.tnf +0 -0
  137. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/shsz.tdf +0 -0
  138. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/spblock.dat +17835 -0
  139. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/specallzt.txt +742 -0
  140. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/sz.tcu +0 -0
  141. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/sz.tfz +0 -0
  142. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/sz.th2 +0 -0
  143. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/szm.tnf +0 -0
  144. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/szqqcode.txt +145 -0
  145. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/tdxadr.cfg +28 -0
  146. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/tdxbjmore.cfg +91 -0
  147. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/tdxbk.cfg +16 -0
  148. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/tdxdszs.cfg +242 -0
  149. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/tdxhy.cfg +4906 -0
  150. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/tdxmgag.cfg +224 -0
  151. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/tdxpkmore.cfg +739 -0
  152. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/tdxsbzs.cfg +10 -0
  153. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/tdxstat.cfg +6336 -0
  154. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/tdxzs.cfg +522 -0
  155. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/tdxzs3.cfg +984 -0
  156. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/tdxzsbase.cfg +1034 -0
  157. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/tend_std.cfg +1013 -0
  158. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/tipinfo.dat +4888 -0
  159. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/ukblock.dat +288 -0
  160. mootdx2-0.11.8/tests/fixtures/T0002/hq_cache/xgsg.cfg +40 -0
  161. mootdx2-0.11.8/tests/fixtures/export/SH#601003.csv +3366 -0
  162. mootdx2-0.11.8/tests/fixtures/export/SH#601003.txt +3369 -0
  163. mootdx2-0.11.8/tests/fixtures/export/SH#601005.txt +3098 -0
  164. mootdx2-0.11.8/tests/fixtures/export/SH#601006.txt +3667 -0
  165. mootdx2-0.11.8/tests/fixtures/export/SH#601007.txt +3507 -0
  166. mootdx2-0.11.8/tests/fixtures/export/SH#601008.txt +3492 -0
  167. mootdx2-0.11.8/tests/fixtures/export/SH#601009.txt +3434 -0
  168. mootdx2-0.11.8/tests/fixtures/incon.dat +3194 -0
  169. mootdx2-0.11.8/tests/fixtures/vipdoc/ds/lday/4#CF7D0LAO.day +0 -0
  170. mootdx2-0.11.8/tests/fixtures/vipdoc/ds/lday/4#CF7D0LLS.day +0 -0
  171. mootdx2-0.11.8/tests/fixtures/vipdoc/sh/fzline/sh688001.lc5 +0 -0
  172. mootdx2-0.11.8/tests/fixtures/vipdoc/sh/lday/sh000001.day +0 -0
  173. mootdx2-0.11.8/tests/fixtures/vipdoc/sh/lday/sh127021.day +0 -0
  174. mootdx2-0.11.8/tests/fixtures/vipdoc/sh/lday/sh688001.day +0 -0
  175. mootdx2-0.11.8/tests/fixtures/vipdoc/sh/lday/sh881478.day +0 -0
  176. mootdx2-0.11.8/tests/fixtures/vipdoc/sh/minline/sh688001.lc1 +0 -0
  177. mootdx2-0.11.8/tests/fixtures/vipdoc/sz/lday/sz000001.day +0 -0
  178. mootdx2-0.11.8/tests/fixtures/vipdoc/sz/lday/sz127021.day +0 -0
  179. mootdx2-0.11.8/tests/quotes/__init__.py +0 -0
  180. mootdx2-0.11.8/tests/quotes/test_quotes_base.py +31 -0
  181. mootdx2-0.11.8/tests/quotes/test_quotes_ext.py +64 -0
  182. mootdx2-0.11.8/tests/quotes/test_quotes_std.py +132 -0
  183. mootdx2-0.11.8/tests/reader/__init__.py +0 -0
  184. mootdx2-0.11.8/tests/reader/test_reader_base.py +40 -0
  185. mootdx2-0.11.8/tests/reader/test_reader_block.py +44 -0
  186. mootdx2-0.11.8/tests/reader/test_reader_blocknew.py +37 -0
  187. mootdx2-0.11.8/tests/reader/test_reader_ext.py +28 -0
  188. mootdx2-0.11.8/tests/reader/test_reader_parse.py +27 -0
  189. mootdx2-0.11.8/tests/reader/test_reader_std.py +53 -0
  190. mootdx2-0.11.8/tests/requirements.txt +4 -0
  191. mootdx2-0.11.8/tests/test_adjust.py +72 -0
  192. mootdx2-0.11.8/tests/test_adjust2.py +24 -0
  193. mootdx2-0.11.8/tests/test_affairs.py +45 -0
  194. mootdx2-0.11.8/tests/test_bestip.py +18 -0
  195. mootdx2-0.11.8/tests/test_factor.py +33 -0
  196. mootdx2-0.11.8/tests/test_frequency.py +15 -0
  197. mootdx2-0.11.8/tests/test_reconnect.py +7 -0
  198. mootdx2-0.11.8/tests/test_useless.py +41 -0
  199. mootdx2-0.11.8/tests/test_xdxr.py +23 -0
  200. mootdx2-0.11.8/tests/tools/__init__.py +0 -0
  201. mootdx2-0.11.8/tests/tools/test_customize.py +71 -0
  202. mootdx2-0.11.8/tests/tools/test_reversion.py +55 -0
  203. mootdx2-0.11.8/tests/tools/test_tdx2csv.py +16 -0
  204. mootdx2-0.11.8/tests/utils/__init__.py +0 -0
  205. mootdx2-0.11.8/tests/utils/test_holiday.py +65 -0
  206. mootdx2-0.11.8/tests/utils/test_timer.py +19 -0
  207. mootdx2-0.11.8/tests/utils/test_utils.py +71 -0
  208. mootdx2-0.11.8/tox.ini +33 -0
  209. mootdx2-0.11.8/uv.lock +1783 -0
@@ -0,0 +1,9 @@
1
+ [report]
2
+ include= =
3
+ mootdx/*.py
4
+ omit =
5
+ mootdx/parser/ext/*.py
6
+ mootdx/exhq.py
7
+
8
+ skip_covered = true
9
+ sort = -cover
@@ -0,0 +1,54 @@
1
+ ---
2
+ kind: pipeline
3
+ name: default
4
+ type: docker
5
+
6
+ steps:
7
+ - name: test
8
+ image: mootdx:ci
9
+ commands:
10
+ - pytest -vs
11
+
12
+ - name: pypi
13
+ image: mootdx:ci
14
+ commands:
15
+ - python -m pip install poetry
16
+ - python -m poetry publish --no-cache --build --username=__token__ --password=$PYPI_PASSWORD
17
+ environment:
18
+ PYPI_PASSWORD:
19
+ from_secret: pypi_password
20
+ when:
21
+ ref:
22
+ include:
23
+ - refs/tags/**
24
+
25
+ # - name: sync
26
+ # image: mootdx:ci
27
+ # environment:
28
+ # SSH_KEY:
29
+ # from_secret: ssh_key
30
+ # commands:
31
+ # - echo "$SSH_KEY" > ~/.ssh/id_rsa
32
+ # - git remote add github git@github.com:mootdx/mootdx.git
33
+ # - git remote add gitee git@gitee.com:ibopo/mootdx.git
34
+ # - git checkout develop
35
+ # - git pull gitee develop
36
+ # - git push gitee develop
37
+ # - git pull github develop
38
+ # - git push github develop
39
+ #
40
+ # - name: publish
41
+ # image: mootdx:ci
42
+ # environment:
43
+ # USERNAME:
44
+ # from_secret: username
45
+ # PASSWORD:
46
+ # from_secret: password
47
+ # commands:
48
+ # - make history USERNAME=$USERNAME PASSWORD=$PASSWORD
49
+ # - make publish USERNAME=$USERNAME PASSWORD=$PASSWORD
50
+ # when:
51
+ # event:
52
+ # - promote
53
+ # target:
54
+ # - production
@@ -0,0 +1,20 @@
1
+ # http://editorconfig.org
2
+
3
+ root = true
4
+
5
+ [*]
6
+ indent_style = space
7
+ indent_size = 4
8
+ trim_trailing_whitespace = true
9
+ insert_final_newline = true
10
+ charset = utf-8
11
+ end_of_line = lf
12
+
13
+ [{*.yaml,*.yml}]
14
+ indent_size = 2
15
+
16
+ [LICENSE]
17
+ insert_final_newline = false
18
+
19
+ [Makefile]
20
+ indent_style = tab
@@ -0,0 +1,72 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ *.ipynb
10
+
11
+ # Distribution / packaging
12
+ .pytest_cache/
13
+ .Python
14
+ env/
15
+ build/
16
+ develop-eggs/
17
+ dist/
18
+ downloads/
19
+ eggs/
20
+ .eggs/
21
+ lib/
22
+ lib64/
23
+ parts/
24
+ sdist/
25
+ var/
26
+ *.egg-info/
27
+ .installed.cfg
28
+ *.egg
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *,cover
49
+ .hypothesis/
50
+
51
+ # Translations
52
+ *.mo
53
+ *.pot
54
+
55
+ # Django stuff:
56
+ *.log
57
+
58
+ # Sphinx documentation
59
+ docs/_build/
60
+
61
+ # pdoc generated API docs
62
+ docs/api_html/
63
+
64
+ # PyBuilder
65
+ target/
66
+
67
+ # pyenv python configuration file
68
+ .python-version
69
+
70
+ .idea
71
+ .github
72
+ .DS_Store
@@ -0,0 +1,84 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v4.4.0
4
+ hooks:
5
+ - id: trailing-whitespace # Trim trailing whitespace
6
+ - id: check-merge-conflict # Check for files that contain merge conflict strings
7
+ - id: check-case-conflict
8
+ - id: double-quote-string-fixer # Replace double quoted strings with single quoted strings
9
+ - id: end-of-file-fixer # Make sure files end in a newline and only a newline
10
+ - id: requirements-txt-fixer # Sort entries in requirements.txt and remove incorrect entry for pkg-resources==0.0.0
11
+ - id: fix-encoding-pragma # Remove the coding pragma: # -*- coding: utf-8 -*-
12
+ args: [ "--remove" ]
13
+ - id: mixed-line-ending # Replace or check mixed line ending
14
+ args: [ "--fix=lf" ]
15
+ - id: check-ast
16
+ name: Check python ast
17
+ description: Simply check whether the files parse as valid python.
18
+ entry: check-ast
19
+ language: python
20
+ types: [ python ]
21
+
22
+
23
+ - repo: https://gitee.com/ibopo/pre-commit-hooks
24
+ rev: v1.1.9
25
+ hooks:
26
+ - id: forbid-crlf
27
+ - id: remove-crlf
28
+ - id: forbid-tabs
29
+ - id: remove-tabs
30
+
31
+ - repo: https://github.com/asottile/reorder_python_imports
32
+ rev: v3.9.0
33
+ hooks:
34
+ - id: reorder-python-imports
35
+
36
+ - repo: https://github.com/python-poetry/poetry
37
+ rev: '1.5.0'
38
+ hooks:
39
+ - id: poetry-export
40
+ args: [ "-f", "requirements.txt", "-o", "requirements.txt", "--without-hashes" ]
41
+
42
+ - repo: https://github.com/commitizen-tools/commitizen
43
+ rev: '3.2.2'
44
+ hooks:
45
+ - id: commitizen
46
+ name: commitizen check
47
+ entry: cz check
48
+ args: [ --allow-abort, --commit-msg-file ]
49
+ stages: [ commit-msg ]
50
+ language: python
51
+ language_version: python3
52
+ minimum_pre_commit_version: "1.4.3"
53
+
54
+ # - id: commitizen-branch
55
+ # name: commitizen check branch
56
+ # description: >
57
+ # Check all commit messages that are already on the current branch but not the
58
+ # default branch on the origin repository. Useful for checking messages after
59
+ # the fact (e.g., pre-push or in CI) without an expensive check of the entire
60
+ # repository history.
61
+ # entry: cz check
62
+ # args: [ --rev-range, origin/HEAD..HEAD ]
63
+ # always_run: true
64
+ # pass_filenames: false
65
+ # language: python
66
+ # language_version: python3
67
+ # minimum_pre_commit_version: "1.4.3"
68
+
69
+ exclude: |
70
+ (?x)^(
71
+ docs\/.*|
72
+ .*migrations\/.*|
73
+ sample\/.*|
74
+ notebooks\/.*|
75
+ \.ipynb_checkpoints|
76
+ setup\.cfg|
77
+ fabfile\.py|
78
+ .*?proto.*|
79
+ .*?\.yaml|
80
+ .*?\.yml|
81
+ .*?\.dat|
82
+ .*?\.txt|
83
+ .*?\.md
84
+ )
@@ -0,0 +1,20 @@
1
+ # .readthedocs.yaml
2
+ # Read the Docs configuration file
3
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4
+
5
+ # Required
6
+ version: 2
7
+
8
+ # Set the version of Python and other tools you might need
9
+ build:
10
+ os: ubuntu-20.04
11
+ tools:
12
+ python: "3.9"
13
+
14
+ mkdocs:
15
+ configuration: mkdocs.yml
16
+
17
+ # Optionally declare the Python requirements required to build your docs
18
+ python:
19
+ install:
20
+ - requirements: docs/requirements.txt
@@ -0,0 +1,7 @@
1
+ 开发团队
2
+ ==============
3
+
4
+ 开发者列表
5
+ ----------------
6
+
7
+ * bopo <ibopo@126.com>
@@ -0,0 +1,46 @@
1
+ ARG PYTHON_VERSION=3.8-slim
2
+
3
+ # define an alias for the specfic python version used in this file.
4
+ FROM python:${PYTHON_VERSION} as python
5
+
6
+ # Python build stage
7
+ FROM python as python-build-stage
8
+ # RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
9
+ # RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
10
+ # RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
11
+ # RUN apk add openssl-dev make autoconf automake gcc g++ zlib-dev linux-headers git libffi-dev libevent
12
+
13
+ COPY ./requirements.txt .
14
+ COPY ./tests/requirements.txt ./requirements.dev
15
+
16
+ # Create Python Dependency and Sub-Dependency Wheels.
17
+ # py3-pandas py3-numpy py3-click py3-schedule
18
+ RUN pip wheel --wheel-dir /usr/src/app/wheels -r requirements.txt -r requirements.dev
19
+ # RUN pip wheel --wheel-dir /usr/src/app/wheels -r requirements.dev -i https://mirrors.ustc.edu.cn/pypi/web/simple
20
+ # RUN pip wheel --wheel-dir /usr/src/app/wheels -i https://mirrors.ustc.edu.cn/pypi/web/simple 'mootdx[all]'
21
+ RUN rm -rf /usr/src/app/wheels/setuptools*
22
+
23
+ RUN pip install 'mootdx[cli]'
24
+ RUN mootdx bestip -v
25
+
26
+ # Python 'run' stage
27
+ FROM python as python-run-stage
28
+
29
+ ARG BUILD_ENVIRONMENT=production
30
+ ARG APP_HOME=/app
31
+
32
+ ENV PYTHONUNBUFFERED 1
33
+ ENV PYTHONDONTWRITEBYTECODE 1
34
+ ENV BUILD_ENV ${BUILD_ENVIRONMENT}
35
+
36
+ #RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
37
+ # RUN apk add --no-cache zlib-dev bash
38
+
39
+ # All absolute dir copies ignore workdir instruction. All relative dir copies are wrt to the workdir instruction
40
+ # copy python dependency wheels from python-build-stage
41
+ COPY --from=python-build-stage /usr/src/app/wheels /wheels/
42
+ COPY --from=python-build-stage /root/.mootdx/config.json /root/.mootdx/config.json
43
+
44
+ # use wheels to install python dependencies
45
+ RUN pip install --no-cache-dir --no-index --find-links=/wheels/ /wheels/* && rm -rf /wheels/
46
+ RUN pip install --no-cache-dir poetry
mootdx2-0.11.8/LICENSE ADDED
@@ -0,0 +1,10 @@
1
+
2
+ MIT License
3
+
4
+ Copyright (c) 2017, mootdx
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7
+
8
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9
+
10
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,135 @@
1
+ .PHONY: cleanup prepare history publish release version clean test cov
2
+
3
+ .DEFAULT_GOAL := help
4
+ define BROWSER_PYSCRIPT
5
+ import os, webbrowser, sys
6
+ try:
7
+ from urllib import pathname2url
8
+ except:
9
+ from urllib.request import pathname2url
10
+
11
+ webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
12
+ endef
13
+ export BROWSER_PYSCRIPT
14
+
15
+ define PRINT_HELP_PYSCRIPT
16
+ import re, sys
17
+
18
+ for line in sys.stdin:
19
+ match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
20
+ if match:
21
+ target, help = match.groups()
22
+ print("%-20s %s" % (target, help))
23
+ endef
24
+ export PRINT_HELP_PYSCRIPT
25
+
26
+ BROWSER := python -c "$$BROWSER_PYSCRIPT"
27
+ VERSION := `uv run python -m mootdx.version`
28
+
29
+ help:
30
+ @python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
31
+
32
+ clean: clean-build clean-pyc clean-test # remove all build, test, coverage and Python artifacts
33
+
34
+
35
+ unix:
36
+ find . "*.txt" | xargs dos2unix
37
+ find . "*.md" | xargs dos2unix
38
+ find . "*.py" | xargs dos2unix
39
+ dos2unix Makefile
40
+
41
+ clean-build:
42
+ rm -fr build/
43
+ rm -fr dist/
44
+ rm -fr .eggs/
45
+ rm -fr .temp/
46
+ find . -name '*.egg-info' -exec rm -fr {} +
47
+ find . -name '*.egg' -exec rm -f {} +
48
+
49
+ clean-pyc:
50
+ find . -name '*.pyc' -exec rm -f {} +
51
+ find . -name '*.pyo' -exec rm -f {} +
52
+ find . -name '*.~' -exec rm -f {} +
53
+ find . -name '__pycache__' -exec rm -fr {} +
54
+
55
+ clean-test:
56
+ rm -fr .tox/
57
+ rm -f .coverage
58
+ rm -fr htmlcov/
59
+
60
+ lint:
61
+ flake8 --max-line-length=200
62
+
63
+ cov: clean-test
64
+ uv run py.test -v --cov=mootdx --cov-report=html
65
+
66
+ fmt:
67
+ black -l 120 -t py36 -t py37 -t py38 -t py39 -t py310 .
68
+
69
+ test: # run tests quickly with the default Python
70
+ @uv run pytest tests
71
+
72
+ test-all:
73
+ tox
74
+
75
+ docs:
76
+ uv run mkdocs serve -a 0.0.0.0:8000
77
+
78
+ archive: clean
79
+ git archive --format zip --output ../mootdx-master.zip master
80
+
81
+ #poetry run python setup.py sdist
82
+ #poetry run python setup.py bdist_wheel
83
+ package: clean ## 编译并打包
84
+ @uv build -v
85
+ ls -lh dist
86
+
87
+ cleanup: ## 清理开发环境
88
+ @uv venv --clear
89
+
90
+ prepare: clean ## 准备开发环境
91
+ git config user.email ibopo@126.com
92
+ git config pull.rebase false
93
+ git config user.name bopo
94
+ uv sync
95
+
96
+ pull:
97
+ git pull origin `git symbolic-ref --short -q HEAD` --tags
98
+ git pull github `git symbolic-ref --short -q HEAD` --tags
99
+ git pull gitee `git symbolic-ref --short -q HEAD` --tags
100
+
101
+ sync: pull
102
+ git push origin `git symbolic-ref --short -q HEAD` --tags
103
+ git push github `git symbolic-ref --short -q HEAD` --tags
104
+ git push gitee `git symbolic-ref --short -q HEAD` --tags
105
+
106
+ hook:
107
+ curl -i -X POST https://readthedocs.org/api/v2/webhook/mootdx/247616/ -d '{"token": "3a3340e27ddf6996e37f83efc8942f9397108d48"}' -H "Content-Type: application/json"
108
+
109
+ bestip:
110
+ @uv run python -m mootdx bestip -v
111
+
112
+ # https://commitizen-tools.github.io/commitizen/
113
+ # pip install commitizen -i https://pypi.tuna.tsinghua.edu.cn/simple
114
+ history: ## 显示增量修改日志
115
+ @cz changelog --incremental --dry-run
116
+
117
+ #cz bump --dry-run --increment patch
118
+ #cz bump --yes -ch -cc --increment patch --dry-run
119
+ publish: clean ## 打包并发布
120
+ uv publish --build --skip-existing --dry-run
121
+
122
+ docker: # build docker image of CI/CD.
123
+ mkdir -p .temp
124
+ uv export --no-hashes --with test -o .temp/requirements.txt
125
+ docker build . -t mootdx:build
126
+ docker-squash mootdx:build -t mootdx:squash
127
+
128
+ # https://commitizen-tools.github.io/commitizen/
129
+ # https://keepachangelog.com/zh-CN/
130
+ #cz bump --dry-run --yes -ch -cc --increment {MAJOR,MINOR,PATCH}
131
+ release: ## 发布版本并生成修改日志.
132
+ cz bump --yes -ch -cc --increment patch --dry-run
133
+
134
+ version: ## 打印项目当前版本
135
+ @echo $(VERSION)
@@ -0,0 +1,135 @@
1
+ Metadata-Version: 2.4
2
+ Name: mootdx2
3
+ Version: 0.11.8
4
+ Summary: 通达信数据读取接口.
5
+ Project-URL: Homepage, https://www.mootdx.com
6
+ Project-URL: Repository, https://github.com/mootdx/mootdx
7
+ Author-email: bopo <ibopo@126.com>
8
+ License-File: AUTHORS.rst
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 2 - Pre-Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Natural Language :: English
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Requires-Python: >=3.8
20
+ Requires-Dist: click>=8.1.3
21
+ Requires-Dist: httpx>=0.25.0
22
+ Requires-Dist: mini-racer>=0.12.0
23
+ Requires-Dist: prettytable>=3.5.0
24
+ Requires-Dist: tdxpy>=0.2.5
25
+ Requires-Dist: tenacity>=8.1.0
26
+ Requires-Dist: tqdm>=4.66.0
27
+ Requires-Dist: typing-extensions>=4.5.0
28
+ Description-Content-Type: text/markdown
29
+
30
+ 通达信数据读取接口
31
+ ==================
32
+
33
+ 运行环境
34
+ --------
35
+
36
+ - 操作系统: Windows / MacOS / Linux 都可以运行.
37
+ - Python: 3.8 以及以上版本.
38
+
39
+ 安装方法
40
+ --------
41
+
42
+ > 新手建议使用 `pip install -U 'mootdx[all]'` 安装
43
+
44
+ ### PIP 安装方法
45
+ ```shell
46
+ pip install mootdx
47
+ ```
48
+
49
+ ### 升级安装
50
+
51
+ ```shell
52
+ pip install -U mootdx
53
+ ```
54
+
55
+ ### 开发环境安装
56
+
57
+ 推荐使用 `uv` 进行开发环境管理:
58
+
59
+ ```shell
60
+ # 安装 uv
61
+ curl -LsSf https://astral.sh/uv/install.sh | sh
62
+
63
+ # 克隆代码
64
+ git clone https://github.com/mootdx/mootdx.git
65
+ cd mootdx
66
+
67
+ # 同步依赖
68
+ uv sync
69
+
70
+ # 运行测试
71
+ uv run pytest
72
+ ```
73
+
74
+ 使用说明
75
+ --------
76
+
77
+ > 以下只列举一些例子, 详细说明请查看在线文档: <https://www.mootdx.com>
78
+
79
+ 通达信离线数据读取
80
+
81
+ ```python
82
+ from mootdx.reader import Reader
83
+
84
+ # market 参数 std 为标准市场(就是股票), ext 为扩展市场(期货,黄金等)
85
+ # tdxdir 是通达信的数据目录, 根据自己的情况修改
86
+
87
+ reader = Reader.factory(market='std', tdxdir='C:/new_tdx')
88
+
89
+ # 读取日线数据
90
+ reader.daily(symbol='600036')
91
+
92
+ # 读取分钟数据
93
+ reader.minute(symbol='600036')
94
+
95
+ # 读取时间线数据
96
+ reader.fzline(symbol='600036')
97
+ ```
98
+
99
+ 通达信线上行情读取
100
+
101
+ ```python
102
+ from mootdx.quotes import Quotes
103
+
104
+ # 标准市场
105
+ client = Quotes.factory(market='std', multithread=True, heartbeat=True)
106
+
107
+ # k 线数据
108
+ client.bars(symbol='600036', frequency=9, offset=10)
109
+
110
+ # 指数
111
+ client.index(symbol='000001', frequency=9)
112
+
113
+ # 分钟
114
+ client.minute(symbol='000001')
115
+ ```
116
+
117
+ 通达信财务数据读取
118
+
119
+ ```python
120
+ from mootdx.affair import Affair
121
+
122
+ # 远程文件列表
123
+ files = Affair.files()
124
+
125
+ # 下载单个
126
+ Affair.fetch(downdir='tmp', filename='gpcw19960630.zip')
127
+
128
+ # 下载全部
129
+ Affair.parse(downdir='tmp')
130
+ ```
131
+ --------
132
+
133
+ M1 mac 系统PyMiniRacer不能使用,访问:
134
+ <https://github.com/sqreen/PyMiniRacer/issues/143>
135
+
@@ -0,0 +1,106 @@
1
+ 通达信数据读取接口
2
+ ==================
3
+
4
+ 运行环境
5
+ --------
6
+
7
+ - 操作系统: Windows / MacOS / Linux 都可以运行.
8
+ - Python: 3.8 以及以上版本.
9
+
10
+ 安装方法
11
+ --------
12
+
13
+ > 新手建议使用 `pip install -U 'mootdx[all]'` 安装
14
+
15
+ ### PIP 安装方法
16
+ ```shell
17
+ pip install mootdx
18
+ ```
19
+
20
+ ### 升级安装
21
+
22
+ ```shell
23
+ pip install -U mootdx
24
+ ```
25
+
26
+ ### 开发环境安装
27
+
28
+ 推荐使用 `uv` 进行开发环境管理:
29
+
30
+ ```shell
31
+ # 安装 uv
32
+ curl -LsSf https://astral.sh/uv/install.sh | sh
33
+
34
+ # 克隆代码
35
+ git clone https://github.com/mootdx/mootdx.git
36
+ cd mootdx
37
+
38
+ # 同步依赖
39
+ uv sync
40
+
41
+ # 运行测试
42
+ uv run pytest
43
+ ```
44
+
45
+ 使用说明
46
+ --------
47
+
48
+ > 以下只列举一些例子, 详细说明请查看在线文档: <https://www.mootdx.com>
49
+
50
+ 通达信离线数据读取
51
+
52
+ ```python
53
+ from mootdx.reader import Reader
54
+
55
+ # market 参数 std 为标准市场(就是股票), ext 为扩展市场(期货,黄金等)
56
+ # tdxdir 是通达信的数据目录, 根据自己的情况修改
57
+
58
+ reader = Reader.factory(market='std', tdxdir='C:/new_tdx')
59
+
60
+ # 读取日线数据
61
+ reader.daily(symbol='600036')
62
+
63
+ # 读取分钟数据
64
+ reader.minute(symbol='600036')
65
+
66
+ # 读取时间线数据
67
+ reader.fzline(symbol='600036')
68
+ ```
69
+
70
+ 通达信线上行情读取
71
+
72
+ ```python
73
+ from mootdx.quotes import Quotes
74
+
75
+ # 标准市场
76
+ client = Quotes.factory(market='std', multithread=True, heartbeat=True)
77
+
78
+ # k 线数据
79
+ client.bars(symbol='600036', frequency=9, offset=10)
80
+
81
+ # 指数
82
+ client.index(symbol='000001', frequency=9)
83
+
84
+ # 分钟
85
+ client.minute(symbol='000001')
86
+ ```
87
+
88
+ 通达信财务数据读取
89
+
90
+ ```python
91
+ from mootdx.affair import Affair
92
+
93
+ # 远程文件列表
94
+ files = Affair.files()
95
+
96
+ # 下载单个
97
+ Affair.fetch(downdir='tmp', filename='gpcw19960630.zip')
98
+
99
+ # 下载全部
100
+ Affair.parse(downdir='tmp')
101
+ ```
102
+ --------
103
+
104
+ M1 mac 系统PyMiniRacer不能使用,访问:
105
+ <https://github.com/sqreen/PyMiniRacer/issues/143>
106
+