tradingmcp 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.
Files changed (26) hide show
  1. tradingmcp-1.0.0/LICENSE +21 -0
  2. tradingmcp-1.0.0/PKG-INFO +468 -0
  3. tradingmcp-1.0.0/README.md +447 -0
  4. tradingmcp-1.0.0/pyproject.toml +57 -0
  5. tradingmcp-1.0.0/setup.cfg +4 -0
  6. tradingmcp-1.0.0/src/tradingmcp/__init__.py +1 -0
  7. tradingmcp-1.0.0/src/tradingmcp/core/data/__init__.py +0 -0
  8. tradingmcp-1.0.0/src/tradingmcp/core/data/egx_indices.py +306 -0
  9. tradingmcp-1.0.0/src/tradingmcp/core/errors.py +211 -0
  10. tradingmcp-1.0.0/src/tradingmcp/core/services/backtest_service.py +992 -0
  11. tradingmcp-1.0.0/src/tradingmcp/core/services/bitcoin_market_service.py +129 -0
  12. tradingmcp-1.0.0/src/tradingmcp/core/services/extended_hours_service.py +179 -0
  13. tradingmcp-1.0.0/src/tradingmcp/core/services/indicators_calc.py +268 -0
  14. tradingmcp-1.0.0/src/tradingmcp/core/services/marketaux_service.py +302 -0
  15. tradingmcp-1.0.0/src/tradingmcp/core/services/options_service.py +389 -0
  16. tradingmcp-1.0.0/src/tradingmcp/core/services/proxy_manager.py +163 -0
  17. tradingmcp-1.0.0/src/tradingmcp/core/services/smart_money_service.py +426 -0
  18. tradingmcp-1.0.0/src/tradingmcp/core/services/yahoo_finance_service.py +276 -0
  19. tradingmcp-1.0.0/src/tradingmcp/core/utils/validators.py +56 -0
  20. tradingmcp-1.0.0/src/tradingmcp/server.py +492 -0
  21. tradingmcp-1.0.0/src/tradingmcp.egg-info/PKG-INFO +468 -0
  22. tradingmcp-1.0.0/src/tradingmcp.egg-info/SOURCES.txt +24 -0
  23. tradingmcp-1.0.0/src/tradingmcp.egg-info/dependency_links.txt +1 -0
  24. tradingmcp-1.0.0/src/tradingmcp.egg-info/entry_points.txt +2 -0
  25. tradingmcp-1.0.0/src/tradingmcp.egg-info/requires.txt +3 -0
  26. tradingmcp-1.0.0/src/tradingmcp.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Ahmet Taner Atila
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,468 @@
1
+ Metadata-Version: 2.4
2
+ Name: tradingmcp
3
+ Version: 1.0.0
4
+ Summary: MCP server that gives AI assistants market analysis: quotes, options, smart-money analysis, walk-forward backtests and news sentiment for stocks, crypto, FX and metals (13 tools)
5
+ Author: Atila Ahmettaner
6
+ Project-URL: Repository, https://github.com/atilaahmettaner/tradingmcp
7
+ Keywords: mcp,crypto,technical analysis,backtesting,walk-forward,sentiment,yahoo-finance,trading,agents,algorithmic-trading,equity-curve
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Requires-Python: <3.14,>=3.10
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: feedparser>=6.0.12
18
+ Requires-Dist: httpx>=0.27
19
+ Requires-Dist: mcp[cli]<2,>=1.14.0
20
+ Dynamic: license-file
21
+
22
+ <!-- mcp-name: io.github.atilaahmettaner/tradingmcp -->
23
+ # TradingMCP: Market Data & Technical Analysis for AI Assistants
24
+
25
+ <p align="center">
26
+ <a href="https://github.com/atilaahmettaner/tradingmcp/blob/main/assets/tradingmcp-film-15.mp4"><img src="https://raw.githubusercontent.com/atilaahmettaner/tradingmcp/main/assets/tradingmcp-film-15.webp" width="820" alt="15-second product film: an AI is asked 'What did the market do today?', a market board assembles, Ethereum is marked as the day's top mover and its daily chart with Bollinger Bands is drawn in the chat — TradingMCP, the hosted version of this server" /></a>
27
+ <br>
28
+ <sub>15 seconds, real output (market data as of 13 Oct 2026) · this server, hosted as <a href="https://tradingmcp.ai/?utm_source=github&utm_medium=readme&utm_content=film">TradingMCP</a> · <a href="https://github.com/atilaahmettaner/tradingmcp/blob/main/assets/tradingmcp-film-15.mp4">watch in full quality</a></sub>
29
+ </p>
30
+
31
+ <a href="https://trendshift.io/repositories/25110" target="_blank"><img src="https://trendshift.io/api/badge/repositories/25110" alt="atilaahmettaner%2Ftradingmcp | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
32
+
33
+ **TradingMCP** is an open-source MCP server: market data, backtesting, options, smart-money analysis and news sentiment for Claude, ChatGPT, Cursor, Copilot, and any MCP client. Stocks, ETFs, indices, crypto, FX and metals.
34
+
35
+ **Don't want to install anything?** [TradingMCP](https://tradingmcp.ai/?utm_source=github&utm_medium=readme&utm_content=top_cta), the hosted version of this server, gives you these tools in your AI app, plus charts and a markets panel drawn in the chat. In Claude, Cursor or Grok, add `https://mcp.tradingmcp.ai/mcp` as a connector and sign in: no key to paste. ChatGPT, Copilot and other MCP clients connect with a private link. From $9/mo with a 14-day money-back guarantee; self-hosting stays free.
36
+
37
+ <p align="center">
38
+ <a href="https://claude.ai/customize/connectors?modal=add-custom-connector&connectorName=TradingMCP&connectorUrl=https%3A%2F%2Fmcp.tradingmcp.ai%2Fmcp"><img src="https://img.shields.io/badge/Add_to-Claude-D97757?style=for-the-badge&logo=claude&logoColor=white" alt="Add TradingMCP to Claude" height="32"></a>
39
+ &nbsp;
40
+ <a href="https://tradingmcp.ai/connect?utm_source=github&utm_medium=readme&utm_content=add_to_cursor#cursor"><img src="https://img.shields.io/badge/Add_to-Cursor-1d1e1b?style=for-the-badge&logo=cursor&logoColor=white" alt="Add TradingMCP to Cursor" height="32"></a>
41
+ <br>
42
+ <b>Starts at $9/month, 14-day money-back guarantee.</b>
43
+ <br>
44
+ <sub>One click opens Claude's connector dialog with TradingMCP filled in; sign in with the email you subscribe with. Other apps: <a href="https://tradingmcp.ai/connect?utm_source=github&utm_medium=readme&utm_content=connect_other">tradingmcp.ai/connect</a></sub>
45
+ </p>
46
+
47
+ **Sponsor:** [Whop](https://whop.com/start/?code=TVMCP&utm_source=majoragv&utm_medium=sponsor&utm_campaign=tvmcp): sell your courses, software and communities online.
48
+
49
+ **[Morning market brief in one prompt](https://tradingmcp.ai/?utm_source=github&utm_medium=readme&utm_content=brief):** ask "give me this morning's market brief" and get global indices, the Bitcoin pulse and the hosted Markets panel in one answer. Charts are drawn right in the chat. In Grok Bot, [add the Market Brief bot](https://x.ai/bot/7KuzDNTqOKomzcZirrvdz) to get one on weekday mornings.
50
+
51
+ **The [hosted version (TradingMCP)](https://tradingmcp.ai/?utm_source=github&utm_medium=readme&utm_content=charts) draws charts.** Ask for a chart and an interactive candlestick view (1d / 1h / 15m, optional Bollinger overlay) renders live **inside the conversation** via MCP Apps — and the AI reads the band values back to you.
52
+
53
+ **[Add one URL and sign in](https://tradingmcp.ai/?utm_source=github&utm_medium=readme&utm_content=paste_url) (or `pip install`), then just ask.**
54
+
55
+ **Try these first** — they work in Claude, ChatGPT, Cursor, or any MCP client:
56
+
57
+ ```text
58
+ What did the market do today?
59
+ What is NVDA doing in after-hours trading?
60
+ Any unusual options activity on TSLA?
61
+ Backtest an RSI strategy on BTC on the daily timeframe
62
+ ```
63
+
64
+ > [!NOTE]
65
+ > Market data comes from Yahoo Finance and CoinGecko, and news from Marketaux. You are responsible for ensuring your own use complies with the terms of any data source you use.
66
+
67
+ > [!IMPORTANT]
68
+ > **Not financial advice.** Nothing produced by this software is investment, financial, legal, tax, or accounting advice. TradingMCP is an informational and educational analysis tool. Its outputs, including indicators, scores, signals, "trade setups", entries, stop losses, and targets, are computed from third party market data and are **not** recommendations to buy, sell, or hold any asset. It does not execute trades, manage money, or guarantee any result. Trading and investing carry a substantial risk of loss, and you can lose some or all of your capital. Always do your own research and consult a licensed professional before making any financial decision. You are solely responsible for your own decisions and for complying with the laws and regulations that apply to you. Market data may be delayed, inaccurate, or incomplete, and is provided without warranty.
69
+
70
+ > [!TIP]
71
+ > **Prefer zero setup? Use the hosted version.** [**TradingMCP**](https://tradingmcp.ai/?utm_source=github&utm_medium=readme&utm_content=tip) serves these tools, with charts drawn in the chat, in Claude, ChatGPT, Cursor, Grok and Copilot — no `uv` or Python to wrangle, and in Claude, Cursor and Grok you just sign in instead of pasting a key. **From $9/mo (Pro) or $29.99/mo (Pro+ — higher limits), with a 14-day money-back guarantee.** Self-hosting stays free forever; hosted is just for folks who'd rather skip the ops. *(Full self-host vs hosted comparison in Quick Start below.)*
72
+
73
+ [![Tests](https://github.com/atilaahmettaner/tradingmcp/actions/workflows/test.yml/badge.svg)](https://github.com/atilaahmettaner/tradingmcp/actions/workflows/test.yml)
74
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
75
+ [![Python 3.10-3.13](https://img.shields.io/badge/python-3.10--3.13-blue.svg)](https://www.python.org/downloads/)
76
+ [![GitHub Sponsors](https://img.shields.io/badge/Sponsor-❤️-pink?logo=github-sponsors)](https://github.com/sponsors/atilaahmettaner)
77
+
78
+ > **⭐ If this tool improves your workflow, please star the repo and consider [sponsoring](https://github.com/sponsors/atilaahmettaner) — it keeps the project alive and growing!**
79
+
80
+ ---
81
+
82
+ ## ✨ Why TradingMCP?
83
+
84
+ | Feature | TradingMCP | Traditional Setups | Bloomberg Terminal |
85
+ |---------|-------------------|--------------------|--------------------|
86
+ | **Setup Time** | 5 minutes | Hours (Docker, Conda...) | Weeks (Contracts) |
87
+ | **Cost** | Free & Open Source | Variable | $30k+/year |
88
+ | **Backtesting** | ✅ 9 strategies + Walk-forward + Sharpe | ❌ Manual scripting | ✅ Proprietary |
89
+ | **News & Sentiment** | ✅ Licensed news + per-ticker sentiment (Marketaux) | ❌ Separate setup | ✅ Terminal |
90
+ | **Market Data** | ✅ Live / Real-Time | Historical / Delayed | Live |
91
+ | **API Keys** | **None for market data** (free Marketaux key for news) | Multiple (OpenAI, etc.) | N/A |
92
+
93
+ ---
94
+
95
+ > [!WARNING]
96
+ > **Security notice: impersonating copies of this repository.** This project is **Python-only** and has **no official npm / Node.js package**. The only official sources are this repository (`atilaahmettaner/tradingmcp`) and the hosted version, TradingMCP, at [tradingmcp.ai](https://tradingmcp.ai/?utm_source=github&utm_medium=readme&utm_content=security_notice) (formerly pro.cryptosieve.com).
97
+ >
98
+ > Copies of this repository published under other accounts add a `package.json` whose dependencies install malware through npm (for example `oracle-redis`, [MAL-2026-16390](https://osv.dev/vulnerability/MAL-2026-16390)). If you cloned a copy of this repository from another account and ran `npm install`, treat that machine as compromised. Thanks to @roberttidball for the report (#101).
99
+
100
+ ## 🚀 Quick Start (5 Minutes)
101
+
102
+ **Two ways to run it:**
103
+
104
+ | | 🧑‍💻 Self-host (this repo) | ☁️ Hosted — [TradingMCP](https://tradingmcp.ai/?utm_source=github&utm_medium=readme&utm_content=quickstart_table) |
105
+ |---|---|---|
106
+ | **Price** | Free forever (MIT) | $9/mo Pro · $29.99/mo Pro+ · 14-day money-back guarantee |
107
+ | **Time to first call** | ~5 minutes (Python + `uv`) | ~60 seconds (add one URL, sign in) |
108
+ | **Updates & ops** | You run and update it | Managed — always on the latest |
109
+ | **Runs on** | Your machine or VPS | Hosted, streamed from the edge |
110
+ | **Limits** | Your hardware | 2,500/mo · 60/min (Pro) → 10,000/mo · 150/min (Pro+) |
111
+ | **Best for** | Tinkerers, forkers, full control | Folks who'd rather skip the ops |
112
+
113
+ > ☁️ **Zero setup:** add `https://mcp.tradingmcp.ai/mcp` as a connector in Claude, Cursor or Grok and sign in; ChatGPT, Copilot and other clients use your private link → **[get started with TradingMCP from $9/mo](https://tradingmcp.ai/?utm_source=github&utm_medium=readme&utm_content=quickstart_cta)** (14-day money-back guarantee) · [setup guide](https://tradingmcp.ai/docs?utm_source=github&utm_medium=readme&utm_content=quickstart_docs). Everything below is for self-hosting.
114
+
115
+ ### Install
116
+ ```bash
117
+ pip install "git+https://github.com/atilaahmettaner/tradingmcp"
118
+ ```
119
+
120
+ > These commands install the current code from this GitHub repository.
121
+
122
+ ### Optional: news & sentiment (free Marketaux key)
123
+
124
+ `financial_news` and `market_sentiment` are powered by [Marketaux](https://www.marketaux.com/) —
125
+ licensed market news with per-entity sentiment. Grab a **free API key**
126
+ (100 requests/day; the server caches for 4h and shares one fetch between news
127
+ and sentiment, so the free tier goes a long way) and set:
128
+
129
+ ```bash
130
+ export MARKETAUX_API_TOKEN=your_token_here # optional
131
+ ```
132
+
133
+ Without a token those two tools return a friendly "not configured" note — all
134
+ other tools work normally.
135
+
136
+ ### Claude Desktop Config (`claude_desktop_config.json`)
137
+
138
+ > **Note:** On macOS, GUI apps like Claude Desktop may not have `~/.local/bin` in their PATH. Use the full path to `uvx` to avoid "command not found" errors.
139
+
140
+ ```json
141
+ {
142
+ "mcpServers": {
143
+ "tradingmcp": {
144
+ "command": "/Users/YOUR_USERNAME/.local/bin/uvx",
145
+ "args": ["--from", "git+https://github.com/atilaahmettaner/tradingmcp", "tradingmcp"]
146
+ }
147
+ }
148
+ }
149
+ ```
150
+
151
+ On Linux, replace `/Users/YOUR_USERNAME` with `/home/YOUR_USERNAME`. On Windows, use `%USERPROFILE%\.local\bin\uvx.exe`.
152
+
153
+ ### Codex
154
+
155
+ This repository ships Codex plugin metadata (`.codex-plugin/plugin.json`, `.codex-mcp.json`) that runs the server from this repository. Setup: [INSTALLATION.md → Codex Plugin](https://github.com/atilaahmettaner/tradingmcp/blob/main/INSTALLATION.md#codex-plugin).
156
+
157
+ ### Or run from source
158
+ ```bash
159
+ git clone https://github.com/atilaahmettaner/tradingmcp
160
+ cd tradingmcp
161
+ uv run tradingmcp
162
+ ```
163
+
164
+ ---
165
+
166
+ ## 🛠️ Troubleshooting
167
+
168
+ ### `An executable named … is not provided by package tradingmcp`
169
+
170
+ The command was renamed in 1.0.0. In your client config, change the command name (the argument after the repository URL) to `tradingmcp`; the config above is complete. The [changelog](https://github.com/atilaahmettaner/tradingmcp/blob/main/CHANGELOG.md) lists what each other way of running the server has to change.
171
+
172
+ ### 🪟 Windows: `MCP error -32001: Request timed out` on first launch
173
+
174
+ Python 3.14 is not supported yet: add `"--python", "3.13"` to the `uvx` args.
175
+
176
+ <details>
177
+ <summary>Symptom, cause and two fixes</summary>
178
+ <br>
179
+
180
+ Symptom — you see this in the Claude Desktop logs shortly after adding the config:
181
+
182
+ ```
183
+ [tradingmcp] Server started and connected successfully
184
+ [tradingmcp] Message from client: initialize ...
185
+ [60 seconds later]
186
+ [tradingmcp] notifications/cancelled — reason: "MCP error -32001: Request timed out"
187
+ ```
188
+
189
+ **Why it happens:** Python 3.14 is not supported yet. `uvx` downloads the server, creates a fresh virtualenv, and installs dependencies the first time it runs. Some native dependencies in the MCP stack do not currently publish compatible Python 3.14 wheels, so installation can fall back to source builds or fail before Claude Desktop finishes initializing the server.
190
+
191
+ **Fix — pin to Python 3.13:**
192
+
193
+ ```json
194
+ {
195
+ "mcpServers": {
196
+ "tradingmcp": {
197
+ "command": "uvx",
198
+ "args": ["--python", "3.13", "--from", "git+https://github.com/atilaahmettaner/tradingmcp", "tradingmcp"]
199
+ }
200
+ }
201
+ }
202
+ ```
203
+
204
+ On macOS use the full path to `uvx` (see the note in Quick Start). On Windows `uvx` is typically `%USERPROFILE%\.local\bin\uvx.exe`.
205
+
206
+ **Alternative — pre-install once, then let Claude Desktop reuse the cache:**
207
+
208
+ ```bash
209
+ # Run in a terminal before launching Claude Desktop
210
+ uv tool install --python 3.13 "git+https://github.com/atilaahmettaner/tradingmcp"
211
+ ```
212
+
213
+ After the install finishes, start Claude Desktop with the normal config and the server will come up instantly (cache is already warm).
214
+
215
+ > _Credit: [@wyh4444](https://github.com/wyh4444) for the original report in [#24](https://github.com/atilaahmettaner/tradingmcp/issues/24)._
216
+
217
+ </details>
218
+
219
+ ---
220
+
221
+ ## ⚠️ Error Envelope Format
222
+
223
+ Tools that have adopted the structured error format return either their normal payload **or** an error envelope, so a caller can tell "no matches today" from an upstream outage.
224
+
225
+ <details>
226
+ <summary>Envelope shape, which tools use it, and how to detect it</summary>
227
+ <br>
228
+
229
+ ```json
230
+ {"error": {"code": "UPSTREAM_ERROR", "message": "Failed to fetch history for 'AAPL': ...", "yahoo_symbol": "AAPL", "retryable": true}}
231
+ ```
232
+
233
+ **Why:** the previous `[]` / `{"error": "Analysis failed: ..."}` strings made it impossible to distinguish "no matches today" from "upstream rate-limit cliff." The new envelope is programmatically branchable by `code`, and `retryable` tells the caller whether waiting and retrying can help (upstream storms pass; a missing dependency won't fix itself).
234
+
235
+ **Coverage:** `smart_money_analysis` and `egx_smart_money_scanner` build their errors with the envelope helpers; the two options tools use them only for unexpected errors. Not migrated yet: `market_sentiment`, `financial_news`, the three backtest tools, `yahoo_price`, `market_snapshot`, `bitcoin_market_pulse` and `stock_extended_hours`; tracked in [#76](https://github.com/atilaahmettaner/tradingmcp/issues/76).
236
+
237
+ **Detecting an error:**
238
+
239
+ ```python
240
+ result = smart_money_analysis(symbol="AAPL", exchange="NASDAQ")
241
+ if isinstance(result.get("error"), dict):
242
+ code = result["error"]["code"]
243
+ if result["error"].get("retryable"):
244
+ # Wait and retry, raise an alert, etc.
245
+ ...
246
+ else:
247
+ ...
248
+ ```
249
+
250
+ Stable codes are defined in [`core/errors.py`](https://github.com/atilaahmettaner/tradingmcp/blob/main/src/tradingmcp/core/errors.py).
251
+
252
+ </details>
253
+
254
+ ---
255
+
256
+ ## 📱 Use via Telegram, WhatsApp & More (OpenClaw)
257
+
258
+ Connect this server to **Telegram, WhatsApp, Discord** and 20+ messaging platforms using [OpenClaw](https://openclaw.ai) — a self-hosted AI gateway. **Tested & verified on Hetzner VPS (Ubuntu 24.04).**
259
+
260
+ 👉 **[Full OpenClaw Setup Guide →](https://github.com/atilaahmettaner/tradingmcp/blob/main/OPENCLAW.md)**
261
+
262
+ <details>
263
+ <summary>Quick setup, model choice and common mistakes</summary>
264
+
265
+ ### How It Works
266
+
267
+ > OpenClaw routes Telegram messages to an AI agent. The agent uses `trading.py` — a thin Python wrapper — to call TradingMCP functions and return formatted results. **No MCP protocol needed between OpenClaw and the server; it's a direct Python import.**
268
+
269
+ ```
270
+ Telegram → OpenClaw agent (AI model) → trading.py (bash) → TradingMCP → Yahoo Finance
271
+ ```
272
+
273
+ ### Quick Setup
274
+
275
+ ```bash
276
+ # 1. Install UV and the server
277
+ curl -LsSf https://astral.sh/uv/install.sh | sh && source ~/.bashrc
278
+ uv tool install "git+https://github.com/atilaahmettaner/tradingmcp"
279
+
280
+ # 2. Configure OpenClaw channels
281
+ cat > ~/.openclaw/openclaw.json << 'EOF'
282
+ {
283
+ channels: {
284
+ telegram: {
285
+ botToken: "YOUR_BOT_TOKEN_HERE",
286
+ },
287
+ },
288
+ }
289
+ EOF
290
+
291
+ # 3. Configure gateway + agent
292
+ openclaw config set gateway.mode local
293
+ openclaw config set acp.defaultAgent main
294
+
295
+ # 4. Set your AI model (choose ONE option below)
296
+ openclaw configure --section model
297
+
298
+ # 5. Install the skill + tool wrapper
299
+ mkdir -p ~/.agents/skills/tradingmcp ~/.openclaw/tools
300
+ curl -fsSL https://raw.githubusercontent.com/atilaahmettaner/tradingmcp/main/openclaw/SKILL.md \
301
+ -o ~/.agents/skills/tradingmcp/SKILL.md
302
+ curl -fsSL https://raw.githubusercontent.com/atilaahmettaner/tradingmcp/main/openclaw/trading.py \
303
+ -o ~/.openclaw/tools/trading.py && chmod +x ~/.openclaw/tools/trading.py
304
+
305
+ # 6. Start the gateway
306
+ openclaw gateway install
307
+ systemctl --user start openclaw-gateway.service
308
+ ```
309
+
310
+ ### Choose Your AI Model
311
+
312
+ OpenRouter is **not required** — use whichever provider you have a key for:
313
+
314
+ | Provider | Model ID for OpenClaw | Get Key |
315
+ |----------|----------------------|---------|
316
+ | **OpenRouter** (aggregator — access to all models) | `openrouter/google/gemini-3-flash-preview` | [openrouter.ai/keys](https://openrouter.ai/keys) |
317
+ | **Anthropic** (Claude direct) | `anthropic/claude-sonnet-4-5` | [console.anthropic.com](https://console.anthropic.com) |
318
+ | **Google** (Gemini direct) | `google/gemini-2.5-flash` | [aistudio.google.com](https://aistudio.google.com) |
319
+ | **OpenAI** (GPT direct) | `openai/gpt-4o-mini` | [platform.openai.com](https://platform.openai.com) |
320
+
321
+ ```bash
322
+ # Examples — set your chosen model:
323
+ openclaw config set agents.defaults.model "openrouter/google/gemini-3-flash-preview" # via OpenRouter
324
+ openclaw config set agents.defaults.model "anthropic/claude-sonnet-4-5" # Anthropic direct
325
+ openclaw config set agents.defaults.model "google/gemini-2.5-flash" # Google direct
326
+ ```
327
+
328
+ > ⚠️ **Important:** Prefix must match your provider. `google/...` needs a Google API key. `openrouter/...` needs an OpenRouter key.
329
+
330
+ ### ⚠️ Common Mistakes
331
+
332
+ | Symptom | Cause | Fix |
333
+ |---------|-------|-----|
334
+ | `Unrecognized keys: mcpServers` | `mcpServers` not supported in this version | Remove from config, use bash wrapper |
335
+ | `No API key for provider "google"` | Used `google/model` but only have OpenRouter key | Use `openrouter/google/model` instead |
336
+ | `which agent?` loop | `acp.defaultAgent` not set | `openclaw config set acp.defaultAgent main` |
337
+ | Gateway won't start | `gateway.mode` missing | `openclaw config set gateway.mode local` |
338
+
339
+ ### Test Your Bot
340
+
341
+ Once running, send your Telegram bot:
342
+ ```
343
+ market snapshot
344
+ backtest RSI strategy for AAPL, 1 year
345
+ compare all strategies for BTC-USD
346
+ ```
347
+
348
+ </details>
349
+
350
+ ---
351
+
352
+ ## 🔧 All 13 MCP Tools
353
+
354
+ > The technical-analysis, scanner, futures and EGX market tools of earlier versions are not in this version. They are being rebuilt on a different data source.
355
+
356
+ ### 📊 Backtesting Engine
357
+
358
+ | Tool | Description |
359
+ |------|-------------|
360
+ | `backtest_strategy` | Backtest 1 of 9 strategies with institutional metrics (Sharpe, Calmar, Expectancy). Supports `1d` and `1h` timeframes; optional full trade log + equity curve. |
361
+ | `compare_strategies` | Run all 9 strategies on the same symbol and rank by performance. |
362
+ | `walk_forward_backtest_strategy` | Train/test split walk-forward validation with overfitting verdict (ROBUST / MODERATE / WEAK / OVERFITTED). |
363
+
364
+ **9 Strategies to Test:**
365
+ - `rsi` — RSI oversold/overbought mean reversion
366
+ - `bollinger` — Bollinger Band mean reversion
367
+ - `macd` — MACD golden/death cross
368
+ - `ema_cross` — EMA 20/50 Golden/Death Cross
369
+ - `supertrend` — ATR-based Supertrend trend following
370
+ - `donchian` — Donchian Channel breakout (Turtle Trader style)
371
+ - `rsi_pullback` — Dip-buy in confirmed uptrend (SMA50>SMA200 + RSI<40 entry)
372
+ - `keltner_breakout` — ATR-normalized breakout (EMA20 + 2·ATR upper band)
373
+ - `triple_ema` — EMA 20/50 cross gated by SMA200 trend filter
374
+
375
+ > `rsi_pullback`, `keltner_breakout` and `triple_ema` need `period='1y'` or `'2y'` so the SMA200 trend filter can complete its warmup.
376
+
377
+ **Metrics you get:** Win Rate, Total Return, Sharpe Ratio, Calmar Ratio, Max Drawdown, Profit Factor, Expectancy, Best/Worst Trade, vs Buy-and-Hold, with **realistic commission + slippage simulation**.
378
+
379
+ ```
380
+ Example prompt: "Compare all 9 strategies on MSFT for 2 years"
381
+ → #1 triple_ema: +15.1% | Sharpe: 0.0 | WR: 100%
382
+ → #2 keltner_breakout: +14.3% | Sharpe: 4.7 | WR: 40%
383
+ → #3 bollinger: +12.2% | Sharpe: 4.1 | WR: 64%
384
+ → Buy & Hold: -2.1%
385
+ ```
386
+
387
+ ---
388
+
389
+ ### 💰 Prices & Market Overview
390
+
391
+ | Tool | Description |
392
+ |------|-------------|
393
+ | `yahoo_price` | Quote from Yahoo Finance: price, change %, 52w high/low, market state |
394
+ | `market_snapshot` | Global overview: S&P500, NASDAQ, VIX, BTC, ETH, EUR/USD, SPY, GLD |
395
+ | `bitcoin_market_pulse` | BTC price, dominance, total crypto market cap and a risk read (CoinGecko). |
396
+ | `stock_extended_hours` | US pre-market and after-hours prices. |
397
+
398
+ **`yahoo_price` supports:** Stocks (AAPL, TSLA, NVDA), Crypto (BTC-USD, ETH-USD, SOL-USD), ETFs (SPY, QQQ, GLD), Indices (^GSPC, ^DJI, ^IXIC, ^VIX), FX (EURUSD=X), Turkish (THYAO.IS, SASA.IS)
399
+
400
+ ### 🕵️ Smart Money
401
+
402
+ | Tool | Description |
403
+ |------|-------------|
404
+ | `smart_money_analysis` | Banker / hot-money accumulation read from price and volume history. |
405
+ | `egx_smart_money_scanner` | Ranks EGX index constituents by smart-money accumulation. |
406
+
407
+ ### 🧠 News & Sentiment (Marketaux)
408
+
409
+ | Tool | Description |
410
+ |------|-------------|
411
+ | `financial_news` | Latest financial headlines from Marketaux (licensed), optionally for one symbol. |
412
+ | `market_sentiment` | News sentiment for a stock or coin: bullish/bearish score and the articles behind it. |
413
+
414
+ Self-hosting? These two need a free `MARKETAUX_API_TOKEN` (see Quick Start).
415
+
416
+ ### 🧾 US Options
417
+
418
+ | Tool | Description |
419
+ |------|-------------|
420
+ | `stock_options_chain` | Full options chain (calls + puts) for a US stock and one expiry. |
421
+ | `stock_options_unusual_activity` | Strikes with unusual volume vs open interest, plus call vs put volume. |
422
+
423
+ ---
424
+
425
+ ## 💬 Example AI Conversations
426
+
427
+ ```
428
+ You: "Give me a full market snapshot right now"
429
+ AI: [market_snapshot] → S&P500 -3.4%, BTC +0.1%, VIX 31 (+13%), EUR/USD 1.15
430
+
431
+ You: "What's the news sentiment on NVDA?"
432
+ AI: [market_sentiment] → Strongly Bullish (0.41) | 3 articles | 2 bullish
433
+
434
+ You: "Backtest RSI strategy on BTC-USD for 2 years"
435
+ AI: [backtest_strategy] → +31.5% return | 100% win rate | 2 trades | B&H: -5%
436
+
437
+ You: "Which of the 9 strategies worked best on MSFT in the last 2 years?"
438
+ AI: [compare_strategies] → triple_ema #1 (+15.1%, WR 100%), keltner_breakout #2 (+14.3%), macd last (-23.4%)
439
+
440
+ You: "Run walk-forward backtest on supertrend for SPY"
441
+ AI: [walk_forward_backtest_strategy] → Verdict: ROBUST (avg robustness 0.92) | OOS return +8.5%
442
+ ```
443
+
444
+ ---
445
+
446
+ ## 💖 Support the Project
447
+
448
+ This framework is **free and open source**, built in spare time. If it saves you hours of research or helps you make better decisions, please consider sponsoring:
449
+
450
+ | Tier | Monthly | What You Get |
451
+ |------|---------|--------------|
452
+ | ☕ Coffee | $5 | Heartfelt gratitude + name in README |
453
+ | 🚀 Supporter | $15 | Above + priority bug fixes |
454
+ | 💎 Pro | $30 | Above + priority feature requests |
455
+
456
+ <a href="https://github.com/sponsors/atilaahmettaner">
457
+ <img src="https://img.shields.io/badge/Become_a_Sponsor-pink?style=for-the-badge&logo=github-sponsors" alt="Sponsor"/>
458
+ </a>
459
+
460
+ ---
461
+
462
+ ## 📄 License
463
+
464
+ MIT License — see [LICENSE](https://github.com/atilaahmettaner/tradingmcp/blob/main/LICENSE) for details.
465
+
466
+ ---
467
+
468
+ *Disclaimer: This tool is for educational and research purposes only. It does not constitute financial advice. Always do your own research before making investment decisions.*