@kuandotdev/indicator 0.1.2 → 0.1.3

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 (80) hide show
  1. package/README.md +2 -7
  2. package/package.json +4 -1
  3. package/project/.cursor/rules/agent-docs.mdc +16 -0
  4. package/project/.cursor/rules/api-credential-storage.mdc +16 -0
  5. package/project/.cursor/rules/pinescript-v6.mdc +16 -0
  6. package/project/.cursor/rules/stock-model-forecast.mdc +16 -0
  7. package/project/.cursor/rules/system-prompt-injection.mdc +16 -0
  8. package/project/.cursor/rules/system-prompt-updater.mdc +16 -0
  9. package/project/.cursor/rules/tradingview-stock-data.mdc +16 -0
  10. package/project/.env.example +44 -0
  11. package/project/.npm-packaged-project +1 -0
  12. package/project/.pi/APPEND_SYSTEM.md +338 -0
  13. package/project/.pi/settings.json +8 -0
  14. package/project/AGENTS.md +538 -0
  15. package/project/CLAUDE.md +538 -0
  16. package/project/GEMINI.md +538 -0
  17. package/project/Makefile +488 -0
  18. package/project/README.md +419 -0
  19. package/project/conda-env-active.sh +98 -0
  20. package/project/conda-env-deactive.sh +42 -0
  21. package/project/docs/agent-install.md +446 -0
  22. package/project/docs/agent-skill-directory.md +222 -0
  23. package/project/docs/integration.html +271 -0
  24. package/project/packages/indicator/README.md +39 -0
  25. package/project/packages/indicator/package.json +40 -0
  26. package/project/packages/indicator/scripts/build-project-snapshot.js +57 -0
  27. package/project/packages/indicator/src/cli.js +368 -0
  28. package/project/packages/tradingview-stock-data-skill/README.md +112 -0
  29. package/project/packages/tradingview-stock-data-skill/extensions/stock-prompt-injector.ts +121 -0
  30. package/project/packages/tradingview-stock-data-skill/package.json +35 -0
  31. package/project/packages/tradingview-stock-data-skill/scripts/postinstall.sh +73 -0
  32. package/project/packages/tradingview-stock-data-skill/skills/tradingview-stock-data/SKILL.md +241 -0
  33. package/project/pyproject.toml +68 -0
  34. package/project/screenshots/.gitkeep +0 -0
  35. package/project/scripts/indicators/example_rsi_bands.pine +27 -0
  36. package/project/scripts/indicators/tsla_levels.pine +57 -0
  37. package/project/skills/agent-docs/SKILL.md +56 -0
  38. package/project/skills/api-credential-storage/SKILL.md +83 -0
  39. package/project/skills/api-credential-storage/scripts/upsert_env.py +151 -0
  40. package/project/skills/pinescript-v6/SKILL.md +129 -0
  41. package/project/skills/pinescript-v6/reference/built-ins.md +219 -0
  42. package/project/skills/pinescript-v6/reference/templates/alert-webhook.pine +76 -0
  43. package/project/skills/pinescript-v6/reference/templates/indicator.pine +48 -0
  44. package/project/skills/pinescript-v6/reference/templates/strategy.pine +50 -0
  45. package/project/skills/pinescript-v6/reference/v5-to-v6-migration.md +102 -0
  46. package/project/skills/pinescript-v6/reference/v6-language.md +202 -0
  47. package/project/skills/stock-model-forecast/SKILL.md +192 -0
  48. package/project/skills/system-prompt-injection/CUSTOM_SYSTEM_PROMPT.md +333 -0
  49. package/project/skills/system-prompt-injection/DEFAULT_SYSTEM_PROMPT.md +327 -0
  50. package/project/skills/system-prompt-injection/SKILL.md +90 -0
  51. package/project/skills/system-prompt-injection/SYSTEM_PROMPT.md +23 -0
  52. package/project/skills/system-prompt-updater/SKILL.md +82 -0
  53. package/project/skills/system-prompt-updater/scripts/system_prompt_update.sh +106 -0
  54. package/project/skills/tradingview-stock-data/SKILL.md +272 -0
  55. package/project/src/tv_indicator/__init__.py +0 -0
  56. package/project/src/tv_indicator/browser/__init__.py +0 -0
  57. package/project/src/tv_indicator/browser/automation.py +541 -0
  58. package/project/src/tv_indicator/browser/selectors.py +70 -0
  59. package/project/src/tv_indicator/cli/__init__.py +0 -0
  60. package/project/src/tv_indicator/cli/browser_cmds.py +92 -0
  61. package/project/src/tv_indicator/cli/data_cmds.py +178 -0
  62. package/project/src/tv_indicator/cli/main.py +56 -0
  63. package/project/src/tv_indicator/cli/model_cmds.py +255 -0
  64. package/project/src/tv_indicator/cli/pine_cmds.py +140 -0
  65. package/project/src/tv_indicator/config.py +98 -0
  66. package/project/src/tv_indicator/data/__init__.py +0 -0
  67. package/project/src/tv_indicator/data/client.py +187 -0
  68. package/project/src/tv_indicator/data/screener.py +268 -0
  69. package/project/src/tv_indicator/mcp/__init__.py +0 -0
  70. package/project/src/tv_indicator/mcp/agent_server.py +398 -0
  71. package/project/src/tv_indicator/mcp/browser_server.py +133 -0
  72. package/project/src/tv_indicator/mcp/data_server.py +239 -0
  73. package/project/src/tv_indicator/model/__init__.py +19 -0
  74. package/project/src/tv_indicator/model/forecast.py +693 -0
  75. package/project/tools/import_agent_tools.sh +503 -0
  76. package/project/tools/install_skills.sh +673 -0
  77. package/project/tools/interactive_install.sh +917 -0
  78. package/project/tools/progress.sh +114 -0
  79. package/project/tools/uninstall_agent_tools.sh +373 -0
  80. package/src/cli.js +21 -24
@@ -0,0 +1,272 @@
1
+ ---
2
+ name: tradingview-stock-data
3
+ description: Fetch current market state, prices, OHLCV candles, and price history through the Indicator CLI, Makefile, or MCP data tool. Use when users ask for stock/ETF/crypto/forex/futures/index analysis, current price/latest close, daily or weekly trend, historical prices, OHLCV, CSV export, TradingView symbols, exchange:ticker mapping, or Taiwan tickers such as 2330.tw, 6584.tw, TWSE, or TPEX.
4
+ compatibility: Generic Agent Skill. Works with Claude Code, Pi, Codex-style agents, Gemini CLI, Cursor, and other agents that can read SKILL.md instructions and run shell commands or MCP tools.
5
+ ---
6
+
7
+ # TradingView Market Data Skill
8
+
9
+ This is a generic, agent-agnostic workflow for getting market prices and price history from TradingView-compatible tooling. It works for stocks, ETFs, crypto, forex, futures, indexes, and other instruments when the TradingView symbol is valid and available to the data backend.
10
+
11
+ Use it with any agent that can read this `SKILL.md`. It is not Pi-specific.
12
+
13
+ ## Supported agent patterns
14
+
15
+ | Agent / harness | How this skill is discovered |
16
+ |---|---|
17
+ | Claude Code | `.claude/skills/tradingview-stock-data/SKILL.md` or `~/.claude/skills/...` |
18
+ | Pi | `.pi/agent/skills/tradingview-stock-data/SKILL.md`, `.pi/skills/...`, or Pi package `pi.skills` |
19
+ | Codex / Aider / OpenCode-style agents | `AGENTS.md` points to this skill |
20
+ | Gemini CLI | `GEMINI.md` points to this skill |
21
+ | Cursor | `.cursor/rules/tradingview-stock-data.mdc` points to this skill |
22
+
23
+ ## What the agent should do
24
+
25
+ When the user asks for a market price, latest close, analysis, or price history:
26
+
27
+ 1. Resolve the user's ticker into TradingView symbol format: `EXCHANGE:TICKER`.
28
+ 2. Choose the most direct available tool:
29
+ - If a TradingView MCP data server is available, use its OHLCV tool.
30
+ - Else, if a project Makefile has `ohlcv`, use `make ohlcv`.
31
+ - Else, if the `training-view` CLI is installed, use `training-view data ohlcv`.
32
+ 3. Fetch one bar for current/latest price or many bars for history/current-state analysis.
33
+ 4. Report the exact command/tool used, resolved symbol, interval, bar count, and latest close.
34
+ 5. Mention any data limitation warnings, such as no-login TradingView access.
35
+
36
+ ## Current market state for analysis
37
+
38
+ For analyze-style requests, this skill is the first data step before checking cached artifacts or model output.
39
+
40
+ Fetch enough OHLCV to summarize:
41
+
42
+ - latest close and candle timestamp
43
+ - daily trend and weekly trend
44
+ - day range / recent swing range
45
+ - volume versus recent average when available
46
+ - nearby support/resistance from recent highs/lows and moving averages
47
+ - whether the latest candle may still be in progress
48
+
49
+ Suggested commands:
50
+
51
+ ```bash
52
+ make ohlcv SYMBOL=NASDAQ:TSLA INTERVAL=1D BARS=120
53
+ make ohlcv SYMBOL=NASDAQ:TSLA INTERVAL=1W BARS=80
54
+ ```
55
+
56
+ Use this current-state snapshot to decide whether a same-day `temp/{YYYYMMDD}_*/{TARGET_ID}/analyzed_result.md` artifact is still usable. If price/news/technicals materially changed, update the final report and artifact instead of returning stale levels.
57
+
58
+ Do not use `technical_rating` / `make rating` as the final report rating. Reports use the agent-evaluated `Rating: {Buy | Sell | hold}` plus Buy score and Sell score from the active market-analysis prompt. TradingView technical data may be used only as raw context when explicitly requested.
59
+
60
+ ## Tool preference order
61
+
62
+ ### 1. MCP, if available
63
+
64
+ If the environment exposes a TradingView data MCP server, prefer it for structured calls.
65
+ Typical tool names may include:
66
+
67
+ - `get_ohlcv`
68
+ - `search_symbol`
69
+ - `technical_rating`
70
+ - `screener`
71
+
72
+ Use `get_ohlcv(symbol, interval, bars)` for prices and history.
73
+
74
+ ### 2. Makefile, if available
75
+
76
+ From an Indicator project root:
77
+
78
+ ```bash
79
+ make ohlcv SYMBOL=<TRADINGVIEW_SYMBOL> INTERVAL=<INTERVAL> BARS=<N>
80
+ ```
81
+
82
+ Example:
83
+
84
+ ```bash
85
+ make ohlcv SYMBOL=TPEX:6584 INTERVAL=1D BARS=1
86
+ ```
87
+
88
+ ### 3. CLI, if available
89
+
90
+ If `training-view` is available directly:
91
+
92
+ ```bash
93
+ training-view data ohlcv "<TRADINGVIEW_SYMBOL>" --interval <INTERVAL> --bars <N>
94
+ ```
95
+
96
+ If Indicator uses a conda env:
97
+
98
+ ```bash
99
+ conda run -n tv-indicator --live-stream --no-capture-output \
100
+ training-view data ohlcv "<TRADINGVIEW_SYMBOL>" --interval <INTERVAL> --bars <N>
101
+ ```
102
+
103
+ CSV export:
104
+
105
+ ```bash
106
+ conda run -n tv-indicator --live-stream --no-capture-output \
107
+ training-view data ohlcv "<TRADINGVIEW_SYMBOL>" --interval <INTERVAL> --bars <N> --csv <file.csv>
108
+ ```
109
+
110
+ ## Symbol resolution
111
+
112
+ Always prefer TradingView symbol format:
113
+
114
+ ```text
115
+ EXCHANGE:TICKER
116
+ ```
117
+
118
+ Examples:
119
+
120
+ | User input | TradingView symbol | Notes |
121
+ |---|---|---|
122
+ | `AAPL` | `NASDAQ:AAPL` | Verify if ambiguous |
123
+ | `MSFT` | `NASDAQ:MSFT` | Verify if ambiguous |
124
+ | `TSLA` | `NASDAQ:TSLA` | Verify if ambiguous |
125
+ | `SPY` | `AMEX:SPY` | ETF, verify exchange |
126
+ | `2330.tw` | `TWSE:2330` | Taiwan listed stock |
127
+ | `2317.tw` | `TWSE:2317` | Taiwan listed stock |
128
+ | `6584.tw` / `6584.two` | `TPEX:6584` | Taiwan OTC/TPEX stock |
129
+ | Yahoo `.TW` | usually `TWSE:<ticker>` | Taiwan listed stocks |
130
+ | Yahoo `.TWO` | usually `TPEX:<ticker>` | Taiwan OTC/TPEX stocks |
131
+ | `BTCUSDT` | `BINANCE:BTCUSDT` or another requested exchange | Crypto spot pair; verify exchange if ambiguous |
132
+ | `BTCUSD` | `COINBASE:BTCUSD` / `BITSTAMP:BTCUSD` / requested exchange | Crypto spot pair; verify exchange if ambiguous |
133
+ | `EURUSD` | `FX:EURUSD` / broker-specific exchange | Forex pair; verify venue/source |
134
+ | `ES1!` | `CME_MINI:ES1!` | Futures continuous contract; verify contract source |
135
+
136
+ If symbol search returns no matches, do **not** immediately conclude the ticker is invalid. Some TradingView search/data endpoints are limited without login. Try known exchange prefixes directly.
137
+
138
+ Taiwan fallback order:
139
+
140
+ ```bash
141
+ make ohlcv SYMBOL=TWSE:<ticker> INTERVAL=1D BARS=1
142
+ make ohlcv SYMBOL=TPEX:<ticker> INTERVAL=1D BARS=1
143
+ make ohlcv SYMBOL=BINANCE:BTCUSDT INTERVAL=1D BARS=1
144
+ ```
145
+
146
+ ## Current/latest price
147
+
148
+ Fetch one daily bar and report the `close` field:
149
+
150
+ ```bash
151
+ make ohlcv SYMBOL=TPEX:6584 INTERVAL=1D BARS=1
152
+ ```
153
+
154
+ Interpretation:
155
+
156
+ - `close` is the latest available candle close.
157
+ - During market hours, TradingView may return the latest in-progress candle depending on data access.
158
+ - For intraday checks, use `1`, `5`, `15`, or `60` minute intervals.
159
+
160
+ Examples:
161
+
162
+ ```bash
163
+ make ohlcv SYMBOL=TPEX:6584 INTERVAL=1D BARS=1
164
+ make ohlcv SYMBOL=TWSE:2330 INTERVAL=1D BARS=1
165
+ make ohlcv SYMBOL=NASDAQ:AAPL INTERVAL=1D BARS=1
166
+ make ohlcv SYMBOL=BINANCE:BTCUSDT INTERVAL=1D BARS=1
167
+ ```
168
+
169
+ ## Price history
170
+
171
+ Increase `BARS` to retrieve historical OHLCV candles:
172
+
173
+ ```bash
174
+ make ohlcv SYMBOL=TPEX:6584 INTERVAL=1D BARS=20
175
+ make ohlcv SYMBOL=TPEX:6584 INTERVAL=1D BARS=500
176
+ ```
177
+
178
+ Common intervals:
179
+
180
+ | Interval | Meaning |
181
+ |---|---|
182
+ | `1` | 1-minute candles |
183
+ | `5` | 5-minute candles |
184
+ | `15` | 15-minute candles |
185
+ | `60` | 1-hour candles |
186
+ | `240` | 4-hour candles |
187
+ | `1D` | daily candles |
188
+ | `1W` | weekly candles |
189
+ | `1M` | monthly candles |
190
+
191
+ Examples:
192
+
193
+ ```bash
194
+ # Daily history
195
+ make ohlcv SYMBOL=TPEX:6584 INTERVAL=1D BARS=100
196
+
197
+ # Weekly history
198
+ make ohlcv SYMBOL=TPEX:6584 INTERVAL=1W BARS=100
199
+
200
+ # 1-hour history
201
+ make ohlcv SYMBOL=TPEX:6584 INTERVAL=60 BARS=200
202
+ make ohlcv SYMBOL=BINANCE:BTCUSDT INTERVAL=60 BARS=200
203
+ ```
204
+
205
+ ## CSV export
206
+
207
+ Prefer CSV when the user asks for all rows, downstream analysis, spreadsheet use, or a saved file.
208
+
209
+ ```bash
210
+ mkdir -p data
211
+ conda run -n tv-indicator --live-stream --no-capture-output \
212
+ training-view data ohlcv "TPEX:6584" --interval 1D --bars 500 --csv data/TPEX_6584_1D_500.csv
213
+ ```
214
+
215
+ Suggested filename format:
216
+
217
+ ```text
218
+ <EXCHANGE>_<TICKER>_<INTERVAL>_<BARS>.csv
219
+ ```
220
+
221
+ ## Response format
222
+
223
+ When reporting results, include:
224
+
225
+ ```text
226
+ Resolved symbol: <EXCHANGE:TICKER>
227
+ Command/tool used: <exact command or MCP tool>
228
+ Interval: <interval>
229
+ Bars: <N>
230
+ Latest close: <value> <currency if known>
231
+ Warnings: <nologin/limited data warnings, if any>
232
+ ```
233
+
234
+ For history, summarize the range if visible and the row count returned.
235
+
236
+ ## Troubleshooting
237
+
238
+ ### `No matches for '<ticker>'`
239
+
240
+ Try explicit exchange prefixes:
241
+
242
+ ```bash
243
+ make ohlcv SYMBOL=TWSE:<ticker> INTERVAL=1D BARS=1
244
+ make ohlcv SYMBOL=TPEX:<ticker> INTERVAL=1D BARS=1
245
+ ```
246
+
247
+ ### `you are using nologin method, data you access may be limited`
248
+
249
+ The command may still work, but data may be limited. If Indicator supports browser login:
250
+
251
+ ```bash
252
+ make login
253
+ make session-check
254
+ ```
255
+
256
+ ### Conda environment missing
257
+
258
+ If this is Indicator, repair the environment:
259
+
260
+ ```bash
261
+ make install
262
+ make doctor
263
+ ```
264
+
265
+ ### Need all rows printed
266
+
267
+ Some CLIs print only the tail by default. Use CSV export or pass a larger tail:
268
+
269
+ ```bash
270
+ conda run -n tv-indicator --live-stream --no-capture-output \
271
+ training-view data ohlcv "TPEX:6584" --interval 1D --bars 100 --tail 100
272
+ ```
File without changes
File without changes