opentrade 1.0.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.
- opentrade-1.0.0/LICENSE +21 -0
- opentrade-1.0.0/PKG-INFO +637 -0
- opentrade-1.0.0/README.md +622 -0
- opentrade-1.0.0/opentrade/__init__.py +9 -0
- opentrade-1.0.0/opentrade/__main__.py +9 -0
- opentrade-1.0.0/opentrade/app.py +12 -0
- opentrade-1.0.0/opentrade/backends/__init__.py +21 -0
- opentrade-1.0.0/opentrade/backends/akshare_provider.py +498 -0
- opentrade-1.0.0/opentrade/backends/auto_planner.py +239 -0
- opentrade-1.0.0/opentrade/backends/base.py +234 -0
- opentrade-1.0.0/opentrade/backends/efinance_provider.py +868 -0
- opentrade-1.0.0/opentrade/backends/factory.py +46 -0
- opentrade-1.0.0/opentrade/backends/providers.py +31 -0
- opentrade-1.0.0/opentrade/backends/providers_common.py +588 -0
- opentrade-1.0.0/opentrade/backends/resolver.py +91 -0
- opentrade-1.0.0/opentrade/backends/yfinance_provider.py +1034 -0
- opentrade-1.0.0/opentrade/command_catalog.py +786 -0
- opentrade-1.0.0/opentrade/commands.py +423 -0
- opentrade-1.0.0/opentrade/const/__init__.py +0 -0
- opentrade-1.0.0/opentrade/const/command_catalog_data.py +1806 -0
- opentrade-1.0.0/opentrade/contracts.py +218 -0
- opentrade-1.0.0/opentrade/enrichment/__init__.py +15 -0
- opentrade-1.0.0/opentrade/enrichment/indicators.py +179 -0
- opentrade-1.0.0/opentrade/enrichment/levels.py +40 -0
- opentrade-1.0.0/opentrade/enrichment/service.py +300 -0
- opentrade-1.0.0/opentrade/executor.py +322 -0
- opentrade-1.0.0/opentrade/facade.py +109 -0
- opentrade-1.0.0/opentrade/indicators/__init__.py +164 -0
- opentrade-1.0.0/opentrade/indicators/base.py +162 -0
- opentrade-1.0.0/opentrade/indicators/chinese.py +205 -0
- opentrade-1.0.0/opentrade/indicators/momentum.py +226 -0
- opentrade-1.0.0/opentrade/indicators/price.py +84 -0
- opentrade-1.0.0/opentrade/indicators/trend.py +332 -0
- opentrade-1.0.0/opentrade/indicators/utils.py +109 -0
- opentrade-1.0.0/opentrade/indicators/volatility.py +78 -0
- opentrade-1.0.0/opentrade/indicators/volume.py +170 -0
- opentrade-1.0.0/opentrade/main.py +27 -0
- opentrade-1.0.0/opentrade/models.py +331 -0
- opentrade-1.0.0/opentrade/observation.py +1127 -0
- opentrade-1.0.0/opentrade/rendering.py +663 -0
- opentrade-1.0.0/opentrade/request_schema.py +274 -0
- opentrade-1.0.0/opentrade/retry_utils.py +123 -0
- opentrade-1.0.0/opentrade.egg-info/PKG-INFO +637 -0
- opentrade-1.0.0/opentrade.egg-info/SOURCES.txt +64 -0
- opentrade-1.0.0/opentrade.egg-info/dependency_links.txt +1 -0
- opentrade-1.0.0/opentrade.egg-info/entry_points.txt +3 -0
- opentrade-1.0.0/opentrade.egg-info/requires.txt +6 -0
- opentrade-1.0.0/opentrade.egg-info/top_level.txt +1 -0
- opentrade-1.0.0/pyproject.toml +22 -0
- opentrade-1.0.0/setup.cfg +4 -0
- opentrade-1.0.0/tests/test_cli_full_regression.py +492 -0
- opentrade-1.0.0/tests/test_contracts_unit.py +177 -0
- opentrade-1.0.0/tests/test_enrichment_edge.py +162 -0
- opentrade-1.0.0/tests/test_enrichment_smoke.py +109 -0
- opentrade-1.0.0/tests/test_executor_regression.py +200 -0
- opentrade-1.0.0/tests/test_facade_unit.py +618 -0
- opentrade-1.0.0/tests/test_indicators_full.py +434 -0
- opentrade-1.0.0/tests/test_indicators_smoke.py +114 -0
- opentrade-1.0.0/tests/test_multi_backend_scaffold.py +1031 -0
- opentrade-1.0.0/tests/test_observation_smoke.py +856 -0
- opentrade-1.0.0/tests/test_provider_contracts_fix.py +259 -0
- opentrade-1.0.0/tests/test_provider_handlers_extended.py +657 -0
- opentrade-1.0.0/tests/test_regression_reporting.py +256 -0
- opentrade-1.0.0/tests/test_rendering_and_metrics_regression.py +432 -0
- opentrade-1.0.0/tests/test_retry_regression.py +246 -0
- opentrade-1.0.0/tests/test_schema_and_resolver.py +375 -0
opentrade-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 吳子豪
|
|
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.
|
opentrade-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,637 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: opentrade
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Market data in your terminal, shaped for humans, scripts, and agents.
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Dist: akshare>=1.18.64
|
|
9
|
+
Requires-Dist: click>=8.4.1
|
|
10
|
+
Requires-Dist: efinance>=0.5.8
|
|
11
|
+
Requires-Dist: pandas
|
|
12
|
+
Requires-Dist: vortezwohl>=0.1.3
|
|
13
|
+
Requires-Dist: yfinance>=1.4.1
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
<div align="center">
|
|
17
|
+
<h1>OpenTrade</h1>
|
|
18
|
+
<p><strong>Market data in your terminal, shaped for humans, scripts, and agents.</strong></p>
|
|
19
|
+
<p>Search instruments, resolve quote IDs, inspect live quotes, review history, export datasets, and read indicator-rich <code>observation</code> output from one consistent command tree.</p>
|
|
20
|
+
<p>
|
|
21
|
+
<a href="https://www.python.org/"><img alt="Python 3.10+" src="https://img.shields.io/badge/Python-3.10%2B-2F5D8C"></a>
|
|
22
|
+
<a href="https://pypi.org/project/opentrade/"><img alt="PyPI package" src="https://img.shields.io/badge/PyPI-opentrade-2563EB"></a>
|
|
23
|
+
<a href="https://pypi.org/project/akshare/"><img alt="Backend akshare" src="https://img.shields.io/badge/Backend-akshare-1D4ED8"></a>
|
|
24
|
+
<a href="https://pypi.org/project/efinance/"><img alt="Backend efinance" src="https://img.shields.io/badge/Backend-efinance-B45309"></a>
|
|
25
|
+
<a href="https://pypi.org/project/yfinance/"><img alt="Backend yfinance" src="https://img.shields.io/badge/Backend-yfinance-15803D"></a>
|
|
26
|
+
<img alt="Default view observation" src="https://img.shields.io/badge/Default%20View-observation-0F766E">
|
|
27
|
+
<img alt="Indicator enrichment" src="https://img.shields.io/badge/Indicators-basic%20%7C%20advanced%20%7C%20full-7C3AED">
|
|
28
|
+
</p>
|
|
29
|
+
<p>
|
|
30
|
+
<a href="#installation">Installation</a> ·
|
|
31
|
+
<a href="#thirty-second-start">30-second start</a> ·
|
|
32
|
+
<a href="#command-map">Command map</a> ·
|
|
33
|
+
<a href="#output-model">Output model</a> ·
|
|
34
|
+
<a href="#indicator-coverage">Indicator coverage</a> ·
|
|
35
|
+
<a href="#observation-examples">Observation examples</a>
|
|
36
|
+
</p>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<p align="center"><strong>English | <a href="i18n/README.zh-CN.md">简体中文</a> | <a href="i18n/README.zh-TW.md">繁體中文</a></strong></p>
|
|
40
|
+
|
|
41
|
+
<table width="100%">
|
|
42
|
+
<tr>
|
|
43
|
+
<td width="33%" valign="top">
|
|
44
|
+
<strong>Discoverable</strong><br />
|
|
45
|
+
A task-shaped command tree makes it easier to find the right entrypoint than browsing raw upstream functions.
|
|
46
|
+
</td>
|
|
47
|
+
<td width="33%" valign="top">
|
|
48
|
+
<strong>Readable</strong><br />
|
|
49
|
+
The CLI keeps terminal output consistent across <code>table</code>, <code>json</code>, <code>csv</code>, and <code>tsv</code>, with <code>observation</code> as the default view.
|
|
50
|
+
</td>
|
|
51
|
+
<td width="33%" valign="top">
|
|
52
|
+
<strong>Indicator-rich</strong><br />
|
|
53
|
+
Compatible commands can be enriched with a broad built-in technical-indicator set for screening, review, and downstream analysis.
|
|
54
|
+
</td>
|
|
55
|
+
</tr>
|
|
56
|
+
</table>
|
|
57
|
+
|
|
58
|
+
<a id="installation"></a>
|
|
59
|
+
## Installation
|
|
60
|
+
|
|
61
|
+
Install the published PyPI package `opentrade`. The package exposes both `opentrade` and `optr`.
|
|
62
|
+
|
|
63
|
+
<table width="100%">
|
|
64
|
+
<tr>
|
|
65
|
+
<td width="50%" valign="top">
|
|
66
|
+
<strong>uv</strong>
|
|
67
|
+
<pre lang="bash"><code>uv add -U opentrade
|
|
68
|
+
opentrade --help</code></pre>
|
|
69
|
+
</td>
|
|
70
|
+
<td width="50%" valign="top">
|
|
71
|
+
<strong>pip</strong>
|
|
72
|
+
<pre lang="bash"><code>pip install -U opentrade
|
|
73
|
+
opentrade --help</code></pre>
|
|
74
|
+
</td>
|
|
75
|
+
</tr>
|
|
76
|
+
</table>
|
|
77
|
+
|
|
78
|
+
Python `3.10+` is required.
|
|
79
|
+
|
|
80
|
+
<a id="what-this-tool-is"></a>
|
|
81
|
+
## What This Tool Is
|
|
82
|
+
|
|
83
|
+
> `opentrade` is a product layer on top of upstream market-data providers, not a loose script collection.
|
|
84
|
+
|
|
85
|
+
It reorganizes upstream capability into a public command tree that is easier to browse from a terminal, easier to automate from scripts, and easier to consume in structured output. The goal is not to replace the upstream market-data library. The goal is to make that capability more stable and more usable from a CLI.
|
|
86
|
+
|
|
87
|
+
<a id="thirty-second-start"></a>
|
|
88
|
+
## 30-Second Start
|
|
89
|
+
|
|
90
|
+
<table width="100%">
|
|
91
|
+
<tr>
|
|
92
|
+
<td width="33%" valign="top">
|
|
93
|
+
<strong>1. Search first</strong>
|
|
94
|
+
<pre lang="bash"><code>opentrade search --query AAPL --market US_stock --result-count 5 --format json</code></pre>
|
|
95
|
+
Start here when you only know a ticker, keyword, or company name.
|
|
96
|
+
</td>
|
|
97
|
+
<td width="33%" valign="top">
|
|
98
|
+
<strong>2. Query shared quotes directly</strong>
|
|
99
|
+
<pre lang="bash"><code>opentrade quote price latest --symbols AAPL --format json</code></pre>
|
|
100
|
+
Shared <code>quote</code> commands take cross-backend symbols or tickers such as <code>AAPL</code> directly.
|
|
101
|
+
</td>
|
|
102
|
+
<td width="33%" valign="top">
|
|
103
|
+
<strong>3. Query market data</strong>
|
|
104
|
+
<pre lang="bash"><code>opentrade stock price history --symbols AAPL --market us_stock --start-date 20250102 --end-date 20250501 --format json</code></pre>
|
|
105
|
+
Continue from there into history, latest quotes, watch loops, and export workflows.
|
|
106
|
+
</td>
|
|
107
|
+
</tr>
|
|
108
|
+
</table>
|
|
109
|
+
|
|
110
|
+
<a id="main-functions"></a>
|
|
111
|
+
## Main Functions
|
|
112
|
+
|
|
113
|
+
<table width="100%">
|
|
114
|
+
<tr>
|
|
115
|
+
<td width="50%" valign="top">
|
|
116
|
+
<strong>Instrument discovery</strong>
|
|
117
|
+
<ul>
|
|
118
|
+
<li>Search instruments by keyword.</li>
|
|
119
|
+
<li>Resolve symbols into 东方财富 <code>quote_id</code> when a provider-specific workflow needs it.</li>
|
|
120
|
+
<li>Move from discovery into quote and history queries without switching tools.</li>
|
|
121
|
+
</ul>
|
|
122
|
+
</td>
|
|
123
|
+
<td width="50%" valign="top">
|
|
124
|
+
<strong>Cross-asset data access</strong>
|
|
125
|
+
<ul>
|
|
126
|
+
<li>Query stocks, funds, bonds, futures, and market-level live data.</li>
|
|
127
|
+
<li>Read both latest quotes and historical series.</li>
|
|
128
|
+
<li>Run refresh loops with one shared watch model.</li>
|
|
129
|
+
</ul>
|
|
130
|
+
</td>
|
|
131
|
+
</tr>
|
|
132
|
+
<tr>
|
|
133
|
+
<td width="50%" valign="top">
|
|
134
|
+
<strong>Structured output</strong>
|
|
135
|
+
<ul>
|
|
136
|
+
<li>Export as <code>table</code>, <code>json</code>, <code>csv</code>, or <code>tsv</code>.</li>
|
|
137
|
+
<li>Use <code>observation</code> as the default public-facing view.</li>
|
|
138
|
+
<li>Fallback to <code>raw</code> when downstream consumers need the unwrapped shape.</li>
|
|
139
|
+
</ul>
|
|
140
|
+
</td>
|
|
141
|
+
<td width="50%" valign="top">
|
|
142
|
+
<strong>Indicator enrichment</strong>
|
|
143
|
+
<ul>
|
|
144
|
+
<li>Choose <code>basic</code>, <code>advanced</code>, or <code>full</code>.</li>
|
|
145
|
+
<li>Expose trend, momentum, volatility, volume, and structure indicators.</li>
|
|
146
|
+
<li>Produce richer market context for review, screening, and automation.</li>
|
|
147
|
+
</ul>
|
|
148
|
+
</td>
|
|
149
|
+
</tr>
|
|
150
|
+
</table>
|
|
151
|
+
|
|
152
|
+
<a id="command-map"></a>
|
|
153
|
+
## Command Map
|
|
154
|
+
|
|
155
|
+
<table>
|
|
156
|
+
<thead>
|
|
157
|
+
<tr>
|
|
158
|
+
<th align="left">Top-level command</th>
|
|
159
|
+
<th align="left">Role</th>
|
|
160
|
+
<th align="left">Typical use</th>
|
|
161
|
+
</tr>
|
|
162
|
+
</thead>
|
|
163
|
+
<tbody>
|
|
164
|
+
<tr>
|
|
165
|
+
<td><code>search</code></td>
|
|
166
|
+
<td>Keyword-based discovery.</td>
|
|
167
|
+
<td>Find candidates before you know the exact identifier.</td>
|
|
168
|
+
</tr>
|
|
169
|
+
<tr>
|
|
170
|
+
<td><code>resolve</code></td>
|
|
171
|
+
<td>Identifier resolution.</td>
|
|
172
|
+
<td>Turn a symbol into an 东方财富 <code>quote_id</code> for provider-specific workflows.</td>
|
|
173
|
+
</tr>
|
|
174
|
+
<tr>
|
|
175
|
+
<td><code>quote</code></td>
|
|
176
|
+
<td>Cross-asset quote access.</td>
|
|
177
|
+
<td>Use shared symbols or tickers directly for cross-backend quote, history, and profile queries.</td>
|
|
178
|
+
</tr>
|
|
179
|
+
<tr>
|
|
180
|
+
<td><code>market</code></td>
|
|
181
|
+
<td>Market-level queries.</td>
|
|
182
|
+
<td>Run live scans and market-mapping style lookups.</td>
|
|
183
|
+
</tr>
|
|
184
|
+
<tr>
|
|
185
|
+
<td><code>stock</code></td>
|
|
186
|
+
<td>Stock-oriented queries.</td>
|
|
187
|
+
<td>History, snapshots, live lists, flows, holders, and profiles.</td>
|
|
188
|
+
</tr>
|
|
189
|
+
<tr>
|
|
190
|
+
<td><code>fund</code></td>
|
|
191
|
+
<td>Fund-oriented queries.</td>
|
|
192
|
+
<td>NAV history, live estimates, allocation, managers, and reports.</td>
|
|
193
|
+
</tr>
|
|
194
|
+
<tr>
|
|
195
|
+
<td><code>bond</code></td>
|
|
196
|
+
<td>Bond-oriented queries.</td>
|
|
197
|
+
<td>Profiles, price history, live lists, trades, and flows.</td>
|
|
198
|
+
</tr>
|
|
199
|
+
<tr>
|
|
200
|
+
<td><code>futures</code></td>
|
|
201
|
+
<td>Futures-oriented queries.</td>
|
|
202
|
+
<td>Catalog, history, live quotes, and trade detail.</td>
|
|
203
|
+
</tr>
|
|
204
|
+
<tr>
|
|
205
|
+
<td><code>watch</code></td>
|
|
206
|
+
<td>Refresh wrapper.</td>
|
|
207
|
+
<td>Repeat a supported subcommand on a shared polling loop.</td>
|
|
208
|
+
</tr>
|
|
209
|
+
</tbody>
|
|
210
|
+
</table>
|
|
211
|
+
|
|
212
|
+
<a id="output-model"></a>
|
|
213
|
+
## Output Model
|
|
214
|
+
|
|
215
|
+
<table width="100%">
|
|
216
|
+
<tr>
|
|
217
|
+
<td width="50%" valign="top">
|
|
218
|
+
<strong>Current real defaults</strong>
|
|
219
|
+
<ul>
|
|
220
|
+
<li><code>--format table</code></li>
|
|
221
|
+
<li><code>--indicator-level advanced</code></li>
|
|
222
|
+
<li><code>--view observation</code></li>
|
|
223
|
+
<li><code>--trace-window 32</code></li>
|
|
224
|
+
</ul>
|
|
225
|
+
</td>
|
|
226
|
+
<td width="50%" valign="top">
|
|
227
|
+
<strong>Practical notes</strong>
|
|
228
|
+
<ul>
|
|
229
|
+
<li><code>observation</code> is the default public-facing view.</li>
|
|
230
|
+
<li>Pass <code>--view raw</code> when you want the unwrapped payload shape.</li>
|
|
231
|
+
<li><code>json</code> is usually the best target for downstream programs.</li>
|
|
232
|
+
<li><code>full</code> gives richer indicator context than <code>advanced</code>, but costs more work.</li>
|
|
233
|
+
</ul>
|
|
234
|
+
</td>
|
|
235
|
+
</tr>
|
|
236
|
+
</table>
|
|
237
|
+
|
|
238
|
+
<table>
|
|
239
|
+
<thead>
|
|
240
|
+
<tr>
|
|
241
|
+
<th align="left">Output or runtime flag</th>
|
|
242
|
+
<th align="left">Purpose</th>
|
|
243
|
+
</tr>
|
|
244
|
+
</thead>
|
|
245
|
+
<tbody>
|
|
246
|
+
<tr>
|
|
247
|
+
<td><code>--format table|json|csv|tsv</code></td>
|
|
248
|
+
<td>Choose terminal view or export-friendly structured output.</td>
|
|
249
|
+
</tr>
|
|
250
|
+
<tr>
|
|
251
|
+
<td><code>--full</code></td>
|
|
252
|
+
<td>Print more complete result content.</td>
|
|
253
|
+
</tr>
|
|
254
|
+
<tr>
|
|
255
|
+
<td><code>--transpose</code></td>
|
|
256
|
+
<td>Transpose tabular output for easier terminal reading in some cases.</td>
|
|
257
|
+
</tr>
|
|
258
|
+
<tr>
|
|
259
|
+
<td><code>--no-index</code></td>
|
|
260
|
+
<td>Hide row indices in table output.</td>
|
|
261
|
+
</tr>
|
|
262
|
+
<tr>
|
|
263
|
+
<td><code>--limit N</code></td>
|
|
264
|
+
<td>Keep only the first <code>N</code> rows in the rendered result.</td>
|
|
265
|
+
</tr>
|
|
266
|
+
<tr>
|
|
267
|
+
<td><code>--output PATH</code></td>
|
|
268
|
+
<td>Write the rendered result to a file.</td>
|
|
269
|
+
</tr>
|
|
270
|
+
<tr>
|
|
271
|
+
<td><code>--encoding utf-8</code></td>
|
|
272
|
+
<td>Set file-output encoding.</td>
|
|
273
|
+
</tr>
|
|
274
|
+
<tr>
|
|
275
|
+
<td><code>--watch --interval --count --clear/--no-clear</code></td>
|
|
276
|
+
<td>Run supported commands on a refresh loop.</td>
|
|
277
|
+
</tr>
|
|
278
|
+
</tbody>
|
|
279
|
+
</table>
|
|
280
|
+
|
|
281
|
+
<a id="indicator-coverage"></a>
|
|
282
|
+
## Indicator Coverage
|
|
283
|
+
|
|
284
|
+
`opentrade` ships with a broad built-in indicator set. Compatible commands can expose far more than raw quotes, which makes the CLI useful for screening, review, and downstream analytics.
|
|
285
|
+
|
|
286
|
+
<details open>
|
|
287
|
+
<summary><strong>Moving averages and base transforms</strong></summary>
|
|
288
|
+
<p><code>sma</code> · <code>ema</code> · <code>rma</code> · <code>wma</code> · <code>dema</code> · <code>tema</code> · <code>trima</code> · <code>hma</code> · <code>zlema</code> · <code>highest</code> · <code>lowest</code> · <code>median_price</code> · <code>typical_price</code> · <code>true_range</code></p>
|
|
289
|
+
</details>
|
|
290
|
+
|
|
291
|
+
<details open>
|
|
292
|
+
<summary><strong>Trend and channel indicators</strong></summary>
|
|
293
|
+
<p><code>macd</code> · <code>bollinger_bands</code> · <code>donchian_channel</code> · <code>keltner_channel</code> · <code>moving_average_envelope</code> · <code>aroon_indicator</code> · <code>dmi</code> · <code>adx</code> · <code>supertrend</code> · <code>parabolic_sar</code> · <code>ichimoku_cloud</code></p>
|
|
294
|
+
</details>
|
|
295
|
+
|
|
296
|
+
<details open>
|
|
297
|
+
<summary><strong>Momentum indicators</strong></summary>
|
|
298
|
+
<p><code>momentum</code> · <code>roc</code> · <code>rsi</code> · <code>stochastic_oscillator</code> · <code>kdj</code> · <code>cci</code> · <code>williams_r</code> · <code>trix</code> · <code>tsi</code> · <code>ultimate_oscillator</code> · <code>dpo</code> · <code>ppo</code></p>
|
|
299
|
+
</details>
|
|
300
|
+
|
|
301
|
+
<details open>
|
|
302
|
+
<summary><strong>Volume and money-flow indicators</strong></summary>
|
|
303
|
+
<p><code>obv</code> · <code>accumulation_distribution</code> · <code>chaikin_money_flow</code> · <code>chaikin_oscillator</code> · <code>mfi</code> · <code>vwap</code> · <code>force_index</code> · <code>ease_of_movement</code> · <code>price_volume_trend</code> · <code>volume_ratio</code></p>
|
|
304
|
+
</details>
|
|
305
|
+
|
|
306
|
+
<details open>
|
|
307
|
+
<summary><strong>Volatility indicators</strong></summary>
|
|
308
|
+
<p><code>atr</code> · <code>natr</code> · <code>historical_volatility</code> · <code>chaikin_volatility</code> · <code>mass_index</code></p>
|
|
309
|
+
</details>
|
|
310
|
+
|
|
311
|
+
<details open>
|
|
312
|
+
<summary><strong>Price-structure indicators</strong></summary>
|
|
313
|
+
<p><code>pivot_points</code> · <code>fibonacci_retracement</code> · <code>rolling_support_resistance</code></p>
|
|
314
|
+
</details>
|
|
315
|
+
|
|
316
|
+
<details open>
|
|
317
|
+
<summary><strong>Common Chinese-market technical indicators</strong></summary>
|
|
318
|
+
<p><code>bias</code> · <code>bbi</code> · <code>psy</code> · <code>vr</code> · <code>mtm</code> · <code>dma</code> · <code>brar</code> · <code>cr</code> · <code>emv</code> · <code>asi</code></p>
|
|
319
|
+
</details>
|
|
320
|
+
|
|
321
|
+
<table>
|
|
322
|
+
<thead>
|
|
323
|
+
<tr>
|
|
324
|
+
<th align="left">Level</th>
|
|
325
|
+
<th align="left">What it gives you in practice</th>
|
|
326
|
+
</tr>
|
|
327
|
+
</thead>
|
|
328
|
+
<tbody>
|
|
329
|
+
<tr>
|
|
330
|
+
<td><code>basic</code></td>
|
|
331
|
+
<td>The core trend and momentum set such as MA, EMA, MACD, RSI, KDJ, BOLL, ATR, and OBV.</td>
|
|
332
|
+
</tr>
|
|
333
|
+
<tr>
|
|
334
|
+
<td><code>advanced</code></td>
|
|
335
|
+
<td>Broader trend-strength, channel, and money-flow coverage such as ADX, Donchian, Keltner, SuperTrend, MFI, PVT, CMF, VWAP, VR, and PSY.</td>
|
|
336
|
+
</tr>
|
|
337
|
+
<tr>
|
|
338
|
+
<td><code>full</code></td>
|
|
339
|
+
<td>Richer structure and market-context layers such as Ichimoku, SAR, Mass Index, Pivot Points, Fibonacci Retracement, support/resistance, ADL, Chaikin Oscillator, Chaikin Volatility, and EMV.</td>
|
|
340
|
+
</tr>
|
|
341
|
+
</tbody>
|
|
342
|
+
</table>
|
|
343
|
+
|
|
344
|
+
<a id="observation-examples"></a>
|
|
345
|
+
## Observation Examples
|
|
346
|
+
|
|
347
|
+
The examples below only show the public-facing `observation` format.
|
|
348
|
+
|
|
349
|
+
<details open>
|
|
350
|
+
<summary><strong>Latest quote observation</strong></summary>
|
|
351
|
+
|
|
352
|
+
<p><strong>Command</strong></p>
|
|
353
|
+
<pre lang="bash"><code>opentrade quote price latest --symbols AAPL --format table --indicator-level full --trace-window 4</code></pre>
|
|
354
|
+
|
|
355
|
+
<p><strong>Typical output</strong></p>
|
|
356
|
+
|
|
357
|
+
```text
|
|
358
|
+
+-----------------------------+
|
|
359
|
+
| meta |
|
|
360
|
+
+-----------------------------+
|
|
361
|
+
| module: common |
|
|
362
|
+
| function: get_quote_history |
|
|
363
|
+
| view: observation |
|
|
364
|
+
| indicator_level: full |
|
|
365
|
+
| trace_window: 4 |
|
|
366
|
+
| row_count: 4 |
|
|
367
|
+
| code: AAPL |
|
|
368
|
+
| name: Apple Inc. |
|
|
369
|
+
| as_of: 2026-05-28 |
|
|
370
|
+
+-----------------------------+
|
|
371
|
+
|
|
372
|
+
+------------------+
|
|
373
|
+
| latest_quote |
|
|
374
|
+
+------------------+
|
|
375
|
+
| code: AAPL |
|
|
376
|
+
| name: Apple Inc. |
|
|
377
|
+
| date: 2026-05-28 |
|
|
378
|
+
| close: 106 |
|
|
379
|
+
| open: 105 |
|
|
380
|
+
| high: 107 |
|
|
381
|
+
| low: 104 |
|
|
382
|
+
| volume: 1700 |
|
|
383
|
+
+------------------+
|
|
384
|
+
|
|
385
|
+
+---------------------+
|
|
386
|
+
| current_metrics |
|
|
387
|
+
+---------------------+
|
|
388
|
+
| close: 106 |
|
|
389
|
+
| open: 105 |
|
|
390
|
+
| high: 107 |
|
|
391
|
+
| low: 104 |
|
|
392
|
+
| volume: 1700 |
|
|
393
|
+
| ma5: 103 |
|
|
394
|
+
| ma10: 102.5 |
|
|
395
|
+
| macd_dif: 0.36 |
|
|
396
|
+
| macd_dea: 0.26 |
|
|
397
|
+
| rsi14: 59 |
|
|
398
|
+
+---------------------+
|
|
399
|
+
|
|
400
|
+
+-----------------------------------+
|
|
401
|
+
| trace_points.price_ma |
|
|
402
|
+
+-----------------------------------+
|
|
403
|
+
| [block 1] bar_offset: -3 -> 0 |
|
|
404
|
+
| bar_offset: -3 | -2 | -1 | 0 |
|
|
405
|
+
| close: 100 | 102 | 104 | 106 |
|
|
406
|
+
| ma5: 99.8 | 100.5 | 102 | 103 |
|
|
407
|
+
| ma10: 100.1 | 100.4 | 101 | 102.5 |
|
|
408
|
+
+-----------------------------------+
|
|
409
|
+
|
|
410
|
+
+-------------------------------------------------------------+
|
|
411
|
+
| recent_events |
|
|
412
|
+
+-------------------------------------------------------------+
|
|
413
|
+
| [1] bars_ago: -2 |
|
|
414
|
+
| event_key: ma5_crossed_above_ma10 |
|
|
415
|
+
| subject_a: ma5 |
|
|
416
|
+
| relation: crossed_above |
|
|
417
|
+
| subject_b: ma10 |
|
|
418
|
+
| description: ma5 moved from below to above ma10 |
|
|
419
|
+
| prev_a: 99.8 prev_b: 100.1 curr_a: 100.5 curr_b: |
|
|
420
|
+
| 100.4 |
|
|
421
|
+
+-------------------------------------------------------------+
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
</details>
|
|
425
|
+
|
|
426
|
+
<details open>
|
|
427
|
+
<summary><strong>History observation</strong></summary>
|
|
428
|
+
|
|
429
|
+
<p><strong>Command</strong></p>
|
|
430
|
+
<pre lang="bash"><code>opentrade stock price history --symbols AAPL --market us_stock --start-date 20250102 --end-date 20250501 --format table --indicator-level advanced --trace-window 4</code></pre>
|
|
431
|
+
|
|
432
|
+
<p><strong>Typical output</strong></p>
|
|
433
|
+
|
|
434
|
+
```text
|
|
435
|
+
+-----------------------------+
|
|
436
|
+
| meta |
|
|
437
|
+
+-----------------------------+
|
|
438
|
+
| module: common |
|
|
439
|
+
| function: get_quote_history |
|
|
440
|
+
| view: observation |
|
|
441
|
+
| indicator_level: full |
|
|
442
|
+
| trace_window: 4 |
|
|
443
|
+
| row_count: 4 |
|
|
444
|
+
| code: AAPL |
|
|
445
|
+
| name: Apple Inc. |
|
|
446
|
+
| as_of: 2026-05-28 |
|
|
447
|
+
+-----------------------------+
|
|
448
|
+
|
|
449
|
+
+---------------------+
|
|
450
|
+
| current_metrics |
|
|
451
|
+
+---------------------+
|
|
452
|
+
| close: 106 |
|
|
453
|
+
| ma5: 103 |
|
|
454
|
+
| ma10: 102.5 |
|
|
455
|
+
| ma20: 101.4 |
|
|
456
|
+
| ema12: 102.9 |
|
|
457
|
+
| ema26: 101.7 |
|
|
458
|
+
| macd_dif: 0.36 |
|
|
459
|
+
| macd_dea: 0.26 |
|
|
460
|
+
| rsi14: 59 |
|
|
461
|
+
| kdj_k: 62 |
|
|
462
|
+
| kdj_d: 60 |
|
|
463
|
+
| plus_di: 28 |
|
|
464
|
+
| minus_di: 16 |
|
|
465
|
+
| adx: 28 |
|
|
466
|
+
+---------------------+
|
|
467
|
+
|
|
468
|
+
+---------------------------------------+
|
|
469
|
+
| trace_points.macd_osc |
|
|
470
|
+
+---------------------------------------+
|
|
471
|
+
| [block 1] bar_offset: -3 -> 0 |
|
|
472
|
+
| bar_offset: -3 | -2 | -1 | 0 |
|
|
473
|
+
| macd_dif: 0.05 | 0.2 | 0.28 | 0.36 |
|
|
474
|
+
| macd_dea: -0.02 | 0.08 | 0.18 | 0.26 |
|
|
475
|
+
| rsi14: 51 | 54 | 56 | 59 |
|
|
476
|
+
| kdj_k: 50 | 55 | 60 | 62 |
|
|
477
|
+
| kdj_d: 47 | 52 | 57 | 60 |
|
|
478
|
+
+---------------------------------------+
|
|
479
|
+
|
|
480
|
+
+-------------------------------------------------------------+
|
|
481
|
+
| recent_events |
|
|
482
|
+
+-------------------------------------------------------------+
|
|
483
|
+
| [1] bars_ago: 0 |
|
|
484
|
+
| event_key: volume_ratio_5_crossed_above_1 |
|
|
485
|
+
| subject_a: volume_ratio_5 |
|
|
486
|
+
| relation: crossed_above |
|
|
487
|
+
| subject_b: 1.0 |
|
|
488
|
+
| description: volume_ratio_5 moved from at-or-below to |
|
|
489
|
+
| above 1 |
|
|
490
|
+
| prev_a: 1 prev_b: 1 curr_a: 1.3 curr_b: 1 |
|
|
491
|
+
+-------------------------------------------------------------+
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
</details>
|
|
495
|
+
|
|
496
|
+
<details open>
|
|
497
|
+
<summary><strong>Multi-source fund observation</strong></summary>
|
|
498
|
+
|
|
499
|
+
<p><strong>Command</strong></p>
|
|
500
|
+
<pre lang="bash"><code>opentrade fund nav history-batch --symbols 161725 --symbols 005827 --format table --view observation --trace-window 4</code></pre>
|
|
501
|
+
|
|
502
|
+
<p><strong>Typical output</strong></p>
|
|
503
|
+
|
|
504
|
+
```text
|
|
505
|
+
+---------------+
|
|
506
|
+
| source.161725 |
|
|
507
|
+
+---------------+
|
|
508
|
+
|
|
509
|
+
+-----------------------------+
|
|
510
|
+
| meta |
|
|
511
|
+
+-----------------------------+
|
|
512
|
+
| module: common |
|
|
513
|
+
| function: get_quote_history |
|
|
514
|
+
| view: observation |
|
|
515
|
+
| indicator_level: full |
|
|
516
|
+
| trace_window: 4 |
|
|
517
|
+
| row_count: 4 |
|
|
518
|
+
| code: AAPL |
|
|
519
|
+
| name: Apple Inc. |
|
|
520
|
+
| as_of: 2026-05-28 |
|
|
521
|
+
+-----------------------------+
|
|
522
|
+
|
|
523
|
+
+------------------+
|
|
524
|
+
| latest_quote |
|
|
525
|
+
+------------------+
|
|
526
|
+
| code: AAPL |
|
|
527
|
+
| name: Apple Inc. |
|
|
528
|
+
| date: 2026-05-28 |
|
|
529
|
+
| close: 106 |
|
|
530
|
+
+------------------+
|
|
531
|
+
|
|
532
|
+
+---------------+
|
|
533
|
+
| source.005827 |
|
|
534
|
+
+---------------+
|
|
535
|
+
|
|
536
|
+
+-----------------------------+
|
|
537
|
+
| meta |
|
|
538
|
+
+-----------------------------+
|
|
539
|
+
| module: common |
|
|
540
|
+
| function: get_quote_history |
|
|
541
|
+
| view: observation |
|
|
542
|
+
| indicator_level: full |
|
|
543
|
+
| trace_window: 4 |
|
|
544
|
+
| row_count: 4 |
|
|
545
|
+
| code: AAPL |
|
|
546
|
+
| name: Apple Inc. |
|
|
547
|
+
| as_of: 2026-05-28 |
|
|
548
|
+
+-----------------------------+
|
|
549
|
+
|
|
550
|
+
+------------------+
|
|
551
|
+
| latest_quote |
|
|
552
|
+
+------------------+
|
|
553
|
+
| code: AAPL |
|
|
554
|
+
| name: Apple Inc. |
|
|
555
|
+
| date: 2026-05-28 |
|
|
556
|
+
| close: 106 |
|
|
557
|
+
+------------------+
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
</details>
|
|
561
|
+
|
|
562
|
+
<a id="common-workflows"></a>
|
|
563
|
+
## Common Workflows
|
|
564
|
+
|
|
565
|
+
<table width="100%">
|
|
566
|
+
<tr>
|
|
567
|
+
<td width="50%" valign="top">
|
|
568
|
+
<strong>Search and inspect</strong>
|
|
569
|
+
<pre lang="bash"><code>opentrade search --query NVDA --market US_stock
|
|
570
|
+
opentrade quote price latest --symbols NVDA</code></pre>
|
|
571
|
+
</td>
|
|
572
|
+
<td width="50%" valign="top">
|
|
573
|
+
<strong>Watch a quote</strong>
|
|
574
|
+
<pre lang="bash"><code>opentrade watch --interval 5 --count 3 quote price latest --symbols AAPL --format json</code></pre>
|
|
575
|
+
</td>
|
|
576
|
+
</tr>
|
|
577
|
+
<tr>
|
|
578
|
+
<td width="50%" valign="top">
|
|
579
|
+
<strong>Batch fund history</strong>
|
|
580
|
+
<pre lang="bash"><code>opentrade fund nav history-batch --symbols 161725 --symbols 005827 --format json</code></pre>
|
|
581
|
+
</td>
|
|
582
|
+
<td width="50%" valign="top">
|
|
583
|
+
<strong>Market-level live scan</strong>
|
|
584
|
+
<pre lang="bash"><code>opentrade market price live --market US_stock --format json</code></pre>
|
|
585
|
+
</td>
|
|
586
|
+
</tr>
|
|
587
|
+
</table>
|
|
588
|
+
|
|
589
|
+
<a id="yahoo-finance-backend"></a>
|
|
590
|
+
## Yahoo Finance Backend
|
|
591
|
+
|
|
592
|
+
`yfinance` is now a first-class backend for a focused subset of shared commands. Use `--backend yfinance` when you want Yahoo Finance data explicitly, and keep the following boundaries in mind:
|
|
593
|
+
|
|
594
|
+
- Supported shared coverage includes search, stock and quote history, quote latest, conditional stock latest/snapshot, and stock and quote profile.
|
|
595
|
+
- Yahoo-only capability currently starts with `quote news`, exposed as a provider-extension command instead of pretending to be backend-agnostic.
|
|
596
|
+
- Symbol semantics follow Yahoo tickers first. Typical inputs are `AAPL`, `MSFT`, `0700.HK`, or `9988.HK`; A-share symbols are only translated on the stock paths, and not every domestic-market symbol style can be inferred safely.
|
|
597
|
+
- Current yfinance shared execution is effectively single-target on the stock/quote paths. For batch history or batch latest requests, prefer `efinance` or `akshare`.
|
|
598
|
+
- `fund nav history` and `fund profile` are not shared yfinance commands. If you need fund data through Yahoo, pass a Yahoo fund ticker through provider-specific workflows instead of mainland fund codes.
|
|
599
|
+
- Shared `quote` commands use symbol/ticker inputs; the `--quote-ids` alias remains for compatibility but should not be read as an 东方财富 `quote_id` requirement.
|
|
600
|
+
- Live smoke verification is intentionally optional because Yahoo may return explicit rate-limit failures even for valid requests.
|
|
601
|
+
|
|
602
|
+
```bash
|
|
603
|
+
opentrade search --query AAPL --backend yfinance --format json
|
|
604
|
+
opentrade quote price latest --symbols AAPL --backend yfinance --format json
|
|
605
|
+
opentrade quote news --quote-id AAPL --result-count 5 --format json
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
<a id="notes"></a>
|
|
609
|
+
## Notes
|
|
610
|
+
|
|
611
|
+
<table width="100%">
|
|
612
|
+
<tr>
|
|
613
|
+
<td width="50%" valign="top">
|
|
614
|
+
<strong>Data-source boundaries</strong>
|
|
615
|
+
<ul>
|
|
616
|
+
<li>The CLI depends on upstream market-data availability.</li>
|
|
617
|
+
<li>Realtime stability depends on network conditions and source-side behavior.</li>
|
|
618
|
+
<li>Some commands support richer indicator enrichment than others.</li>
|
|
619
|
+
<li><code>yfinance</code>-backed commands use Yahoo ticker / symbol semantics and may fail with explicit rate-limit errors.</li>
|
|
620
|
+
<li>Optional live smoke checks should be run manually against a small symbol set because Yahoo throttling makes them non-deterministic.</li>
|
|
621
|
+
</ul>
|
|
622
|
+
</td>
|
|
623
|
+
<td width="50%" valign="top">
|
|
624
|
+
<strong>Usage boundaries</strong>
|
|
625
|
+
<ul>
|
|
626
|
+
<li>Use side-effect commands such as report download intentionally.</li>
|
|
627
|
+
<li>Prefer <code>json</code> when another program will consume the result.</li>
|
|
628
|
+
<li>Prefer <code>observation</code> when a human or agent needs concise market context instead of raw tables.</li>
|
|
629
|
+
</ul>
|
|
630
|
+
</td>
|
|
631
|
+
</tr>
|
|
632
|
+
</table>
|
|
633
|
+
|
|
634
|
+
<a id="license"></a>
|
|
635
|
+
## License
|
|
636
|
+
|
|
637
|
+
See [LICENSE](LICENSE).
|