easyquant-research 0.1.0__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 (42) hide show
  1. easyquant_research-0.1.0/.github/workflows/ci.yml +33 -0
  2. easyquant_research-0.1.0/.github/workflows/publish.yml +68 -0
  3. easyquant_research-0.1.0/.gitignore +7 -0
  4. easyquant_research-0.1.0/CHANGELOG.md +42 -0
  5. easyquant_research-0.1.0/LICENSE +202 -0
  6. easyquant_research-0.1.0/PKG-INFO +232 -0
  7. easyquant_research-0.1.0/README.md +206 -0
  8. easyquant_research-0.1.0/README.zh-CN.md +183 -0
  9. easyquant_research-0.1.0/catalog/fields.json +72 -0
  10. easyquant_research-0.1.0/catalog/functions.json +25 -0
  11. easyquant_research-0.1.0/catalog/indicators.json +4580 -0
  12. easyquant_research-0.1.0/catalog/markets.json +155 -0
  13. easyquant_research-0.1.0/catalog/rule-nodes.json +20 -0
  14. easyquant_research-0.1.0/catalog/tools.json +197 -0
  15. easyquant_research-0.1.0/docs/BOUNDARIES.md +40 -0
  16. easyquant_research-0.1.0/docs/EXPRESSION.md +70 -0
  17. easyquant_research-0.1.0/docs/MARKETS.md +33 -0
  18. easyquant_research-0.1.0/docs/RUNTIME_MCP.md +75 -0
  19. easyquant_research-0.1.0/docs/TIMING_DSL.md +49 -0
  20. easyquant_research-0.1.0/docs/WORKFLOW.md +57 -0
  21. easyquant_research-0.1.0/examples/artifact-ema-cross.json +28 -0
  22. easyquant_research-0.1.0/examples/factor-report.json +8 -0
  23. easyquant_research-0.1.0/examples/portfolio-etf.json +13 -0
  24. easyquant_research-0.1.0/examples/portfolio-momentum.json +13 -0
  25. easyquant_research-0.1.0/examples/screen-value.json +11 -0
  26. easyquant_research-0.1.0/examples/timing-ema-cross.json +14 -0
  27. easyquant_research-0.1.0/examples/timing-future-longshort.json +15 -0
  28. easyquant_research-0.1.0/pyproject.toml +63 -0
  29. easyquant_research-0.1.0/skills/easyquant-expression/SKILL.md +87 -0
  30. easyquant_research-0.1.0/skills/easyquant-research/SKILL.md +107 -0
  31. easyquant_research-0.1.0/src/easyquant_research/__init__.py +12 -0
  32. easyquant_research-0.1.0/src/easyquant_research/_resources.py +67 -0
  33. easyquant_research-0.1.0/src/easyquant_research/cli.py +413 -0
  34. easyquant_research-0.1.0/src/easyquant_research/client.py +187 -0
  35. easyquant_research-0.1.0/src/easyquant_research/mcp_server.py +303 -0
  36. easyquant_research-0.1.0/src/easyquant_research/reference.py +174 -0
  37. easyquant_research-0.1.0/tests/test_cli.py +68 -0
  38. easyquant_research-0.1.0/tests/test_client.py +147 -0
  39. easyquant_research-0.1.0/tests/test_mcp_server.py +40 -0
  40. easyquant_research-0.1.0/tests/test_reference.py +98 -0
  41. easyquant_research-0.1.0/tests/test_resources.py +47 -0
  42. easyquant_research-0.1.0/tools/export_indicator_catalog.py +84 -0
@@ -0,0 +1,33 @@
1
+ name: ci
2
+ on: [push, pull_request]
3
+ jobs:
4
+ test:
5
+ runs-on: ubuntu-latest
6
+ strategy:
7
+ matrix:
8
+ python: ["3.10", "3.12"]
9
+ steps:
10
+ - uses: actions/checkout@v4
11
+ - uses: actions/setup-python@v5
12
+ with:
13
+ python-version: ${{ matrix.python }}
14
+ - run: pip install -e '.[dev]'
15
+ - run: pytest -q
16
+ - name: examples validate against the tool schemas (offline)
17
+ run: |
18
+ python - <<'PY'
19
+ from easyquant_research import reference as ref
20
+ bad = []
21
+ for e in ref.list_examples():
22
+ doc = ref.get_example(e["name"])
23
+ issues = ref.validate_arguments(doc["tool"], doc["arguments"])
24
+ if issues:
25
+ bad.append((e["name"], issues))
26
+ assert not bad, bad
27
+ print(f"{len(ref.list_examples())} examples valid")
28
+ PY
29
+ - name: no real API keys committed
30
+ run: |
31
+ if grep -rEn 'eqk_[A-Za-z0-9]{16,}' --include='*.py' --include='*.json' --include='*.md' --include='*.toml' . ; then
32
+ echo "found what looks like a real API key"; exit 1
33
+ fi
@@ -0,0 +1,68 @@
1
+ name: publish
2
+
3
+ # Trusted publishing (OIDC) — no long-lived PyPI token.
4
+ # Before this can upload, register a trusted publisher on each index:
5
+ # PyPI → project → Publishing → add: owner openalpha-dev, repo easyquant-research,
6
+ # workflow publish.yml, environment pypi
7
+ # TestPyPI → same, environment testpypi
8
+ # A release publishes to PyPI; a manual run defaults to TestPyPI for a dry run.
9
+
10
+ on:
11
+ release:
12
+ types: [published]
13
+ workflow_dispatch:
14
+ inputs:
15
+ target:
16
+ description: "Publish target"
17
+ type: choice
18
+ options: [testpypi, pypi]
19
+ default: testpypi
20
+
21
+ permissions:
22
+ contents: read
23
+
24
+ jobs:
25
+ build:
26
+ runs-on: ubuntu-latest
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+ - uses: actions/setup-python@v5
30
+ with:
31
+ python-version: "3.12"
32
+ - run: pip install build twine
33
+ - run: python -m build
34
+ - run: twine check dist/*
35
+ - uses: actions/upload-artifact@v4
36
+ with:
37
+ name: dist
38
+ path: dist/
39
+
40
+ publish-testpypi:
41
+ needs: build
42
+ if: github.event_name == 'workflow_dispatch' && inputs.target == 'testpypi'
43
+ runs-on: ubuntu-latest
44
+ environment: testpypi
45
+ permissions:
46
+ id-token: write # OIDC token for trusted publishing
47
+ steps:
48
+ - uses: actions/download-artifact@v4
49
+ with:
50
+ name: dist
51
+ path: dist/
52
+ - uses: pypa/gh-action-pypi-publish@release/v1
53
+ with:
54
+ repository-url: https://test.pypi.org/legacy/
55
+
56
+ publish-pypi:
57
+ needs: build
58
+ if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.target == 'pypi')
59
+ runs-on: ubuntu-latest
60
+ environment: pypi
61
+ permissions:
62
+ id-token: write # OIDC token for trusted publishing
63
+ steps:
64
+ - uses: actions/download-artifact@v4
65
+ with:
66
+ name: dist
67
+ path: dist/
68
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,7 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.egg-info/
4
+ dist/
5
+ build/
6
+ .pytest_cache/
7
+ .idea/
@@ -0,0 +1,42 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 — 2026-11-13
4
+
5
+ First open-source release of the EasyQuant research client. The engine and data stay hosted; this
6
+ package ships the offline reference, the MCP bridge and the installable Agent Skills. Research only —
7
+ no order placement, no fund-account access, no strategy creation/enablement, no API-key management.
8
+
9
+ - Offline reference catalog exported from the engine: `catalog/fields.json` (per-market fields with
10
+ units and pitfalls), `catalog/functions.json` (expression functions), `catalog/indicators.json`
11
+ (132 daily-usable timing-DSL indicator types with parameters, defaults and pitfalls),
12
+ `catalog/rule-nodes.json` (timing rule tree), `catalog/markets.json` (capability trading rules;
13
+ numeric costs marked live), `catalog/tools.json` (the hosted MCP tool contract).
14
+ - `tools/export_indicator_catalog.py` regenerates the indicator catalog from the engine's
15
+ single-source indicator metadata, applying the daily-usable filter (skip non-null `dataLevel`,
16
+ `enabled == false`, `consumerVisibility == B_ONLY`, `requiresTickDrive == true`).
17
+ - Pure offline reference queries (`reference.py`): `search_fields`, `search_functions`,
18
+ `search_indicators`, `get_indicator`, `get_rule_nodes`, `list_markets`, `get_market`,
19
+ `list_examples`, `get_example`, `list_docs`, `get_doc`, `list_skills`, `get_skill`, `list_tools`,
20
+ `tool_schema`, `validate_arguments` (request-shape check against the bundled JSON Schema).
21
+ - Runtime client (`client.py`, standard library + certifi): JSON-RPC 2.0 over the stateless
22
+ request/response subset of Streamable HTTP at `POST {base}/api/agent/v1/mcp`. Bearer API key or
23
+ anonymous trial; `LoginRequired` on 401 with a trial-tool hint; `ResearchError` carries status,
24
+ code and body; `wait_job` polls `get_job` by `retry_after_seconds`. Local schema validation before
25
+ each call; prefers `structuredContent`.
26
+ - CLI `easyquant-research`: offline (`fields`, `functions`, `indicators`, `markets`, `rules`,
27
+ `examples`, `docs`, `skill`, `tools`, `validate`) and runtime (`catalog`, `screen`, `factor`,
28
+ `portfolio`, `timing`, `robustness`, `call`, `job`, `capabilities`, `submit`, `evaluate`,
29
+ `evaluation`, `evidence`). `--wait` polls jobs; exit codes 0 ok / 1 tool error / 2 usage / 3 network.
30
+ - MCP server `easyquant-research-mcp` (extra `easyquant-research[mcp]`, stdio): 14 offline reference
31
+ tools + 12 runtime bridge tools. No order tool.
32
+ - Agent Skills `easyquant-research` (research workflow) and `easyquant-expression` (fields, units,
33
+ functions, pitfalls); `easyquant-research skill --install DIR` installs them, no checkout needed.
34
+ - Six reference docs (`docs/`): expression, timing DSL, markets, workflow, boundaries, runtime MCP.
35
+ - Seven example requests (`examples/`), each `{tool, title, arguments}`, all validated against the
36
+ tool schemas: screen value, portfolio momentum, portfolio ETF, timing EMA cross, timing futures
37
+ long/short, factor report, AlphaSpec artifact.
38
+ - AlphaSpec bridge: `research_capabilities` → `submit_artifact` (research draft only) →
39
+ `evaluate_artifact` → `get_evaluation` → `get_research_evidence`. Phase 1 is A-share daily only.
40
+ - HTTPS works out of the box on Pythons with an empty trust store (python.org macOS installer): the
41
+ client falls back to certifi's bundle; `SSL_CERT_FILE` / `SSL_CERT_DIR` still take precedence.
42
+ - Bilingual README (English + 中文), Apache-2.0, CI on Python 3.10 / 3.12.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 EasyQuant contributors
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,232 @@
1
+ Metadata-Version: 2.5
2
+ Name: easyquant-research
3
+ Version: 0.1.0
4
+ Summary: Open-source MCP connector and Agent Skills for the EasyQuant historical research engine: screen, backtest and factor-check A-shares, ETFs, US/HK equities and futures. Research only — no order placement.
5
+ Project-URL: Homepage, https://www.goeasyquant.com
6
+ Project-URL: Repository, https://github.com/openalpha-dev/easyquant-research
7
+ Project-URL: Runtime, https://trade.goeasyquant.com
8
+ Author: EasyQuant contributors
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: a-share,agent-skills,ai-agent,algorithmic-trading,alpha,alphaspec,backtest,backtesting,claude,cursor,etf,factor,factor-investing,factor-research,fintech,futures,hk-stocks,llm,mcp,model-context-protocol,momentum,paper-trading,point-in-time,portfolio,python,quant,quantitative-finance,quantitative-research,quantitative-trading,stock-screener,stock-screening,strategy-dsl,systematic-trading,technical-analysis,technical-indicators,timing,trading-strategy,us-equities
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Financial and Insurance Industry
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Office/Business :: Financial :: Investment
17
+ Requires-Python: >=3.10
18
+ Requires-Dist: certifi>=2023.7.22
19
+ Requires-Dist: jsonschema>=4.18
20
+ Provides-Extra: dev
21
+ Requires-Dist: mcp>=1.2; extra == 'dev'
22
+ Requires-Dist: pytest>=7; extra == 'dev'
23
+ Provides-Extra: mcp
24
+ Requires-Dist: mcp>=1.2; extra == 'mcp'
25
+ Description-Content-Type: text/markdown
26
+
27
+ # EasyQuant Research
28
+
29
+ **Open-source MCP connector and Agent Skills for quantitative trading research on the EasyQuant engine — stock screening, portfolio & timing backtesting, and factor / alpha research across China A-shares, ETFs, US/HK equities and futures. Point-in-time, Python, research only.**
30
+
31
+ [中文说明](README.zh-CN.md) ·
32
+ [Expression](docs/EXPRESSION.md) ·
33
+ [Timing DSL](docs/TIMING_DSL.md) ·
34
+ [Markets](docs/MARKETS.md) ·
35
+ [Runtime MCP](docs/RUNTIME_MCP.md) ·
36
+ [Engine: EasyQuant](https://www.goeasyquant.com)
37
+
38
+ `easyquant-research` is the open client side of the EasyQuant research engine. The engine and its
39
+ data stay hosted; this package ships what an agent needs to use them honestly:
40
+
41
+ - an **offline reference catalog** — fields with units, expression functions, timing-DSL indicators
42
+ with parameters and pitfalls, market trading rules, examples and docs, exported from the engine;
43
+ - an **MCP bridge** — a stdio MCP server and a Python/CLI client that forward requests to the hosted
44
+ research MCP over HTTPS;
45
+ - **installable Agent Skills** that teach an agent to look things up before guessing, validate the
46
+ request shape, poll async jobs, and quote only the numbers the engine returned.
47
+
48
+ There is **no local backtest engine here and no fabricated results**. Offline tools look things up
49
+ and check argument shape (quota-free); runtime tools call the engine, which does the computing.
50
+
51
+ ```bash
52
+ pip install "easyquant-research[mcp]"
53
+ easyquant-research fields --market cn_stock --search 估值 # offline, no quota
54
+ easyquant-research screen --condition "(roe_yearly > 15) * (close > MA(close, 60))"
55
+ ```
56
+
57
+ ## Why a client, and why open
58
+
59
+ AI made writing strategies cheap; it did not make trusting them cheap. An agent can produce a
60
+ hundred candidate ideas in an afternoon, but it cannot tell on its own which survive look-ahead
61
+ bias, multiple testing and real trading rules. That verification needs a real engine with
62
+ point-in-time data and the market's own trading rules — and it needs the agent to use that engine
63
+ without inventing fields, units or performance figures.
64
+
65
+ This package is the boundary that makes that possible. The reference catalog is exported from the
66
+ same engine that runs the backtest, so the field an agent writes is the field the engine reads. The
67
+ skills enforce the discipline: look up before guessing, validate the shape before spending a call,
68
+ relay caveats, never quote a number the engine did not return. The engine itself — data, costs,
69
+ matching, gate — stays hosted, where it can be kept correct and point-in-time.
70
+
71
+ It pairs with **[AlphaSpec](https://www.goeasyquant.com)**, the open strategy-document contract:
72
+ AlphaSpec defines what a strategy *is* (a checkable JSON rule tree); `easyquant-research` is how an
73
+ agent *researches* one on EasyQuant — screen, backtest, factor-check, then `submit_artifact` an
74
+ AlphaSpec document as a research draft. Same engine, same vocabulary, no private shortcut.
75
+
76
+ ## What it covers
77
+
78
+ | Market | `market` | Screen | Portfolio backtest | Timing backtest | Factor checkup |
79
+ |---|---|---|---|---|---|
80
+ | China A-shares | `cn_stock` (default) | ✓ | ✓ | ✓ | ✓ |
81
+ | On-exchange ETFs | `cn_etf` | ✓ | ✓ | ✓ | — |
82
+ | US equities | `us_equity` | ✓ | ✓ | ✓ | — |
83
+ | HK equities | `hk_stock` | ✓ | ✓ | ✓ | — |
84
+ | Futures (main continuous) | `cn_future` | ✓ | ✓ (long/short) | ✓ (long/short) | — |
85
+
86
+ Use it as a **stock screener**, a **portfolio backtester**, a single-symbol **timing backtester**, or
87
+ a **factor-investing / alpha-research** tool. The timing DSL ships 130+ daily-usable **technical
88
+ indicators** (SMA, EMA, MACD, RSI, ATR, …) with written parameters and pitfalls; the expression
89
+ language covers valuation, fundamentals, momentum, value, quality, volatility and liquidity factors.
90
+
91
+ Only A-shares carry valuation, financials and global factors; the other markets are price-volume
92
+ based. Futures use a variety root (e.g. `RB`), back-adjusted at rolls, and can be shorted. Market
93
+ rules are scoped, not removed: China's T+1, price-limit fills and lot sizes apply where they exist.
94
+ Numeric costs (commission, tax, slippage, lot size) are returned live by the engine, not hard-coded
95
+ here. See [docs/MARKETS.md](docs/MARKETS.md).
96
+
97
+ ## Getting started
98
+
99
+ ### Command line
100
+
101
+ ```bash
102
+ pip install easyquant-research
103
+
104
+ # Offline reference — no network, no quota
105
+ easyquant-research fields --market cn_stock --search roe
106
+ easyquant-research functions --search CROSS
107
+ easyquant-research indicators --type MACD # parameters, defaults, pitfalls
108
+ easyquant-research rules # timing-DSL rule-tree reference
109
+ easyquant-research examples # requests to start from
110
+ easyquant-research validate screen --file req.json # check argument shape
111
+
112
+ # Runtime — reads EASYQUANT_BASE_URL / EASYQUANT_API_KEY (anonymous trial without a key)
113
+ export EASYQUANT_API_KEY=eqk_... # created in the engine's account page
114
+ easyquant-research catalog # live fields, data date, quota, global factors
115
+ easyquant-research screen --condition "(pe_ttm > 0) * (pe_ttm < 15) * (dv_ttm > 3)"
116
+ easyquant-research portfolio --file examples/portfolio-momentum.json --wait
117
+ easyquant-research timing --file examples/timing-ema-cross.json --wait
118
+ easyquant-research factor --expression "incttm_n_income_attr_p / total_mv" --wait
119
+ ```
120
+
121
+ ### Python
122
+
123
+ ```python
124
+ from easyquant_research import Client, reference as ref
125
+
126
+ ref.search_fields("估值", "cn_stock") # offline, quota-free
127
+ ref.validate_arguments("screen", {"condition": "roe_yearly > 15"})
128
+
129
+ c = Client() # reads EASYQUANT_BASE_URL / EASYQUANT_API_KEY
130
+ hits = c.call("screen", {"condition": "(roe_yearly > 15) * (close > MA(close, 60))"})
131
+ res = c.call("backtest_portfolio", {"rank_by": "close / REF(close, 60) - 1", "top_n": 30})
132
+ if res.get("job_id"):
133
+ res = c.wait_job(res["job_id"]) # polls get_job by retry_after_seconds
134
+ ```
135
+
136
+ ### Agent Skill (agents that can run commands)
137
+
138
+ ```bash
139
+ easyquant-research skill --install ~/.claude/skills # or your agent's skills directory
140
+ ```
141
+
142
+ This installs two skills. `easyquant-research` teaches the agent the whole research workflow:
143
+ pick a market, start from an example, look fields/indicators up instead of guessing, validate the
144
+ request shape, call the runtime, poll jobs, submit AlphaSpec drafts, and report only returned
145
+ numbers with their caveats. `easyquant-expression` teaches it to turn a selection or timing idea
146
+ into a correct expression — fields, units, functions and the pitfalls that silently produce wrong
147
+ results (market cap in 万元, percentages as plain numbers, loss-making PE empty, adjusted vs raw
148
+ price).
149
+
150
+ ### MCP (agents without a shell)
151
+
152
+ ```json
153
+ {
154
+ "mcpServers": {
155
+ "easyquant-research": {
156
+ "command": "easyquant-research-mcp",
157
+ "env": { "EASYQUANT_API_KEY": "eqk_..." }
158
+ }
159
+ }
160
+ }
161
+ ```
162
+
163
+ The client speaks MCP to a local `easyquant-research-mcp` process over stdio; that process calls the
164
+ hosted engine over HTTPS with the same client as the CLI, so the key only ever goes to the engine.
165
+ Clients that support streamable-http + OAuth can connect to the engine directly at
166
+ `https://trade.goeasyquant.com/api/agent/v1/mcp`. See [docs/RUNTIME_MCP.md](docs/RUNTIME_MCP.md).
167
+
168
+ Tools: `search_fields`, `search_functions`, `search_indicators`, `get_indicator`, `get_rule_nodes`,
169
+ `list_markets`, `get_market`, `list_examples`, `get_example`, `get_doc`, `list_skills`, `get_skill`,
170
+ `list_research_tools`, `validate_arguments` (offline) and `catalog`, `screen`, `backtest_portfolio`,
171
+ `backtest_timing`, `factor_report`, `robustness`, `get_job`, `research_capabilities`,
172
+ `submit_artifact`, `evaluate_artifact`, `get_evaluation`, `get_research_evidence` (runtime).
173
+ **There is no order tool.**
174
+
175
+ ## Research only
176
+
177
+ Every tool here is historical research. No tool can place orders, touch fund accounts, create or
178
+ enable trading strategies, or manage API keys. An API key works only under `/api/agent/v1/**`; the
179
+ agent passes through exactly the same door as a person, and that door does not lead to execution.
180
+ `submit_artifact` creates a research draft, never a trading strategy. The skills require the agent
181
+ to quote only returned numbers, relay caveats, and give no buy/sell advice on individual names.
182
+
183
+ To **create a strategy and run it in paper trading (simulation)**, log in to the hosted EasyQuant
184
+ platform — strategy creation and paper/live execution live there, outside this package:
185
+ [https://trade.goeasyquant.com/welcome](https://trade.goeasyquant.com/welcome)
186
+ (English: [https://trade.goeasyquant.com/en/welcome](https://trade.goeasyquant.com/en/welcome)).
187
+ The platform offers a visual strategy canvas, AI-assisted research, backtesting and paper trading;
188
+ drafts are previewed first and you approve saves and runs.
189
+
190
+ ## About EasyQuant
191
+
192
+ [EasyQuant](https://www.goeasyquant.com) is a quantitative strategy delivery platform: research,
193
+ backtesting, paper trading and live execution on one engine, so the number you saw in a backtest is
194
+ computed the same way as the order that reaches the market. This package opens its **research**
195
+ surface — the same public API its own AI research assistant uses, and nothing more. The
196
+ [personal edition](https://trade.goeasyquant.com) lets any user create an API key for free; an
197
+ anonymous trial covers the six read-only research tools without a key.
198
+
199
+ ## Repository layout
200
+
201
+ ```
202
+ catalog/ offline reference exported from the engine (fields, functions, indicators,
203
+ rule nodes, markets, tool contract)
204
+ examples/ example requests, each {tool, title, arguments}, validated against the schemas
205
+ docs/ expression, timing DSL, markets, workflow, boundaries, runtime MCP
206
+ src/easyquant_research/ reference queries, runtime client, CLI, MCP server
207
+ skills/ Agent Skills (easyquant-research, easyquant-expression)
208
+ tools/ export_indicator_catalog.py — regenerate the indicator catalog from the engine
209
+ tests/ offline + mocked-transport tests (no network)
210
+ ```
211
+
212
+ The wheel carries a copy of `catalog/`, `examples/`, `docs/` and `skills/` under
213
+ `easyquant_research/_data`, so an installed skill reaches everything through the CLI without a
214
+ checkout. The indicator catalog is reproducible: `python tools/export_indicator_catalog.py` reads
215
+ the engine's single-source indicator metadata and rewrites `catalog/indicators.json`.
216
+
217
+ ## Keywords
218
+
219
+ Quantitative trading · quantitative research · quantitative finance · algorithmic trading ·
220
+ systematic trading · backtesting · stock screener · stock screening · stock selection ·
221
+ factor investing · factor research · alpha factors · alpha research · technical analysis ·
222
+ technical indicators · trading strategy · strategy DSL · declarative strategy · rule-based strategy ·
223
+ timing strategy · portfolio backtest · rebalancing · momentum · value · quality · volatility ·
224
+ liquidity · market neutral · Barra style factors · Rank IC · ICIR · Sharpe ratio · drawdown ·
225
+ point-in-time data · look-ahead bias · survivorship bias · overfitting · deflated Sharpe ·
226
+ China A-shares · ETF · futures · US equities · HK stocks · MCP · Model Context Protocol ·
227
+ AI agent · LLM · Claude · Cursor · Codex · Agent Skills · Python · open source · fintech ·
228
+ AlphaSpec · EasyQuant · paper trading.
229
+
230
+ ## License
231
+
232
+ Apache-2.0