emshare 0.1.1__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 (282) hide show
  1. emshare-0.1.1/CHANGELOG.md +53 -0
  2. emshare-0.1.1/LICENSE +21 -0
  3. emshare-0.1.1/MANIFEST.in +21 -0
  4. emshare-0.1.1/PKG-INFO +123 -0
  5. emshare-0.1.1/README.md +98 -0
  6. emshare-0.1.1/docs/akshare-proxy-review-2026-11-16.md +146 -0
  7. emshare-0.1.1/docs/interfaces/directory_tree.md +145 -0
  8. emshare-0.1.1/docs/interfaces/eastmoney/ashare_billboard/billboard_branch_active_em.md +104 -0
  9. emshare-0.1.1/docs/interfaces/eastmoney/ashare_billboard/billboard_branch_rank_em.md +106 -0
  10. emshare-0.1.1/docs/interfaces/eastmoney/ashare_billboard/billboard_branch_stats_em.md +96 -0
  11. emshare-0.1.1/docs/interfaces/eastmoney/ashare_billboard/billboard_branch_trades_em.md +109 -0
  12. emshare-0.1.1/docs/interfaces/eastmoney/ashare_billboard/billboard_detail_em.md +116 -0
  13. emshare-0.1.1/docs/interfaces/eastmoney/ashare_billboard/billboard_institution_em.md +113 -0
  14. emshare-0.1.1/docs/interfaces/eastmoney/ashare_billboard/billboard_institution_stats_em.md +106 -0
  15. emshare-0.1.1/docs/interfaces/eastmoney/ashare_billboard/billboard_stock_dates_em.md +85 -0
  16. emshare-0.1.1/docs/interfaces/eastmoney/ashare_billboard/billboard_stock_em.md +108 -0
  17. emshare-0.1.1/docs/interfaces/eastmoney/ashare_billboard/billboard_stock_stats_em.md +110 -0
  18. emshare-0.1.1/docs/interfaces/eastmoney/ashare_block_trade/block_trade_branch_active_em.md +106 -0
  19. emshare-0.1.1/docs/interfaces/eastmoney/ashare_block_trade/block_trade_branch_rank_em.md +103 -0
  20. emshare-0.1.1/docs/interfaces/eastmoney/ashare_block_trade/block_trade_detail_em.md +121 -0
  21. emshare-0.1.1/docs/interfaces/eastmoney/ashare_block_trade/block_trade_market_daily_em.md +100 -0
  22. emshare-0.1.1/docs/interfaces/eastmoney/ashare_block_trade/block_trade_stock_daily_em.md +114 -0
  23. emshare-0.1.1/docs/interfaces/eastmoney/ashare_block_trade/block_trade_stock_stats_em.md +109 -0
  24. emshare-0.1.1/docs/interfaces/eastmoney/ashare_boards/board_changes_em.md +114 -0
  25. emshare-0.1.1/docs/interfaces/eastmoney/ashare_boards/board_constituent_em.md +89 -0
  26. emshare-0.1.1/docs/interfaces/eastmoney/ashare_boards/board_fund_flow_em.md +90 -0
  27. emshare-0.1.1/docs/interfaces/eastmoney/ashare_boards/board_industry_list_em.md +96 -0
  28. emshare-0.1.1/docs/interfaces/eastmoney/ashare_boards/board_kline_em.md +102 -0
  29. emshare-0.1.1/docs/interfaces/eastmoney/ashare_earnings/earnings_express_em.md +111 -0
  30. emshare-0.1.1/docs/interfaces/eastmoney/ashare_earnings/earnings_forecast_em.md +111 -0
  31. emshare-0.1.1/docs/interfaces/eastmoney/ashare_earnings/earnings_report_em.md +116 -0
  32. emshare-0.1.1/docs/interfaces/eastmoney/ashare_earnings/earnings_schedule_em.md +101 -0
  33. emshare-0.1.1/docs/interfaces/eastmoney/ashare_financial_statements/balance_sheet_em.md +148 -0
  34. emshare-0.1.1/docs/interfaces/eastmoney/ashare_financial_statements/cash_flow_statement_em.md +140 -0
  35. emshare-0.1.1/docs/interfaces/eastmoney/ashare_financial_statements/income_statement_em.md +137 -0
  36. emshare-0.1.1/docs/interfaces/eastmoney/ashare_indices/index_list_em.md +126 -0
  37. emshare-0.1.1/docs/interfaces/eastmoney/ashare_stocks/stock_bid_ask_em.md +101 -0
  38. emshare-0.1.1/docs/interfaces/eastmoney/ashare_stocks/stock_changes_em.md +153 -0
  39. emshare-0.1.1/docs/interfaces/eastmoney/ashare_stocks/stock_fund_flow_em.md +94 -0
  40. emshare-0.1.1/docs/interfaces/eastmoney/ashare_stocks/stock_info_em.md +79 -0
  41. emshare-0.1.1/docs/interfaces/eastmoney/ashare_stocks/stock_kline_em.md +99 -0
  42. emshare-0.1.1/docs/interfaces/eastmoney/ashare_stocks/stock_limit_pool_em.md +145 -0
  43. emshare-0.1.1/docs/interfaces/eastmoney/ashare_stocks/stock_list_all_em.md +93 -0
  44. emshare-0.1.1/docs/interfaces/eastmoney/ashare_stocks/stock_list_em.md +104 -0
  45. emshare-0.1.1/docs/interfaces/eastmoney/ashare_stocks/stock_trends_em.md +95 -0
  46. emshare-0.1.1/docs/interfaces/eastmoney/directory_tree.md +74 -0
  47. emshare-0.1.1/docs/interfaces/eastmoney/eastmoney.md +281 -0
  48. emshare-0.1.1/docs/interfaces/eastmoney/fund_market/fund_list_em.md +138 -0
  49. emshare-0.1.1/docs/interfaces/eastmoney/hk_market/hk_stock_list_em.md +120 -0
  50. emshare-0.1.1/docs/interfaces/eastmoney/overview.md +366 -0
  51. emshare-0.1.1/docs/network-policy.md +42 -0
  52. emshare-0.1.1/docs/proxy-balance-query-2026-11-16.md +14 -0
  53. emshare-0.1.1/docs/proxy-billing-offline-audit-2026-11-16.md +97 -0
  54. emshare-0.1.1/docs/proxy-free-daily-quota-2026-11-17.md +30 -0
  55. emshare-0.1.1/docs/proxy-soak-validation-2026-11-16.md +110 -0
  56. emshare-0.1.1/docs/proxy-ttl-ab-validation-2026-11-16.md +125 -0
  57. emshare-0.1.1/docs/proxy-ttl-implementation-2026-11-16.md +89 -0
  58. emshare-0.1.1/docs/proxy-ttl-quota-soak-2026-11-16.md +107 -0
  59. emshare-0.1.1/docs/proxy-usage-budget-2026-11-16.md +75 -0
  60. emshare-0.1.1/docs/proxy-usage-reconciliation-2026-11-16.md +109 -0
  61. emshare-0.1.1/docs/proxy-validation-2026-11-16.md +81 -0
  62. emshare-0.1.1/pyproject.toml +116 -0
  63. emshare-0.1.1/setup.cfg +4 -0
  64. emshare-0.1.1/src/em/__init__.py +308 -0
  65. emshare-0.1.1/src/em/__main__.py +8 -0
  66. emshare-0.1.1/src/em/application/__init__.py +1 -0
  67. emshare-0.1.1/src/em/application/catalog.py +1985 -0
  68. emshare-0.1.1/src/em/application/convenience.py +115 -0
  69. emshare-0.1.1/src/em/application/dataframe.py +1438 -0
  70. emshare-0.1.1/src/em/application/hints.py +87 -0
  71. emshare-0.1.1/src/em/application/ledger.py +152 -0
  72. emshare-0.1.1/src/em/application/market_data.py +1307 -0
  73. emshare-0.1.1/src/em/application/pagination.py +32 -0
  74. emshare-0.1.1/src/em/application/registry.py +150 -0
  75. emshare-0.1.1/src/em/application/reports.py +136 -0
  76. emshare-0.1.1/src/em/application/resolve.py +164 -0
  77. emshare-0.1.1/src/em/channels/__init__.py +1 -0
  78. emshare-0.1.1/src/em/channels/eastmoney/__init__.py +1 -0
  79. emshare-0.1.1/src/em/channels/eastmoney/ashare_billboard/__init__.py +1 -0
  80. emshare-0.1.1/src/em/channels/eastmoney/ashare_billboard/billboard_branch_active/__init__.py +8 -0
  81. emshare-0.1.1/src/em/channels/eastmoney/ashare_billboard/billboard_branch_active/billboard_branch_active_em.py +53 -0
  82. emshare-0.1.1/src/em/channels/eastmoney/ashare_billboard/billboard_branch_rank/__init__.py +8 -0
  83. emshare-0.1.1/src/em/channels/eastmoney/ashare_billboard/billboard_branch_rank/billboard_branch_rank_em.py +47 -0
  84. emshare-0.1.1/src/em/channels/eastmoney/ashare_billboard/billboard_branch_stats/__init__.py +8 -0
  85. emshare-0.1.1/src/em/channels/eastmoney/ashare_billboard/billboard_branch_stats/billboard_branch_stats_em.py +38 -0
  86. emshare-0.1.1/src/em/channels/eastmoney/ashare_billboard/billboard_branch_trades/__init__.py +8 -0
  87. emshare-0.1.1/src/em/channels/eastmoney/ashare_billboard/billboard_branch_trades/billboard_branch_trades_em.py +59 -0
  88. emshare-0.1.1/src/em/channels/eastmoney/ashare_billboard/billboard_detail/__init__.py +8 -0
  89. emshare-0.1.1/src/em/channels/eastmoney/ashare_billboard/billboard_detail/billboard_detail_em.py +56 -0
  90. emshare-0.1.1/src/em/channels/eastmoney/ashare_billboard/billboard_institution/__init__.py +8 -0
  91. emshare-0.1.1/src/em/channels/eastmoney/ashare_billboard/billboard_institution/billboard_institution_em.py +60 -0
  92. emshare-0.1.1/src/em/channels/eastmoney/ashare_billboard/billboard_institution_stats/__init__.py +8 -0
  93. emshare-0.1.1/src/em/channels/eastmoney/ashare_billboard/billboard_institution_stats/billboard_institution_stats_em.py +47 -0
  94. emshare-0.1.1/src/em/channels/eastmoney/ashare_billboard/billboard_stock/__init__.py +9 -0
  95. emshare-0.1.1/src/em/channels/eastmoney/ashare_billboard/billboard_stock/billboard_stock_em.py +72 -0
  96. emshare-0.1.1/src/em/channels/eastmoney/ashare_billboard/billboard_stock_dates/__init__.py +8 -0
  97. emshare-0.1.1/src/em/channels/eastmoney/ashare_billboard/billboard_stock_dates/billboard_stock_dates_em.py +32 -0
  98. emshare-0.1.1/src/em/channels/eastmoney/ashare_billboard/billboard_stock_stats/__init__.py +8 -0
  99. emshare-0.1.1/src/em/channels/eastmoney/ashare_billboard/billboard_stock_stats/billboard_stock_stats_em.py +52 -0
  100. emshare-0.1.1/src/em/channels/eastmoney/ashare_block_trade/__init__.py +1 -0
  101. emshare-0.1.1/src/em/channels/eastmoney/ashare_block_trade/block_trade_branch_active/__init__.py +9 -0
  102. emshare-0.1.1/src/em/channels/eastmoney/ashare_block_trade/block_trade_branch_active/block_trade_branch_active_em.py +53 -0
  103. emshare-0.1.1/src/em/channels/eastmoney/ashare_block_trade/block_trade_branch_rank/__init__.py +9 -0
  104. emshare-0.1.1/src/em/channels/eastmoney/ashare_block_trade/block_trade_branch_rank/block_trade_branch_rank_em.py +55 -0
  105. emshare-0.1.1/src/em/channels/eastmoney/ashare_block_trade/block_trade_detail/__init__.py +9 -0
  106. emshare-0.1.1/src/em/channels/eastmoney/ashare_block_trade/block_trade_detail/block_trade_detail_em.py +72 -0
  107. emshare-0.1.1/src/em/channels/eastmoney/ashare_block_trade/block_trade_market_daily/__init__.py +8 -0
  108. emshare-0.1.1/src/em/channels/eastmoney/ashare_block_trade/block_trade_market_daily/block_trade_market_daily_em.py +44 -0
  109. emshare-0.1.1/src/em/channels/eastmoney/ashare_block_trade/block_trade_stock_daily/__init__.py +8 -0
  110. emshare-0.1.1/src/em/channels/eastmoney/ashare_block_trade/block_trade_stock_daily/block_trade_stock_daily_em.py +60 -0
  111. emshare-0.1.1/src/em/channels/eastmoney/ashare_block_trade/block_trade_stock_stats/__init__.py +9 -0
  112. emshare-0.1.1/src/em/channels/eastmoney/ashare_block_trade/block_trade_stock_stats/block_trade_stock_stats_em.py +58 -0
  113. emshare-0.1.1/src/em/channels/eastmoney/ashare_boards/__init__.py +1 -0
  114. emshare-0.1.1/src/em/channels/eastmoney/ashare_boards/board_changes/__init__.py +7 -0
  115. emshare-0.1.1/src/em/channels/eastmoney/ashare_boards/board_changes/board_changes_em.py +10 -0
  116. emshare-0.1.1/src/em/channels/eastmoney/ashare_boards/board_constituent/__init__.py +8 -0
  117. emshare-0.1.1/src/em/channels/eastmoney/ashare_boards/board_constituent/board_constituent_em.py +21 -0
  118. emshare-0.1.1/src/em/channels/eastmoney/ashare_boards/board_fund_flow/__init__.py +8 -0
  119. emshare-0.1.1/src/em/channels/eastmoney/ashare_boards/board_fund_flow/board_fund_flow_em.py +18 -0
  120. emshare-0.1.1/src/em/channels/eastmoney/ashare_boards/board_industry_list/__init__.py +0 -0
  121. emshare-0.1.1/src/em/channels/eastmoney/ashare_boards/board_industry_list/board_industry_list_em.py +40 -0
  122. emshare-0.1.1/src/em/channels/eastmoney/ashare_boards/board_kline/__init__.py +9 -0
  123. emshare-0.1.1/src/em/channels/eastmoney/ashare_boards/board_kline/board_kline_em.py +32 -0
  124. emshare-0.1.1/src/em/channels/eastmoney/ashare_earnings/__init__.py +1 -0
  125. emshare-0.1.1/src/em/channels/eastmoney/ashare_earnings/earnings_express/__init__.py +8 -0
  126. emshare-0.1.1/src/em/channels/eastmoney/ashare_earnings/earnings_express/earnings_express_em.py +50 -0
  127. emshare-0.1.1/src/em/channels/eastmoney/ashare_earnings/earnings_forecast/__init__.py +8 -0
  128. emshare-0.1.1/src/em/channels/eastmoney/ashare_earnings/earnings_forecast/earnings_forecast_em.py +50 -0
  129. emshare-0.1.1/src/em/channels/eastmoney/ashare_earnings/earnings_report/__init__.py +8 -0
  130. emshare-0.1.1/src/em/channels/eastmoney/ashare_earnings/earnings_report/earnings_report_em.py +53 -0
  131. emshare-0.1.1/src/em/channels/eastmoney/ashare_earnings/earnings_schedule/__init__.py +8 -0
  132. emshare-0.1.1/src/em/channels/eastmoney/ashare_earnings/earnings_schedule/earnings_schedule_em.py +41 -0
  133. emshare-0.1.1/src/em/channels/eastmoney/ashare_financial_statements/__init__.py +1 -0
  134. emshare-0.1.1/src/em/channels/eastmoney/ashare_financial_statements/balance_sheet/__init__.py +8 -0
  135. emshare-0.1.1/src/em/channels/eastmoney/ashare_financial_statements/balance_sheet/balance_sheet_em.py +81 -0
  136. emshare-0.1.1/src/em/channels/eastmoney/ashare_financial_statements/cash_flow_statement/__init__.py +8 -0
  137. emshare-0.1.1/src/em/channels/eastmoney/ashare_financial_statements/cash_flow_statement/cash_flow_statement_em.py +74 -0
  138. emshare-0.1.1/src/em/channels/eastmoney/ashare_financial_statements/income_statement/__init__.py +8 -0
  139. emshare-0.1.1/src/em/channels/eastmoney/ashare_financial_statements/income_statement/income_statement_em.py +68 -0
  140. emshare-0.1.1/src/em/channels/eastmoney/ashare_indices/__init__.py +1 -0
  141. emshare-0.1.1/src/em/channels/eastmoney/ashare_indices/index_list/__init__.py +9 -0
  142. emshare-0.1.1/src/em/channels/eastmoney/ashare_indices/index_list/index_list_em.py +30 -0
  143. emshare-0.1.1/src/em/channels/eastmoney/ashare_stocks/__init__.py +1 -0
  144. emshare-0.1.1/src/em/channels/eastmoney/ashare_stocks/stock_bid_ask/__init__.py +8 -0
  145. emshare-0.1.1/src/em/channels/eastmoney/ashare_stocks/stock_bid_ask/stock_bid_ask_em.py +21 -0
  146. emshare-0.1.1/src/em/channels/eastmoney/ashare_stocks/stock_changes/__init__.py +9 -0
  147. emshare-0.1.1/src/em/channels/eastmoney/ashare_stocks/stock_changes/stock_changes_em.py +22 -0
  148. emshare-0.1.1/src/em/channels/eastmoney/ashare_stocks/stock_fund_flow/__init__.py +8 -0
  149. emshare-0.1.1/src/em/channels/eastmoney/ashare_stocks/stock_fund_flow/stock_fund_flow_em.py +18 -0
  150. emshare-0.1.1/src/em/channels/eastmoney/ashare_stocks/stock_info/__init__.py +9 -0
  151. emshare-0.1.1/src/em/channels/eastmoney/ashare_stocks/stock_info/stock_info_em.py +24 -0
  152. emshare-0.1.1/src/em/channels/eastmoney/ashare_stocks/stock_kline/__init__.py +10 -0
  153. emshare-0.1.1/src/em/channels/eastmoney/ashare_stocks/stock_kline/stock_kline_em.py +39 -0
  154. emshare-0.1.1/src/em/channels/eastmoney/ashare_stocks/stock_limit_pool/__init__.py +15 -0
  155. emshare-0.1.1/src/em/channels/eastmoney/ashare_stocks/stock_limit_pool/stock_limit_pool_em.py +53 -0
  156. emshare-0.1.1/src/em/channels/eastmoney/ashare_stocks/stock_list/__init__.py +10 -0
  157. emshare-0.1.1/src/em/channels/eastmoney/ashare_stocks/stock_list/stock_list_em.py +54 -0
  158. emshare-0.1.1/src/em/channels/eastmoney/ashare_stocks/stock_trends/__init__.py +8 -0
  159. emshare-0.1.1/src/em/channels/eastmoney/ashare_stocks/stock_trends/stock_trends_em.py +20 -0
  160. emshare-0.1.1/src/em/channels/eastmoney/bond_market/__init__.py +1 -0
  161. emshare-0.1.1/src/em/channels/eastmoney/config.py +195 -0
  162. emshare-0.1.1/src/em/channels/eastmoney/datacenter.py +345 -0
  163. emshare-0.1.1/src/em/channels/eastmoney/forex_market/__init__.py +1 -0
  164. emshare-0.1.1/src/em/channels/eastmoney/fund_market/__init__.py +1 -0
  165. emshare-0.1.1/src/em/channels/eastmoney/fund_market/fund_list/__init__.py +9 -0
  166. emshare-0.1.1/src/em/channels/eastmoney/fund_market/fund_list/fund_list_em.py +32 -0
  167. emshare-0.1.1/src/em/channels/eastmoney/futures_market/__init__.py +1 -0
  168. emshare-0.1.1/src/em/channels/eastmoney/global_indices/__init__.py +1 -0
  169. emshare-0.1.1/src/em/channels/eastmoney/gold_market/__init__.py +1 -0
  170. emshare-0.1.1/src/em/channels/eastmoney/hk_market/__init__.py +1 -0
  171. emshare-0.1.1/src/em/channels/eastmoney/hk_market/hk_stock_list/__init__.py +9 -0
  172. emshare-0.1.1/src/em/channels/eastmoney/hk_market/hk_stock_list/hk_stock_list_em.py +32 -0
  173. emshare-0.1.1/src/em/channels/eastmoney/mapping.py +668 -0
  174. emshare-0.1.1/src/em/channels/eastmoney/network.py +16 -0
  175. emshare-0.1.1/src/em/channels/eastmoney/option_market/__init__.py +1 -0
  176. emshare-0.1.1/src/em/channels/eastmoney/request.py +299 -0
  177. emshare-0.1.1/src/em/channels/eastmoney/source.py +195 -0
  178. emshare-0.1.1/src/em/channels/eastmoney/special_quotes/__init__.py +1 -0
  179. emshare-0.1.1/src/em/channels/eastmoney/stock_connect/__init__.py +1 -0
  180. emshare-0.1.1/src/em/channels/eastmoney/us_market/__init__.py +1 -0
  181. emshare-0.1.1/src/em/cli.py +774 -0
  182. emshare-0.1.1/src/em/core/__init__.py +1 -0
  183. emshare-0.1.1/src/em/core/budget.py +81 -0
  184. emshare-0.1.1/src/em/core/defaults.py +31 -0
  185. emshare-0.1.1/src/em/core/env.py +163 -0
  186. emshare-0.1.1/src/em/core/errors.py +108 -0
  187. emshare-0.1.1/src/em/core/fixed_proxy.py +75 -0
  188. emshare-0.1.1/src/em/core/proxy.py +1116 -0
  189. emshare-0.1.1/src/em/core/resilience.py +55 -0
  190. emshare-0.1.1/src/em/core/session.py +213 -0
  191. emshare-0.1.1/src/em/core/settings.py +186 -0
  192. emshare-0.1.1/src/em/core/transport.py +434 -0
  193. emshare-0.1.1/src/em/domain/__init__.py +6 -0
  194. emshare-0.1.1/src/em/domain/models.py +1062 -0
  195. emshare-0.1.1/src/em/domain/queries.py +398 -0
  196. emshare-0.1.1/src/em/domain/units.py +37 -0
  197. emshare-0.1.1/src/em/env.example +102 -0
  198. emshare-0.1.1/src/em/py.typed +0 -0
  199. emshare-0.1.1/src/emshare.egg-info/PKG-INFO +123 -0
  200. emshare-0.1.1/src/emshare.egg-info/SOURCES.txt +280 -0
  201. emshare-0.1.1/src/emshare.egg-info/dependency_links.txt +1 -0
  202. emshare-0.1.1/src/emshare.egg-info/entry_points.txt +2 -0
  203. emshare-0.1.1/src/emshare.egg-info/requires.txt +5 -0
  204. emshare-0.1.1/src/emshare.egg-info/top_level.txt +1 -0
  205. emshare-0.1.1/tests/__init__.py +1 -0
  206. emshare-0.1.1/tests/conftest.py +35 -0
  207. emshare-0.1.1/tests/fixtures/eastmoney/board_fund_flow_daily.json +14 -0
  208. emshare-0.1.1/tests/fixtures/eastmoney/board_kline_daily.json +25 -0
  209. emshare-0.1.1/tests/fixtures/eastmoney/clist_board.json +32 -0
  210. emshare-0.1.1/tests/fixtures/eastmoney/clist_board_industry.json +42 -0
  211. emshare-0.1.1/tests/fixtures/eastmoney/clist_fund.json +93 -0
  212. emshare-0.1.1/tests/fixtures/eastmoney/clist_hk_stock.json +69 -0
  213. emshare-0.1.1/tests/fixtures/eastmoney/clist_index.json +93 -0
  214. emshare-0.1.1/tests/fixtures/eastmoney/datacenter_billboard.json +203 -0
  215. emshare-0.1.1/tests/fixtures/eastmoney/datacenter_billboard_reports.json +720 -0
  216. emshare-0.1.1/tests/fixtures/eastmoney/datacenter_block_trade.json +515 -0
  217. emshare-0.1.1/tests/fixtures/eastmoney/datacenter_financials.json +658 -0
  218. emshare-0.1.1/tests/fixtures/eastmoney/fund_flow_daily.json +14 -0
  219. emshare-0.1.1/tests/fixtures/eastmoney/kline_daily.json +17 -0
  220. emshare-0.1.1/tests/fixtures/eastmoney/push2ex_changes.json +1005 -0
  221. emshare-0.1.1/tests/fixtures/eastmoney/push2ex_limit_pool.json +332 -0
  222. emshare-0.1.1/tests/fixtures/eastmoney/stock_get.json +217 -0
  223. emshare-0.1.1/tests/fixtures/eastmoney/trends_intraday.json +17 -0
  224. emshare-0.1.1/tests/guards/__init__.py +1 -0
  225. emshare-0.1.1/tests/guards/test_docs_sync.py +44 -0
  226. emshare-0.1.1/tests/guards/test_env_example.py +56 -0
  227. emshare-0.1.1/tests/guards/test_layering.py +46 -0
  228. emshare-0.1.1/tests/guards/test_network_boundaries.py +359 -0
  229. emshare-0.1.1/tests/unit/__init__.py +1 -0
  230. emshare-0.1.1/tests/unit/test_billboard_detail.py +103 -0
  231. emshare-0.1.1/tests/unit/test_billboard_reports.py +824 -0
  232. emshare-0.1.1/tests/unit/test_block_trade.py +778 -0
  233. emshare-0.1.1/tests/unit/test_board_changes.py +115 -0
  234. emshare-0.1.1/tests/unit/test_board_fund_flow.py +94 -0
  235. emshare-0.1.1/tests/unit/test_board_fund_flow_dataframe.py +77 -0
  236. emshare-0.1.1/tests/unit/test_board_industry_list.py +142 -0
  237. emshare-0.1.1/tests/unit/test_board_industry_list_dataframe.py +72 -0
  238. emshare-0.1.1/tests/unit/test_board_kline.py +87 -0
  239. emshare-0.1.1/tests/unit/test_board_kline_dataframe.py +53 -0
  240. emshare-0.1.1/tests/unit/test_catalog.py +606 -0
  241. emshare-0.1.1/tests/unit/test_changes_dataframe.py +90 -0
  242. emshare-0.1.1/tests/unit/test_cli.py +597 -0
  243. emshare-0.1.1/tests/unit/test_datacenter.py +424 -0
  244. emshare-0.1.1/tests/unit/test_dataframe.py +55 -0
  245. emshare-0.1.1/tests/unit/test_egress_retry.py +278 -0
  246. emshare-0.1.1/tests/unit/test_env.py +310 -0
  247. emshare-0.1.1/tests/unit/test_errors.py +33 -0
  248. emshare-0.1.1/tests/unit/test_financials.py +541 -0
  249. emshare-0.1.1/tests/unit/test_fixed_proxy.py +314 -0
  250. emshare-0.1.1/tests/unit/test_fund_flow.py +83 -0
  251. emshare-0.1.1/tests/unit/test_fund_flow_dataframe.py +74 -0
  252. emshare-0.1.1/tests/unit/test_fund_list.py +154 -0
  253. emshare-0.1.1/tests/unit/test_fund_list_dataframe.py +50 -0
  254. emshare-0.1.1/tests/unit/test_hints.py +275 -0
  255. emshare-0.1.1/tests/unit/test_hk_stock_list.py +132 -0
  256. emshare-0.1.1/tests/unit/test_hk_stock_list_dataframe.py +45 -0
  257. emshare-0.1.1/tests/unit/test_index_list.py +114 -0
  258. emshare-0.1.1/tests/unit/test_index_list_dataframe.py +54 -0
  259. emshare-0.1.1/tests/unit/test_kline.py +131 -0
  260. emshare-0.1.1/tests/unit/test_kline_dataframe.py +61 -0
  261. emshare-0.1.1/tests/unit/test_ledger.py +159 -0
  262. emshare-0.1.1/tests/unit/test_mapping.py +54 -0
  263. emshare-0.1.1/tests/unit/test_network_phases.py +144 -0
  264. emshare-0.1.1/tests/unit/test_network_policy.py +231 -0
  265. emshare-0.1.1/tests/unit/test_proxy_lifetime.py +313 -0
  266. emshare-0.1.1/tests/unit/test_proxy_pool.py +834 -0
  267. emshare-0.1.1/tests/unit/test_proxy_regressions.py +495 -0
  268. emshare-0.1.1/tests/unit/test_proxy_router.py +331 -0
  269. emshare-0.1.1/tests/unit/test_resilience.py +58 -0
  270. emshare-0.1.1/tests/unit/test_settings.py +75 -0
  271. emshare-0.1.1/tests/unit/test_source.py +139 -0
  272. emshare-0.1.1/tests/unit/test_stock_changes.py +188 -0
  273. emshare-0.1.1/tests/unit/test_stock_info_bid_ask.py +193 -0
  274. emshare-0.1.1/tests/unit/test_stock_info_bid_ask_dataframe.py +65 -0
  275. emshare-0.1.1/tests/unit/test_stock_limit_pool.py +202 -0
  276. emshare-0.1.1/tests/unit/test_stock_limit_pool_dataframe.py +78 -0
  277. emshare-0.1.1/tests/unit/test_stock_list.py +58 -0
  278. emshare-0.1.1/tests/unit/test_stock_list_all.py +341 -0
  279. emshare-0.1.1/tests/unit/test_suspicious_pages.py +36 -0
  280. emshare-0.1.1/tests/unit/test_transport.py +421 -0
  281. emshare-0.1.1/tests/unit/test_trend_dataframe.py +60 -0
  282. emshare-0.1.1/tests/unit/test_trends.py +78 -0
@@ -0,0 +1,53 @@
1
+ # 更新日志
2
+
3
+ 版本号遵循语义化版本。PyPI 发行名为 `emshare`,导入名为 `em`。
4
+
5
+ ## [0.1.1] - 2026-11-17
6
+
7
+ - 配置了动态代理源时,名称搜索改走业务客户端的代理路由:auto 模式先直连,出口被封(403/429)或直连失败自动切代理并探测回直连,always 模式全程代理;此路径的网络故障抛 `ChannelError`。未配置动态源、代理关闭或 never 时行为不变。
8
+ - 修复 auto 模式下代理源失效后主机永久停留在代理态的问题:代理池无出口且冷却期已过时放行一次单飞直连探测,成功回直连,失败重置冷却。
9
+ - 代理回源与预筛不再继承调用方剩余预算,按自身固定超时执行,避免临近超期的请求把健康 IP 判死并熔断代理源;调用方预算只决定是否再开下一轮回源。
10
+ - 回源空返回只受 1 秒负缓存约束,不再封锁到旧 IP 到期;仅重复交付在池 IP 时抑制回源。
11
+ - 后台续期按"剩余租期 ≤ 准入需求 + 提前量"触发,旧 IP 不满足准入前新批次就绪;续期失败后退避 3 秒。
12
+ - 请求成功但越过时间预算时,成功结果仍计入路由与出口状态。
13
+
14
+ - 修复代理 CONNECT/TLS 超时被误当上游读取超时的问题:受控连接按实际失败阶段分类,只有响应读取超时使用软重试;保留租期及总 deadline 限制。
15
+ - 关闭客户端或淘汰空闲代理管理器时显式关闭连接池,避免异常引用延迟释放保活连接;连接扩展仅作用于各自管理器,不修改 urllib3 全局状态。
16
+
17
+ - 移除代理使用额度保护及 SQLite 额度账本,代理采购和切换不再受免费、收费或进程新增上限影响。
18
+
19
+ - 新增 `Settings.proxy_url` / `EM_PROXY_URL` 固定代理:auto/always 直接使用,never/关闭仍直连,与动态源配置互斥;不采购、不预筛、不受短效 TTL 限制。
20
+ - 名称搜索和按名称取数支持同一 Settings,固定代理失败按不可换出口止损;隐藏固定代理认证信息的异常文本,新增出口与配置离线回归。
21
+
22
+ - 启用 Ruff TID251 与网络架构守卫,按函数限定三处会话创建和五条发送路径,拦截裸 HTTP 调用、常规别名绕过及环境代理策略修改。
23
+
24
+ - 无可替换出口时,行情主机连续两次远端断连提前终止,并传播到分页重试及补漏;保留瞬时故障恢复和动态代理轮换,不引入跨调用冷却。
25
+
26
+ - 统一业务、代理提取、预筛与名称搜索的网络策略:直连及重定向忽略环境/系统代理,动态出口只使用显式代理;保留环境 CA 证书配置与默认 TLS 校验,关闭隐式 netrc 认证。
27
+
28
+ - 路由关闭异常时仍关闭 HTTP Session;观测账本只保留 JSONL 运行指标。
29
+
30
+ - 修复后台续期虚假占用、池空隐式直连、多源全死重新入池及迟到请求污染路由状态。
31
+ - 30 秒短效代理从采购开始计时;全量分页预算传递至回源、锁等待、预筛和重试。
32
+ - 修复空末页覆盖总量、补漏误淘汰、读取超时分类及非出口 HTTP 错误误淘汰。
33
+ - 全量快照采用独立客户端与任务账本,结束释放资源;限制代理连接管理器和历史唯一 IP 集合。
34
+ - 校验无效超时、余量及非有限退避参数,实现随机退避抖动。
35
+ - 领取与复用代理时检查剩余租期,发送前再次验证并限制超时;大响应准入有上限,避免超时提示超过租期时循环采购。
36
+ - 重复交付临期 IP 时合并回源并抑制重复采购;保留有限旧出口供短预算请求使用,保存在途请求所需的租期信息。
37
+
38
+ ## [0.1.0] - 2026-11-14
39
+
40
+ ### 新增
41
+
42
+ - 首次发布:东方财富行情接口(板块 / 全市场 / K 线 / 分时 / 资金流 / 龙虎榜 / 大宗交易 / 财报等),返回领域模型。
43
+ - 可选 pandas 支持:`pip install "emshare[pandas]"` 后可用 `df_*_em` 系列。
44
+ - 动态代理池:多源冗余、预筛、连败熔断、TTL 续期、采购账本。
45
+ - 命令行入口 `emshare`(等价 `python -m em`)。
46
+ - 类型标注随包分发(`py.typed`),支持 `em.__version__`。
47
+
48
+ ### 说明
49
+
50
+ - 采购账本默认写到 `$XDG_DATA_HOME/emshare/ledger.jsonl`,不再写入当前目录;`EM_LEDGER_PATH` 可改路径或设为 `none` 关闭。
51
+ - `import em` 与命令行都会自动读取运行目录下的 `.env`,只取 `EM_` 开头的变量,已设置的环境变量优先;`EM_ENV_FILE` 可指定路径或设为 `none` 关闭。装进 site-packages 后不再去包的上级目录找 `.env`。
52
+ - `emshare --init-env` 在当前目录生成带注释的 `.env` 模板(模板随 wheel 分发,已存在则不覆盖)。
53
+ - 没配代理源而直连全部失败时,异常信息与命令行输出会写明出口可能被封以及最少要配的 `EM_PROXY_API` / `EM_PROXY_NUM`。
emshare-0.1.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 emshare contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,21 @@
1
+ # sdist 清单:wheel 由 [tool.setuptools.packages.find] 决定,这里只管源码分发。
2
+ include LICENSE README.md pyproject.toml CHANGELOG.md
3
+
4
+ # env.example 是随包分发的 .env 模板(emshare --init-env 写出的就是它),只含占位符。
5
+ recursive-include src/em *.py py.typed env.example
6
+ recursive-include tests *.py *.json
7
+ recursive-include docs *.md
8
+
9
+ # 切勿用 include .env* 之类的通配:.env 含真实凭证。
10
+ exclude .env .em_ledger.jsonl 123.txt uv.lock
11
+ prune .venv
12
+ prune .git
13
+ prune .github
14
+ prune .arts
15
+ prune .codeartsdoer
16
+ prune .mypy_cache
17
+ prune .ruff_cache
18
+ prune .pytest_cache
19
+ prune dist
20
+ prune build
21
+ global-exclude *.py[cod] .DS_Store
emshare-0.1.1/PKG-INFO ADDED
@@ -0,0 +1,123 @@
1
+ Metadata-Version: 2.4
2
+ Name: emshare
3
+ Version: 0.1.1
4
+ Summary: 行情数据接口:A 股 / 港股 / 指数 / 基金的行情、K 线、资金流、龙虎榜、财报,可选 pandas DataFrame
5
+ Author: emshare contributors
6
+ License-Expression: MIT
7
+ Keywords: quote,stock,akshare,行情
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 3 :: Only
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Topic :: Office/Business :: Financial :: Investment
16
+ Classifier: Typing :: Typed
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: requests>=2.31
21
+ Requires-Dist: urllib3<3,>=2.0
22
+ Provides-Extra: pandas
23
+ Requires-Dist: pandas>=2.0; extra == "pandas"
24
+ Dynamic: license-file
25
+
26
+ # emshare
27
+
28
+ 行情数据的 Python 接口:A 股 / 港股 / 指数 / 场内基金的行情列表、K 线、分时、资金流、板块、涨跌停股池、盘口异动、龙虎榜、大宗交易、业绩与财务报表。
29
+
30
+ - 返回带类型标注的数据对象;装上 pandas 后,每个接口都有返回 `DataFrame`(中文列名)的 `df_` 版本
31
+ - 核心功能依赖 `requests` 和 `urllib3`
32
+ - 直连被封时可自动切换到你配置的动态代理
33
+
34
+ ## 安装
35
+
36
+ ```bash
37
+ pip install emshare # 核心功能
38
+ pip install "emshare[pandas]" # 需要 DataFrame 时
39
+ ```
40
+
41
+ 要求 Python >= 3.10。**安装名是 `emshare`,导入名是 `em`。**
42
+
43
+ ## 快速开始
44
+
45
+ ```python
46
+ from em import stock_kline_em, df_stock_kline_em
47
+ from em.domain.queries import KlineQuery
48
+
49
+ # 平安银行日 K(默认前复权)
50
+ series = stock_kline_em(KlineQuery(code="000001", market="sz", period="day"))
51
+ print(series.name, len(series.items))
52
+ last = series.items[-1]
53
+ print(last.date, last.open, last.close, last.change_pct)
54
+
55
+ # 同一个查询,直接拿 DataFrame(列:日期 / 开盘 / 收盘 / 最高 / 最低 / 成交量 / ...)
56
+ df = df_stock_kline_em(KlineQuery(code="000001", market="sz", period="day"))
57
+ ```
58
+
59
+ 每个接口都是「一个查询对象进,一个结果出」;查询对象在 `em.domain.queries` 里,参数都有默认值:
60
+
61
+ ```python
62
+ from em import df_billboard_detail_em, df_stock_list_em, kline_by_name
63
+ from em.domain.queries import MarketQuery
64
+
65
+ df_stock_list_em(MarketQuery(sort="f3", size=20)) # A 股按涨跌幅排序的前 20 只
66
+ df_billboard_detail_em() # 最近一个交易日的龙虎榜
67
+ kline_by_name("贵州茅台") # 不知道代码时按名称取 K 线
68
+ ```
69
+
70
+ ## 有哪些接口
71
+
72
+ | 类别 | 接口 |
73
+ | --- | --- |
74
+ | 行情列表 | `stock_list_em` A 股、`stock_list_all_em` A 股全市场快照、`index_list_em` 指数、`hk_stock_list_em` 港股、`fund_list_em` ETF / LOF |
75
+ | K 线与分时 | `stock_kline_em`(个股 / 指数 / 基金 / 港股)、`board_kline_em`、`stock_trends_em` |
76
+ | 资金流 | `stock_fund_flow_em`、`board_fund_flow_em` |
77
+ | 板块 | `board_industry_list_em`(行业 / 概念 / 地域)、`board_constituent_em` 成分股 |
78
+ | 个股 | `stock_info_em` 基本信息、`stock_bid_ask_em` 五档盘口 |
79
+ | 盘中 | `stock_limit_pool_em` 涨跌停股池、`stock_changes_em` 盘口异动、`board_changes_em` 板块异动 |
80
+ | 龙虎榜 | `billboard_detail_em` 等 10 个 |
81
+ | 大宗交易 | `block_trade_detail_em` 等 6 个 |
82
+ | 业绩与财报 | `earnings_report_em` / `earnings_express_em` / `earnings_forecast_em` / `earnings_schedule_em`、`balance_sheet_em` / `income_statement_em` / `cash_flow_statement_em` |
83
+
84
+ 共 40 个接口,各有对应的 `df_` 版本。不必记名字,包内自带离线检索:
85
+
86
+ ```python
87
+ import em
88
+
89
+ em.search("资金流") # 按关键词找接口
90
+ em.interface_info("stock_kline_em") # 参数、返回字段、调用示例
91
+ em.list_categories() # 全部类目
92
+ ```
93
+
94
+ ## 命令行
95
+
96
+ ```bash
97
+ emshare --preset kline --code 600519 --market sh --tail 5 # 贵州茅台最近 5 根日 K
98
+ emshare --preset market --sort f3 --pz 20 # A 股涨幅榜
99
+ emshare --preset limitpool --head 20 # 涨停股池
100
+ emshare --help # 全部预设与参数
101
+ ```
102
+
103
+ ## 被封 IP 时:配置代理
104
+
105
+ 不配置也能用,默认直连。如果请求持续失败(连接被断开,或返回 403 / 429),多半是出口 IP 被封,这时需要你自己提供一个动态代理的提取接口:
106
+
107
+ ```bash
108
+ emshare --init-env # 在当前目录生成带注释的 .env 模板
109
+ ```
110
+
111
+ 至少改两项:
112
+
113
+ ```
114
+ EM_PROXY_API=<代理提取接口地址,需返回纯文本,每行一个 ip:port>
115
+ EM_PROXY_NUM=<该接口每次返回的 IP 数>
116
+ ```
117
+
118
+ `import em` 和 `emshare` 命令都会自动读取运行目录下的 `.env`(只取 `EM_` 开头的变量,已设置的环境变量优先)。配好后直连正常时不走代理,失败后才自动切换。没配代理而请求全部失败时,报错信息里会直接写明该配什么。
119
+
120
+ ## 说明
121
+
122
+ - 数据取自公开的网页接口,仅供学习与研究;字段含义与可用性以上游为准,上游调整时接口可能失效。
123
+ - 许可证:MIT。
@@ -0,0 +1,98 @@
1
+ # emshare
2
+
3
+ 行情数据的 Python 接口:A 股 / 港股 / 指数 / 场内基金的行情列表、K 线、分时、资金流、板块、涨跌停股池、盘口异动、龙虎榜、大宗交易、业绩与财务报表。
4
+
5
+ - 返回带类型标注的数据对象;装上 pandas 后,每个接口都有返回 `DataFrame`(中文列名)的 `df_` 版本
6
+ - 核心功能依赖 `requests` 和 `urllib3`
7
+ - 直连被封时可自动切换到你配置的动态代理
8
+
9
+ ## 安装
10
+
11
+ ```bash
12
+ pip install emshare # 核心功能
13
+ pip install "emshare[pandas]" # 需要 DataFrame 时
14
+ ```
15
+
16
+ 要求 Python >= 3.10。**安装名是 `emshare`,导入名是 `em`。**
17
+
18
+ ## 快速开始
19
+
20
+ ```python
21
+ from em import stock_kline_em, df_stock_kline_em
22
+ from em.domain.queries import KlineQuery
23
+
24
+ # 平安银行日 K(默认前复权)
25
+ series = stock_kline_em(KlineQuery(code="000001", market="sz", period="day"))
26
+ print(series.name, len(series.items))
27
+ last = series.items[-1]
28
+ print(last.date, last.open, last.close, last.change_pct)
29
+
30
+ # 同一个查询,直接拿 DataFrame(列:日期 / 开盘 / 收盘 / 最高 / 最低 / 成交量 / ...)
31
+ df = df_stock_kline_em(KlineQuery(code="000001", market="sz", period="day"))
32
+ ```
33
+
34
+ 每个接口都是「一个查询对象进,一个结果出」;查询对象在 `em.domain.queries` 里,参数都有默认值:
35
+
36
+ ```python
37
+ from em import df_billboard_detail_em, df_stock_list_em, kline_by_name
38
+ from em.domain.queries import MarketQuery
39
+
40
+ df_stock_list_em(MarketQuery(sort="f3", size=20)) # A 股按涨跌幅排序的前 20 只
41
+ df_billboard_detail_em() # 最近一个交易日的龙虎榜
42
+ kline_by_name("贵州茅台") # 不知道代码时按名称取 K 线
43
+ ```
44
+
45
+ ## 有哪些接口
46
+
47
+ | 类别 | 接口 |
48
+ | --- | --- |
49
+ | 行情列表 | `stock_list_em` A 股、`stock_list_all_em` A 股全市场快照、`index_list_em` 指数、`hk_stock_list_em` 港股、`fund_list_em` ETF / LOF |
50
+ | K 线与分时 | `stock_kline_em`(个股 / 指数 / 基金 / 港股)、`board_kline_em`、`stock_trends_em` |
51
+ | 资金流 | `stock_fund_flow_em`、`board_fund_flow_em` |
52
+ | 板块 | `board_industry_list_em`(行业 / 概念 / 地域)、`board_constituent_em` 成分股 |
53
+ | 个股 | `stock_info_em` 基本信息、`stock_bid_ask_em` 五档盘口 |
54
+ | 盘中 | `stock_limit_pool_em` 涨跌停股池、`stock_changes_em` 盘口异动、`board_changes_em` 板块异动 |
55
+ | 龙虎榜 | `billboard_detail_em` 等 10 个 |
56
+ | 大宗交易 | `block_trade_detail_em` 等 6 个 |
57
+ | 业绩与财报 | `earnings_report_em` / `earnings_express_em` / `earnings_forecast_em` / `earnings_schedule_em`、`balance_sheet_em` / `income_statement_em` / `cash_flow_statement_em` |
58
+
59
+ 共 40 个接口,各有对应的 `df_` 版本。不必记名字,包内自带离线检索:
60
+
61
+ ```python
62
+ import em
63
+
64
+ em.search("资金流") # 按关键词找接口
65
+ em.interface_info("stock_kline_em") # 参数、返回字段、调用示例
66
+ em.list_categories() # 全部类目
67
+ ```
68
+
69
+ ## 命令行
70
+
71
+ ```bash
72
+ emshare --preset kline --code 600519 --market sh --tail 5 # 贵州茅台最近 5 根日 K
73
+ emshare --preset market --sort f3 --pz 20 # A 股涨幅榜
74
+ emshare --preset limitpool --head 20 # 涨停股池
75
+ emshare --help # 全部预设与参数
76
+ ```
77
+
78
+ ## 被封 IP 时:配置代理
79
+
80
+ 不配置也能用,默认直连。如果请求持续失败(连接被断开,或返回 403 / 429),多半是出口 IP 被封,这时需要你自己提供一个动态代理的提取接口:
81
+
82
+ ```bash
83
+ emshare --init-env # 在当前目录生成带注释的 .env 模板
84
+ ```
85
+
86
+ 至少改两项:
87
+
88
+ ```
89
+ EM_PROXY_API=<代理提取接口地址,需返回纯文本,每行一个 ip:port>
90
+ EM_PROXY_NUM=<该接口每次返回的 IP 数>
91
+ ```
92
+
93
+ `import em` 和 `emshare` 命令都会自动读取运行目录下的 `.env`(只取 `EM_` 开头的变量,已设置的环境变量优先)。配好后直连正常时不走代理,失败后才自动切换。没配代理而请求全部失败时,报错信息里会直接写明该配什么。
94
+
95
+ ## 说明
96
+
97
+ - 数据取自公开的网页接口,仅供学习与研究;字段含义与可用性以上游为准,上游调整时接口可能失效。
98
+ - 许可证:MIT。
@@ -0,0 +1,146 @@
1
+ # AKShare 代理链路深入分析与 emshare 建议
2
+
3
+ 核查日期:2026-11-16。通过 `git ls-remote` 核对 AKShare HEAD 为 `25acdfac7ddf3a0721a0ebdcc6a1d7ef3e76abc9`,提交时间为 2026-11-15 21:58:12 +08:00,与本次分析的浅克隆一致。
4
+
5
+ 结论:AKShare 提供的是统一网络配置和请求封装,未在其核心代理链路中实现 emshare 式动态代理池。可借鉴统一入口的工程约束、显式配置和有条件停止重试;不宜移植全局可变状态、统一长退避或每次重建会话的策略。
6
+
7
+ ## 1. 实际调用链
8
+
9
+ 以 `stock_zh_a_spot_em()` 为例:
10
+
11
+ ```text
12
+ stock/quote/stock_hist_em.py:stock_zh_a_spot_em
13
+ → utils/func.py:fetch_paginated_data
14
+ → _get_page
15
+ → utils/http.py:request_with_retry(fresh_session=True)
16
+ → http.Session.request
17
+ → _apply_defaults(timeout, proxies)
18
+ → requests.Session.request
19
+ → merge_environment_settings
20
+ → Session.send → HTTPAdapter → 代理/目标服务器
21
+ ```
22
+
23
+ - 第一页决定总页数,随后串行翻页,每页前随机等待 0.5~1.5 秒。这是该分页帮助函数的行为,不是所有接口统一限速。
24
+ - `utils/context.py` 的全局单例保存 `proxies` 与 `timeout`;请求时读取,既有 Session 也能读取新配置。
25
+ - `set_proxies` 不采购 IP、不检测代理存活、不自动轮换,也不复制或校验传入字典。`get_proxies` 返回原对象。
26
+ - `ProxyContext` 只保存旧值、替换全局值、退出时恢复。普通嵌套按相反顺序退出可以工作,但不同任务交错进入退出没有隔离。
27
+ - 有些数据接口直接使用 `http.get`;它不会自动套用 `request_with_retry`。
28
+
29
+ 源码定位:AKShare `akshare/utils/context.py:13`、`akshare/utils/http.py:100`、`akshare/utils/func.py:19`、`akshare/stock/quote/stock_hist_em.py:15`。
30
+
31
+ ## 2. 代理参数不是简单的单一优先级
32
+
33
+ 以下为普通 requests 后端、本次环境 requests 2.34.2 的离线验证。假设全局代理为 A,环境 HTTPS 代理为 E:
34
+
35
+ | 调用 | HTTPS 最终代理 | 原因 |
36
+ |---|---|---|
37
+ | `http.get(url)` | A | 缺少参数,`setdefault` 注入全局配置 |
38
+ | `http.get(url, proxies=B)` | B | 显式参数保留;相同键不被环境覆盖 |
39
+ | `http.get(url, proxies=None)` | E | 参数存在,跳过全局默认;底层继续读环境 |
40
+ | `http.get(url, proxies={})` | E | 空字典不代表禁止环境代理 |
41
+ | `make_request_with_retry_json(url, proxies=None)` | A | 兼容封装主动省略 None,重新采用全局配置 |
42
+ | 未设全局代理,仅 `session.proxies=A` | E | requests 在合并 Session 配置前先加入环境代理 |
43
+
44
+ 这是按代理键合并的结果;只有 HTTP 的配置不能理解为覆盖 HTTPS,host 专用代理键与 `all` 也有各自选择规则。
45
+
46
+ **可变字典副作用:** 全局配置仅含 `http` 时,requests 会把环境 `https` 用 `setdefault` 写入同一个非空字典。随后即使环境 HTTPS 代理变化,字典里旧值仍优先。本次实验同时验证调用方原字典被修改、第二次请求继续使用旧环境值。
47
+
48
+ **并发上下文副作用:** A 进入、B 进入、A 退出、B 退出:A 请求可能使用 B 的代理;A 退出将全局值恢复为空;B 最后退出反而恢复 A,未回到初始值。通过确定性交错调用验证,无需依靠线程调度偶然触发。
49
+
50
+ 对 emshare 的启示:采用客户端级不可变配置,在请求边界生成新字典。若增加临时上下文,需要任务隔离,并明确线程池的上下文传播;不能只照搬这个全局上下文管理器。
51
+
52
+ ## 3. 重试、新连接与换 IP 是三件事
53
+
54
+ `http.request_with_retry`:
55
+
56
+ - 默认 `max_retries=3` 指总尝试数;emshare 同名配置表示额外重试数,默认 10,对应最多 11 次尝试。
57
+ - 重试连接错误、超时、传输中断,以及 429、500、502、503、504。普通 403 不在其重试状态集合。
58
+ - 等待公式为 `base_delay * 2**attempt + uniform(0, base_delay)`。
59
+ - 可选 `retry_if(response)` 识别 HTTP 200 的错误内容。
60
+ - 重试用尽后,异常路径抛最后异常;错误响应路径返回最后响应,甚至 `retry_if` 仍判定失败的 200 也可能返回。调用方仍需检查。兼容封装和 `_get_page` 又做了状态码检查。
61
+ - 未传代理参数时,每轮仍读取全局配置;如果其他代码修改全局值,重试出口可能随之改变,但这不是自动代理轮换机制。
62
+
63
+ **`fresh_session=False` 也不等于跨尝试复用 Session。** 此路径调用 `requests.request`,后者每次创建并关闭 Session;True 路径则显式创建其 Session 子类并挂载小连接池。实验中,两条路径各发生 3 次尝试,均产生 3 个不同 Session,使用同一代理地址。代理服务是否自行轮换公网出口不由这段代码决定。
64
+
65
+ emshare 已有复用连接和有界代理连接管理器。不能因为 AKShare 使用 `fresh_session=True` 就推断 emshare 应全量关闭复用;如怀疑坏连接,需要先对特定异常做有界、可比较的重建实验。
66
+
67
+ 源码定位:AKShare `akshare/utils/http.py:184`、`akshare/request.py:11`;本地 requests `requests/api.py:24`。emshare `src/em/core/transport.py:118`、`src/em/core/session.py:10`。
68
+
69
+ ## 4. push2 断连识别的价值与边界
70
+
71
+ AKShare 对指定 push2 系主机检查异常链中的 `RemoteDisconnected`、`ConnectionResetError`,同时遍历 `args`、`__cause__`、`__context__`,并用 visited 集合防循环。匹配后抛 `Push2RateLimitError`,重试循环立即结束。
72
+
73
+ 这里没有持久冷却状态、出口级失败历史或自动替换 IP;用户再次调用仍会发请求。源码里的“5 分钟”“40 分钟”是维护者观察和提示文案,不能作为我们环境的固定恢复时间。
74
+
75
+ **误判边界已复现:** 构造含 `RemoteDisconnected` 的 `ProxyError`,请求目标为 push2,同样被判为 `Push2RateLimitError`,只尝试一次。它没有先证明断连来自目标站而非代理连接。因此可以借鉴异常链遍历,但错误应保留“疑似限流/远端断连”的不确定性。
76
+
77
+ 建议 emshare 根据出口是否真正可更换决定动作:
78
+
79
+ - 直连、没有代理源,或固定代理且不能切出口:少量重试后快速失败或进入可配置冷却,避免每次业务调用又重复打同一出口。
80
+ - 动态代理路径:保留失败分级和受预算约束的换出口能力;不要一律遇到 push2 断连就终止整个任务。
81
+ - 域名识别属于东财渠道知识,适合通过渠道策略注入,避免把东财域名判断硬编码进通用 core。
82
+
83
+ 另一个小型健壮性差异:emshare `_classify` 当前遍历 args 和 cause,不遍历 context。仅把 ReadTimeout 包在 context 的构造场景被分成硬连接错误;这证明覆盖缺口,但不代表已测得真实线上发生率。
84
+
85
+ 源码定位:AKShare `akshare/utils/http.py:73`;emshare `src/em/core/transport.py:40`、`src/em/core/resilience.py:28`。
86
+
87
+ ## 5. 对 emshare 最直接的发现
88
+
89
+ ### P1:让路由决策与实际发送一致
90
+
91
+ `_create_client` 创建的 requests Session 默认 `trust_env=True`;业务直连路径传 `proxies=None`。离线拦截真实 Session.send 验证,`proxy_mode='never'` 仍使用模拟的环境 HTTPS 代理。
92
+
93
+ 影响包括:
94
+
95
+ - 直连成功率、耗时和“本机出口”错误提示可能实际对应环境代理。
96
+ - auto 的直连恢复探测可能探测的是环境代理。
97
+ - 代理供应商提取请求没有独立禁用环境代理,也会受其影响。
98
+ - 动态代理分支显式给出的 http/https 值,在相同键的合并中仍优先;不能夸大成“所有动态代理都会被环境覆盖”。
99
+
100
+ 建议显式区分继承系统代理、真正直连、固定代理和动态代理。供应商请求应有独立网络策略,默认保持不依赖业务动态代理,以免采购链路循环依赖。若用 `trust_env=False` 实现真正直连,需同步处理它对环境 CA 证书、netrc 的影响;不能把 `proxies={}` 当作修复。
101
+
102
+ 相关代码:`src/em/application/market_data.py:226`、`src/em/core/transport.py:340`、`src/em/core/proxy.py:107`、`src/em/application/resolve.py:43`。余额查询已有独立 `trust_env=False`,可参考其显式控制方式,但不意味着所有网络路径都已隔离。
103
+
104
+ ### P1:无可切换出口时,重试策略应收敛
105
+
106
+ 在未配置代理源、auto、默认重试数、持续 push2 断连的离线场景中,emshare 发出 11 次 HTTP 尝试、等待 10 次。实验将 sleep 替换为记录,未发真实请求。该结论针对一次传输层调用;外层时间预算可能提前终止,页级重试也可能再次发起调用。
107
+
108
+ 当前短退避注释基于“换的是新 IP”,但相同逻辑也被用在无法换 IP 时。建议将实际路由能力纳入重试决策,并让外层页级重试尊重冷却结果,避免只减少内层次数却仍被外层重复调用。
109
+
110
+ ### P2:统一网络入口的可执行约束
111
+
112
+ AKShare 通过 Ruff TID251 禁止业务模块直接构造 requests/curl 请求,下载文件也经 `get_buffer` 转成内存流交给 pandas。它同时测试最终送达 Session.send 的参数,避免“配置已赋值”却未实际生效。
113
+
114
+ emshare 可借鉴这一约束方式,但需要区分:业务请求、代理供应商提取、预筛、余额查询、名称搜索。它们应共享明确的网络配置规则,未必全部进入会触发代理采购的业务路由。名称搜索目前使用独立 Session;新增固定代理入口时尤其要明确它是否覆盖该路径。
115
+
116
+ Ruff 规则并非万能:新库、pandas 直接读 URL、间接包装仍需审查与最终发送参数测试。
117
+
118
+ ### P2:固定代理的便利入口
119
+
120
+ 按需增加客户端/Settings 级固定代理,适用于本地代理或企业出口;不把固定代理硬塞进短效 TTL 池,也不把“代理提取 API URL”和“代理服务器地址”混为一个配置。
121
+
122
+ 建议明确冲突处理与优先级、异常分类、来源统计和凭证脱敏;固定代理模式也不应隐式采购动态 IP。以上为建议设计,尚未实施。
123
+
124
+ ### P3:按目标与出口节流的实验
125
+
126
+ AKShare 的串行分页加随机间隔提示了“降低请求频率”这条路线。emshare 现有最少在飞分配与 worker 收敛主要约束并发,不能等价于请求速率限制。
127
+
128
+ 可在目标主机 + 出口维度做可选速率控制实验,比较成功页数/出口、失败率、采购量和总耗时。不要全量照搬每页等待 0.5~1.5 秒:它会消耗短效代理租期;也不应未经实测就合并所有东财子域的限流状态。
129
+
130
+ ## 6. 应保留的现有能力
131
+
132
+ emshare 已有 TTL/剩余租期准入、后台续期、最少在飞分配、采购单飞、多源故障转移、预筛、软失败同 IP 重试、失败淘汰、host 路由状态机、预算控制与用量记录。AKShare 的核心封装未提供对应替代实现。
133
+
134
+ curl_cffi 是 AKShare 另一条 HTTP 后端,用于部分接口的浏览器指纹兼容,并非代理池;其封装没有套用 requests 路径同样的 push2 异常识别或该重试函数。配置统一不等于两条后端的异常、超时和重试语义统一。目前没有本次实验依据支持为 emshare 全面引入它。
135
+
136
+ 还有一个独立边界:requests 的读取超时不是整个响应的总耗时上限。emshare 在请求前后检查 deadline、压缩连接/读取超时,不能据此宣称能在任意持续分块传输下硬中断在途请求。此次没有做慢速流实验,不把这一静态语义判断当作线上已发生故障。
137
+
138
+ ## 7. 验证范围与产物
139
+
140
+ - 12 个离线断言场景全部通过,使用 AKShare 实际 context/http/request 源文件及本地 requests 2.34.2。
141
+ - 用导入桩跳过 AKShare 包级依赖和未使用的 curl 后端;没有执行真实 curl_cffi,不是 AKShare 全量测试。
142
+ - 在 requests.Session.send 拦截发送,网络请求数为零,没有提取或消耗供应商 IP,没有测真实性能、封禁周期或可用率。
143
+ - 实验脚本:`.arts/akshare-proxy-review/probe.py`;详细结果:`.arts/akshare-proxy-review/results.json`。AKShare 源码快照位于 `/tmp/akshare-proxy-review-20261116`,重跑需要保留该目录。
144
+ - 本次仅新增分析报告和本地实验产物,没有修改 emshare 产品代码。
145
+
146
+ 建议实施顺序:先明确出口语义并消除环境代理歧义,再收敛不能换出口的重试,随后增加统一网络入口约束;固定代理和出口节流按需求推进。
@@ -0,0 +1,145 @@
1
+ # 工程目录结构
2
+
3
+ `em` 包采用分层 + 领域模型架构,依赖方向 `domain ← core ← channels ← application`,由 `tests/guards/test_layering.py` 守卫。本页给出整个工程的目录树;渠道内代码与文档的逐目录对照见 [eastmoney/directory_tree.md](./eastmoney/directory_tree.md)。
4
+
5
+ ```
6
+ em/ # 东方财富行情抓取
7
+ ├── src/em/ # 源码包
8
+ │ ├── domain/ # 领域模型(最内层,零渠道依赖)
9
+ │ │ ├── models.py # Quote/Kline/Trend/FundFlow/IndexQuote/HkQuote/FundQuote/LimitPoolStock/StockInfo/StockBidAsk/StockChange/BoardChange 及各自 Series/Page,BillboardEntry 及其余龙虎榜模型(BillboardStockStats/BillboardInstitutionTrade/BillboardInstitutionStats/BillboardBranchActive/BillboardBranchRank/BillboardBranchStats/BillboardBranchTrade/BillboardStockDate/BillboardSeat)、大宗交易模型(BlockTradeMarketDaily/BlockTrade/BlockTradeStockDaily/BlockTradeStockStats/BlockTradeBranchActive/BlockTradeBranchRank)、业绩与财报模型(EarningsReport/EarningsExpress/EarningsForecast/EarningsSchedule/BalanceSheet/IncomeStatement/CashFlowStatement),报表结果 ReportPage
10
+ │ │ ├── queries.py # BoardQuery/MarketQuery/KlineQuery/TrendQuery/FundFlowQuery/BoardKlineQuery/IndexListQuery/HkStockListQuery/FundListQuery/LimitPoolQuery/StockInfoQuery/StockBidAskQuery/StockChangesQuery/BoardChangesQuery/BillboardDetailQuery 及其余 9 个 Billboard*Query、6 个 BlockTrade*Query、7 个业绩与财报 Query 等
11
+ │ │ ├── units.py # 单位别名与换算(元 / % / 手 / 点 / 港元 / 股)
12
+ │ │ └── __init__.py
13
+ │ ├── core/ # 基座:配置 / 弹性 / 代理 / 传输
14
+ │ │ ├── errors.py # 异常分层 + retryable 归类
15
+ │ │ ├── settings.py # 环境变量配置(Settings.from_env)
16
+ │ │ ├── resilience.py # RetryPolicy 退避重试
17
+ │ │ ├── proxy.py # ProxyPool + ProxyRouter(预筛 / 连败熔断 / TTL 续期 / 按 host 路由)
18
+ │ │ ├── transport.py # HttpClient(重试 + 代理 + 异常归类)
19
+ │ │ ├── env.py # .env 加载:import em 时自动读取(只取 EM_ 变量;含 & 不被 bash 截断)
20
+ │ │ ├── defaults.py # 默认值常量
21
+ │ │ └── __init__.py
22
+ │ ├── channels/eastmoney/ # 东财渠道适配
23
+ │ │ ├── ashare_boards/ # 沪深京板块
24
+ │ │ │ ├── board_constituent/ # 板块成分股(board_constituent_em.py)
25
+ │ │ │ ├── board_fund_flow/ # 板块历史资金流(board_fund_flow_em.py)
26
+ │ │ │ ├── board_kline/ # 板块历史 K 线(board_kline_em.py)
27
+ │ │ │ ├── board_industry_list/ # 板块列表(board_industry_list_em.py)
28
+ │ │ │ └── board_changes/ # 板块异动(board_changes_em.py,push2ex)
29
+ │ │ ├── ashare_stocks/ # 沪深京个股
30
+ │ │ │ ├── stock_list/ # 全市场列表(stock_list_em.py)
31
+ │ │ │ ├── stock_kline/ # 历史 K 线(stock_kline_em.py)
32
+ │ │ │ ├── stock_trends/ # 分时行情(stock_trends_em.py)
33
+ │ │ │ ├── stock_fund_flow/ # 个股历史资金流(stock_fund_flow_em.py)
34
+ │ │ │ ├── stock_limit_pool/ # 涨跌停股池(stock_limit_pool_em.py,push2ex)
35
+ │ │ │ ├── stock_info/ # 个股基本信息(stock_info_em.py,stock/get)
36
+ │ │ │ ├── stock_bid_ask/ # 个股五档盘口(stock_bid_ask_em.py,stock/get)
37
+ │ │ │ └── stock_changes/ # 盘口异动(stock_changes_em.py,push2ex)
38
+ │ │ ├── ashare_billboard/ # 龙虎榜(数据中心)
39
+ │ │ │ ├── billboard_detail/ # 龙虎榜详情(billboard_detail_em.py)
40
+ │ │ │ ├── billboard_stock_stats/ # 个股上榜统计(billboard_stock_stats_em.py)
41
+ │ │ │ ├── billboard_institution/ # 机构买卖每日统计(billboard_institution_em.py)
42
+ │ │ │ ├── billboard_institution_stats/ # 机构席位追踪(billboard_institution_stats_em.py)
43
+ │ │ │ ├── billboard_branch_active/ # 每日活跃营业部(billboard_branch_active_em.py)
44
+ │ │ │ ├── billboard_branch_rank/ # 营业部排行(billboard_branch_rank_em.py)
45
+ │ │ │ ├── billboard_branch_stats/ # 营业部统计(billboard_branch_stats_em.py)
46
+ │ │ │ ├── billboard_branch_trades/ # 营业部详情(billboard_branch_trades_em.py)
47
+ │ │ │ ├── billboard_stock_dates/ # 个股上榜日期(billboard_stock_dates_em.py)
48
+ │ │ │ └── billboard_stock/ # 个股龙虎榜详情(billboard_stock_em.py)
49
+ │ │ ├── ashare_block_trade/ # 大宗交易(数据中心)
50
+ │ │ │ ├── block_trade_market_daily/ # 市场统计(block_trade_market_daily_em.py)
51
+ │ │ │ ├── block_trade_detail/ # 每日明细(block_trade_detail_em.py)
52
+ │ │ │ ├── block_trade_stock_daily/ # 每日统计(block_trade_stock_daily_em.py)
53
+ │ │ │ ├── block_trade_stock_stats/ # 活跃 A 股统计(block_trade_stock_stats_em.py)
54
+ │ │ │ ├── block_trade_branch_active/ # 活跃营业部统计(block_trade_branch_active_em.py)
55
+ │ │ │ └── block_trade_branch_rank/ # 营业部排行(block_trade_branch_rank_em.py)
56
+ │ │ ├── ashare_earnings/ # 业绩(数据中心)
57
+ │ │ │ ├── earnings_report/ # 业绩报告(earnings_report_em.py)
58
+ │ │ │ ├── earnings_express/ # 业绩快报(earnings_express_em.py)
59
+ │ │ │ ├── earnings_forecast/ # 业绩预告(earnings_forecast_em.py)
60
+ │ │ │ └── earnings_schedule/ # 预约披露时间(earnings_schedule_em.py)
61
+ │ │ ├── ashare_financial_statements/ # 三大财务报表(数据中心)
62
+ │ │ │ ├── balance_sheet/ # 资产负债表(balance_sheet_em.py)
63
+ │ │ │ ├── income_statement/ # 利润表(income_statement_em.py)
64
+ │ │ │ └── cash_flow_statement/ # 现金流量表(cash_flow_statement_em.py)
65
+ │ │ ├── ashare_indices/ # 沪深京指数
66
+ │ │ │ └── index_list/ # 指数列表(index_list_em.py)
67
+ │ │ ├── hk_market/ # 港股市场
68
+ │ │ │ └── hk_stock_list/ # 港股列表(hk_stock_list_em.py)
69
+ │ │ ├── us_market/.gitkeep # 美股市场(占位)
70
+ │ │ ├── fund_market/ # 基金市场
71
+ │ │ │ └── fund_list/ # 场内基金列表(fund_list_em.py)
72
+ │ │ ├── bond_market/.gitkeep # 债券市场(占位)
73
+ │ │ ├── global_indices/.gitkeep # 全球指数(占位)
74
+ │ │ ├── forex_market/.gitkeep # 外汇市场(占位)
75
+ │ │ ├── gold_market/.gitkeep # 黄金市场(占位)
76
+ │ │ ├── option_market/.gitkeep # 期权市场(占位)
77
+ │ │ ├── futures_market/.gitkeep # 期货市场(占位)
78
+ │ │ ├── special_quotes/.gitkeep # 特色行情(占位)
79
+ │ │ ├── stock_connect/.gitkeep # 沪深港通(占位)
80
+ │ │ ├── config.py # 域名 / 请求头 / 字段集 / 周期与复权映射
81
+ │ │ ├── request.py # ClistRequest / KlineRequest / TrendsRequest / FundFlowRequest / LimitPoolRequest / StockGetRequest / StockChangesRequest / BoardChangesRequest / DatacenterRequest
82
+ │ │ ├── datacenter.py # 数据中心报表公共部分:列映射 / 单位换算 / 过滤条件 / 单页解析
83
+ │ │ ├── mapping.py # JSONP 解析 + f* -> 领域模型
84
+ │ │ ├── source.py # 取数来源
85
+ │ │ └── __init__.py
86
+ │ ├── application/ # 组合根
87
+ │ │ ├── registry.py # 唯一的渠道入口登记
88
+ │ │ ├── market_data.py # board_constituent_em/industry_list/board_kline/market/index_list/hk_stock_list/fund_list/limit_pool/stock_info/bid_ask/stock_changes/board_changes/billboard_*(10 个龙虎榜接口)/block_trade_*(6 个大宗交易接口)/earnings_*(4 个业绩接口)/三大报表/kline/trends/fund_flow + _df 版
89
+ │ │ ├── reports.py # 数据中心报表翻页(并发取页、条数校验、取最近一天)
90
+ │ │ ├── dataframe.py # 领域模型 -> DataFrame(中文列名)
91
+ │ │ ├── catalog.py # 接口检索:search/interface_info/list_categories
92
+ │ │ ├── hints.py # 出口被封且代理用不上时的配置指引(库异常与命令行共用)
93
+ │ │ └── __init__.py
94
+ │ ├── cli.py # 命令行入口
95
+ │ ├── __main__.py # python -m em
96
+ │ ├── py.typed # PEP 561 类型标记
97
+ │ ├── env.example # 随包分发的 .env 模板(emshare --init-env 写出)
98
+ │ └── __init__.py # 公共面:*_em / df_*_em / search / interface_info
99
+ ├── tests/ # 测试
100
+ │ ├── unit/ # 单元测试(不触网,固定报文)
101
+ │ │ ├── test_kline.py # K 线映射 / 周期规范化 / 分钟级 klt
102
+ │ │ ├── test_kline_dataframe.py # K 线 DataFrame 列名
103
+ │ │ ├── test_trends.py / test_trend_dataframe.py
104
+ │ │ ├── test_fund_flow.py / test_fund_flow_dataframe.py
105
+ │ │ ├── test_board_fund_flow.py / test_board_fund_flow_dataframe.py
106
+ │ │ ├── test_board_kline.py / test_board_kline_dataframe.py
107
+ │ │ ├── test_index_list.py / test_index_list_dataframe.py
108
+ │ │ ├── test_hk_stock_list.py / test_hk_stock_list_dataframe.py
109
+ │ │ ├── test_fund_list.py / test_fund_list_dataframe.py
110
+ │ │ ├── test_stock_limit_pool.py / test_stock_limit_pool_dataframe.py
111
+ │ │ ├── test_stock_info_bid_ask.py / test_stock_info_bid_ask_dataframe.py
112
+ │ │ ├── test_stock_changes.py / test_board_changes.py / test_changes_dataframe.py
113
+ │ │ ├── test_datacenter.py # 数据中心底座:协议校验 / 单页解析 / 查询条件 / 翻页器
114
+ │ │ ├── test_billboard_detail.py
115
+ │ │ ├── test_billboard_reports.py # 龙虎榜其余 9 张报表:映射 / 请求 / 端到端取数 / DataFrame
116
+ │ │ ├── test_block_trade.py # 大宗交易 6 张报表:映射 / 请求 / 端到端取数 / DataFrame
117
+ │ │ ├── test_financials.py # 业绩与财报 7 张报表:映射 / 请求 / 端到端取数 / DataFrame
118
+ │ │ ├── test_board_industry_list.py / test_board_industry_list_dataframe.py
119
+ │ │ ├── test_dataframe.py # QuotePage DataFrame
120
+ │ │ ├── test_mapping.py # 报文映射
121
+ │ │ ├── test_catalog.py # 接口检索
122
+ │ │ ├── test_cli.py # CLI 渲染 + IP 封禁提示 + --init-env
123
+ │ │ ├── test_hints.py # 出口失败提示:何时给、内容、库异常是否携带
124
+ │ │ ├── test_proxy_pool.py / test_proxy_router.py
125
+ │ │ ├── test_transport.py / test_resilience.py
126
+ │ │ ├── test_settings.py / test_env.py
127
+ │ │ └── __init__.py
128
+ │ ├── guards/ # 架构 / 文档守卫
129
+ │ │ ├── test_layering.py # 分层依赖方向守卫
130
+ │ │ ├── test_docs_sync.py # 文档与源码同步守卫
131
+ │ │ ├── test_env_example.py # .env 模板(src/em/env.example)完整性守卫
132
+ │ │ └── __init__.py
133
+ │ ├── fixtures/eastmoney/ # 固定报文(kline/trends/fund_flow/board_fund_flow/board_kline/clist_board/clist_board_industry/clist_index/clist_hk_stock/clist_fund/push2ex_limit_pool/stock_get/push2ex_changes/datacenter_billboard/datacenter_billboard_reports/datacenter_block_trade/datacenter_financials)
134
+ │ ├── conftest.py
135
+ │ └── __init__.py
136
+ ├── docs/interfaces/eastmoney/ # 接口文档(按渠道分组,详见该目录 directory_tree.md)
137
+ ├── em_fetch.py # 抓取入口脚本(CLI 薄封装)
138
+ ├── pyproject.toml # 项目配置(ruff / pytest / mypy)
139
+ ├── uv.lock # 依赖锁
140
+ ├── README.md # 面向使用者的简短说明:GitHub 首页与 PyPI 项目页共用
141
+ └── .env # 环境变量(不入库,含代理 API 凭证;模板在 src/em/env.example)
142
+ ```
143
+
144
+ > - 除 `ashare_boards/`、`ashare_stocks/`、`ashare_billboard/`、`ashare_block_trade/`、`ashare_earnings/`、`ashare_financial_statements/`、`ashare_indices/`、`hk_market/`、`fund_market/` 外,其余市场目录暂为空占位,待对应功能实现后填充。
145
+ > - `.env`、`uv.lock`、`123.txt` 不纳入接口文档视野,仅在此标注存在。