Skip to content

Commit db91fa4

Browse files
committed
v2.2.2
Signed-off-by: TIANHE <TIANHE@GMAIL.COM>
1 parent d60409f commit db91fa4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1591
-606
lines changed

README.md

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<p><strong>Vibe Coding Meets Algo Trading</strong></p>
1010

1111
<p>
12-
<strong>7 AI Agents · Python Strategies · 10+ Exchanges · Your Server, Your Keys</strong>
12+
<strong>7 AI Agents · Python Strategies · 10+ Exchanges · Prediction Markets · Your Server, Your Keys</strong>
1313
</p>
1414
<p>
1515
<i>Describe your trading idea in natural language → AI writes the Python strategy → Backtest → Live trade.<br/>
@@ -25,7 +25,7 @@
2525

2626
<p>
2727
<a href="LICENSE"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat-square&logo=apache" alt="License"></a>
28-
<img src="https://img.shields.io/badge/Version-2.2.1-orange?style=flat-square" alt="Version">
28+
<img src="https://img.shields.io/badge/Version-2.2.3-orange?style=flat-square" alt="Version">
2929
<img src="https://img.shields.io/badge/Python-3.10+-3776AB?style=flat-square&logo=python&logoColor=white" alt="Python">
3030
<img src="https://img.shields.io/badge/Docker-One%20Click-2496ED?style=flat-square&logo=docker&logoColor=white" alt="Docker">
3131
<img src="https://img.shields.io/badge/Vibe%20Coding-Ready-FF6B6B?style=flat-square&logo=sparkles&logoColor=white" alt="Vibe Coding">
@@ -38,7 +38,7 @@
3838
<a href="https://x.com/HenryCryption"><img src="https://img.shields.io/badge/X-Follow-000000?style=for-the-badge&logo=x" alt="X"></a>
3939
</p>
4040

41-
<sub>🇺🇸 English · 🇨🇳 简体中文 · 🇹🇼 繁體中文 · 🇯🇵 日本語 · 🇰🇷 한국어 · 🇩🇪 Deutsch · 🇫🇷 Français · 🇹🇭 ไทย · 🇻🇳 Tiếng Việt · 🇸🇦 العربية</sub>
41+
<sub>🇺🇸 <a href="README.md">English</a> · 🇨🇳 <a href="docs/README_CN.md">简体中文</a> · 🇹🇼 繁體中文 · 🇯🇵 日本語 · 🇰🇷 한국어 · 🇩🇪 Deutsch · 🇫🇷 Français · 🇹🇭 ไทย · 🇻🇳 Tiếng Việt · 🇸🇦 العربية</sub>
4242
</div>
4343

4444
---
@@ -139,6 +139,7 @@ BACKEND_PORT=127.0.0.1:5001 # Default: 5000
139139
| 🐍 **Python-Native** | Full ecosystem (Pandas, NumPy, TA-Lib, scikit-learn) — no proprietary language limits |
140140
| 📊 **Professional Charts** | K-line charts with Python indicators, real-time visualization |
141141
| 🌍 **Crypto + Stocks + Forex** | 10+ exchanges, IBKR, MT5 — all in one platform |
142+
| 📊 **Prediction Markets** | On-demand AI analysis for Polymarket — probability divergence, opportunity scoring |
142143
| 💰 **Monetization-Ready** | Membership, credits, USDT on-chain payment — built-in |
143144
|**2-Minute Deploy** | `docker-compose up -d` — production-ready, zero build |
144145

@@ -209,6 +210,7 @@ Phase 3 (Decision): 🎯 TraderAgent → BUY / SELL / HOLD (with confidence %)
209210
- **⚡ Quick Trade Panel** — See a signal? One-click to execute. No page switching.
210211
- **🧠 Memory-Augmented** — Agents learn from past analyses (local RAG, not cloud)
211212
- **🔌 5+ LLM Providers**: OpenRouter (100+ models), OpenAI, Gemini, DeepSeek, Grok
213+
- **📊 Polymarket Prediction Markets** — On-demand AI analysis for prediction markets. Input a market link or title → AI analyzes probability divergence, opportunity score, and trading recommendations. Full history tracking and billing integration.
212214

213215
### 📈 Full Trading Lifecycle
214216

@@ -221,6 +223,33 @@ Phase 3 (Decision): 🎯 TraderAgent → BUY / SELL / HOLD (with confidence %)
221223
| **5. 🚀 Execute** | Live trade on 10+ crypto exchanges, IBKR (stocks), MT5 (forex) |
222224
| **6. 📡 Monitor** | Portfolio tracker, alerts via Telegram/Discord/Email/SMS/Webhook |
223225

226+
### 📊 Polymarket Prediction Market Analysis
227+
228+
> **On-demand AI analysis for prediction markets.** Input a Polymarket link or market title → AI analyzes probability divergence, opportunity score, and provides trading recommendations.
229+
230+
**Features:**
231+
- **🔍 Smart Search** — Supports market links, slugs, or natural language titles
232+
- **🤖 AI Probability Prediction** — Compares AI-predicted probability vs market probability
233+
- **📈 Opportunity Scoring** — Calculates opportunity score based on divergence and confidence
234+
- **💡 Trading Recommendations** — YES/NO/HOLD with detailed reasoning and key factors
235+
- **📚 History Tracking** — View all your past analyses with full details in a dedicated history tab
236+
- **💰 Billing Integration** — Configurable credit consumption per analysis (set via `BILLING_COST_POLYMARKET_DEEP_ANALYSIS`)
237+
- **🌍 Multi-Language** — AI responses match your frontend language (English/Chinese)
238+
- **📊 Admin Statistics** — All analyses tracked in user management dashboard
239+
240+
**Usage:**
241+
```
242+
1. Navigate to AI Asset Analysis → Prediction Markets tab
243+
2. Input Polymarket link or market title
244+
3. AI analyzes and returns:
245+
- Market probability vs AI-predicted probability
246+
- Divergence analysis
247+
- Opportunity score (0-100)
248+
- Trading recommendation (YES/NO/HOLD)
249+
- Detailed reasoning and key factors
250+
4. View analysis history anytime
251+
```
252+
224253
### 💰 Built-in Monetization
225254

226255
> Most open-source projects need months of custom billing work. QuantDinger ships with a **complete monetization system** out of the box:

backend_api_python/app/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ def restore_running_strategies():
150150
logger.info(f"[OK] {strategy_type_name} {strategy_id} restored")
151151
else:
152152
logger.warning(f"[FAIL] {strategy_type_name} {strategy_id} restore failed (state may be stale)")
153+
# 如果恢复失败,更新数据库状态为stopped,避免策略处于"僵尸"状态
154+
try:
155+
strategy_service.update_strategy_status(strategy_id, 'stopped')
156+
logger.info(f"[FIX] Updated strategy {strategy_id} status to 'stopped' after restore failure")
157+
except Exception as e:
158+
logger.error(f"Failed to update strategy {strategy_id} status after restore failure: {e}")
153159
except Exception as e:
154160
logger.error(f"Error restoring strategy {strategy_id}: {str(e)}")
155161
logger.error(traceback.format_exc())

backend_api_python/app/config/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"""
55
from app.config.settings import Config
66
from app.config.api_keys import APIKeys
7-
from app.config.database import RedisConfig, SQLiteConfig, CacheConfig
7+
from app.config.database import RedisConfig, CacheConfig
88
from app.config.data_sources import (
99
DataSourceConfig,
1010
FinnhubConfig,
@@ -23,7 +23,6 @@
2323

2424
# 数据库/缓存
2525
'RedisConfig',
26-
'SQLiteConfig',
2726
'CacheConfig',
2827

2928
# 数据源

backend_api_python/app/config/database.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,26 +46,6 @@ def get_url(cls) -> str:
4646
return f"redis://{cls.HOST}:{cls.PORT}/{cls.DB}"
4747

4848

49-
class MetaSQLiteConfig(type):
50-
"""SQLite 配置"""
51-
52-
@property
53-
def DATABASE_FILE(cls):
54-
# 默认放在 backend_api_python/data 目录(更干净,也与 docker-compose 挂载一致)
55-
base_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
56-
default_path = os.path.join(base_dir, 'data', 'quantdinger.db')
57-
return os.getenv('SQLITE_DATABASE_FILE', default_path)
58-
59-
60-
class SQLiteConfig(metaclass=MetaSQLiteConfig):
61-
"""SQLite 数据库配置"""
62-
63-
@classmethod
64-
def get_path(cls) -> str:
65-
"""获取数据库文件路径"""
66-
return cls.DATABASE_FILE
67-
68-
6949
class MetaCacheConfig(type):
7050
"""缓存业务配置"""
7151

0 commit comments

Comments
 (0)