Update README
This commit is contained in:
282
deploy_scripts/blog_api.py
Normal file
282
deploy_scripts/blog_api.py
Normal file
@ -0,0 +1,282 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Blog API — 给 N8N / gfil_cron.py 提供 JSON 数据源
|
||||
部署后访问: blog.quant-view.xyz/api/tools.json
|
||||
blog.quant-view.xyz/api/articles.json
|
||||
|
||||
用法: python blog_api.py # 生成 JSON 文件到 output/api/
|
||||
"""
|
||||
import json, os, sys, io
|
||||
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
from config import BLOG_URL as BLOG
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
OUTPUT_DIR = os.path.join(BASE_DIR, "..", "output", "api")
|
||||
|
||||
# ===== 工具列表 =====
|
||||
TOOLS = [
|
||||
{
|
||||
"name": "Position Size Calculator",
|
||||
"description": "Calculate exact lot size: (Account x Risk%) / (Stop Loss x Pip Value)",
|
||||
"url": f"{BLOG}/tools/position-size-calculator.html",
|
||||
"category": "Risk Management",
|
||||
"keywords": ["position size", "lot size", "forex calculator", "risk management"]
|
||||
},
|
||||
{
|
||||
"name": "Pip Value Calculator",
|
||||
"description": "Know what each pip is worth for any currency pair including gold XAUUSD",
|
||||
"url": f"{BLOG}/tools/pip-calculator.html",
|
||||
"category": "Risk Management",
|
||||
"keywords": ["pip value", "pip calculator", "forex", "gold pip"]
|
||||
},
|
||||
{
|
||||
"name": "Fibonacci Retracement Calculator",
|
||||
"description": "Get all Fibonacci levels: 23.6%, 38.2%, 50%, 61.8%, 78.6%",
|
||||
"url": f"{BLOG}/tools/fibonacci-calculator.html",
|
||||
"category": "Technical Analysis",
|
||||
"keywords": ["fibonacci", "retracement", "golden ratio", "technical analysis"]
|
||||
},
|
||||
{
|
||||
"name": "ATR Stop Loss Calculator",
|
||||
"description": "Let volatility determine your stop loss. 1.5x ATR for intraday, 2x for swings",
|
||||
"url": f"{BLOG}/tools/atr-calculator.html",
|
||||
"category": "Risk Management",
|
||||
"keywords": ["ATR", "average true range", "stop loss", "volatility"]
|
||||
},
|
||||
{
|
||||
"name": "Margin Calculator",
|
||||
"description": "Know required margin before entering any trade. Avoid margin calls",
|
||||
"url": f"{BLOG}/tools/margin-calculator.html",
|
||||
"category": "Risk Management",
|
||||
"keywords": ["margin", "leverage", "margin call", "forex"]
|
||||
},
|
||||
{
|
||||
"name": "Kelly Criterion Calculator",
|
||||
"description": "Mathematically optimal bet size for maximum account growth. Use half-Kelly for safety",
|
||||
"url": f"{BLOG}/tools/kelly-calculator.html",
|
||||
"category": "Performance",
|
||||
"keywords": ["kelly criterion", "position sizing", "optimal bet", "risk"]
|
||||
},
|
||||
{
|
||||
"name": "Risk/Reward Ratio Calculator",
|
||||
"description": "Calculate if your trade makes mathematical sense. Minimum 1:2 recommended",
|
||||
"url": f"{BLOG}/tools/risk-reward-calculator.html",
|
||||
"category": "Risk Management",
|
||||
"keywords": ["risk reward", "R:R", "trade calculator", "forex"]
|
||||
},
|
||||
{
|
||||
"name": "Drawdown Calculator",
|
||||
"description": "Track your maximum peak-to-trough decline. Keep it under 20%",
|
||||
"url": f"{BLOG}/tools/drawdown-calculator.html",
|
||||
"category": "Performance",
|
||||
"keywords": ["drawdown", "risk", "account management"]
|
||||
},
|
||||
{
|
||||
"name": "Profit Factor Calculator",
|
||||
"description": "The metric professional funds track. Above 1.5 is solid, above 2.0 is pro grade",
|
||||
"url": f"{BLOG}/tools/profit-factor-calculator.html",
|
||||
"category": "Performance",
|
||||
"keywords": ["profit factor", "sharpe ratio", "trading performance"]
|
||||
},
|
||||
{
|
||||
"name": "Compound Interest Calculator",
|
||||
"description": "See how compounding grows your account. Consistency beats home runs",
|
||||
"url": f"{BLOG}/tools/compound-interest-calculator.html",
|
||||
"category": "Performance",
|
||||
"keywords": ["compound interest", "account growth", "trading math"]
|
||||
},
|
||||
{
|
||||
"name": "Pivot Point Calculator",
|
||||
"description": "Today's support and resistance levels: S1, S2, S3, R1, R2, R3, central pivot",
|
||||
"url": f"{BLOG}/tools/pivot-point-calculator.html",
|
||||
"category": "Technical Analysis",
|
||||
"keywords": ["pivot point", "support resistance", "S1 R1", "day trading"]
|
||||
},
|
||||
{
|
||||
"name": "Correlation Matrix",
|
||||
"description": "See which forex pairs move together. EURUSD+GBPUSD: +0.85. EURUSD+USDCHF: -0.90",
|
||||
"url": f"{BLOG}/tools/correlation-calculator.html",
|
||||
"category": "Technical Analysis",
|
||||
"keywords": ["correlation", "forex pairs", "currency correlation"]
|
||||
},
|
||||
{
|
||||
"name": "Currency Strength Meter",
|
||||
"description": "Compare all 8 major currencies in real time. Trade strong vs weak",
|
||||
"url": f"{BLOG}/tools/currency-strength-meter.html",
|
||||
"category": "Technical Analysis",
|
||||
"keywords": ["currency strength", "forex meter", "USD EUR GBP"]
|
||||
},
|
||||
{
|
||||
"name": "Trading Journal Template",
|
||||
"description": "Track every trade like a professional. Date, pair, entry, exit, P&L, notes",
|
||||
"url": f"{BLOG}/tools/trading-journal-template.html",
|
||||
"category": "Tools",
|
||||
"keywords": ["trading journal", "trade tracking", "performance"]
|
||||
},
|
||||
{
|
||||
"name": "Forex Market Hours Clock",
|
||||
"description": "Live trading session clock showing Sydney, Tokyo, London, New York sessions in real-time",
|
||||
"url": f"{BLOG}/tools/forex-market-hours.html",
|
||||
"category": "Trading Sessions",
|
||||
"keywords": ["forex market hours", "trading sessions", "forex clock", "session overlap"]
|
||||
},
|
||||
{
|
||||
"name": "Swap / Rollover Calculator",
|
||||
"description": "Calculate overnight swap fees. Know exactly what holding a position overnight costs you",
|
||||
"url": f"{BLOG}/tools/swap-calculator.html",
|
||||
"category": "Cost Analysis",
|
||||
"keywords": ["swap calculator", "rollover fee", "overnight swap", "forex holding cost"]
|
||||
},
|
||||
{
|
||||
"name": "Risk of Ruin Calculator",
|
||||
"description": "Calculate probability of blowing your trading account. Essential risk management metric",
|
||||
"url": f"{BLOG}/tools/risk-of-ruin-calculator.html",
|
||||
"category": "Risk Management",
|
||||
"keywords": ["risk of ruin", "account blowup", "trading risk", "probability of ruin"]
|
||||
},
|
||||
{
|
||||
"name": "Forex Economic Calendar",
|
||||
"description": "High-impact forex news events — NFP, CPI, FOMC, GDP, PMI. Never get caught by surprise news",
|
||||
"url": f"{BLOG}/tools/forex-economic-calendar.html",
|
||||
"category": "News & Events",
|
||||
"keywords": ["economic calendar", "forex news", "NFP", "CPI", "FOMC", "GDP calendar"]
|
||||
},
|
||||
{
|
||||
"name": "Moving Average Calculator",
|
||||
"description": "Calculate SMA, EMA, WMA for any price data. 200 SMA, 9/21 EMA crossover signals",
|
||||
"url": f"{BLOG}/tools/moving-average-calculator.html",
|
||||
"category": "Technical Analysis",
|
||||
"keywords": ["moving average", "SMA", "EMA", "WMA", "moving average crossover", "200 SMA"]
|
||||
},
|
||||
{
|
||||
"name": "RSI Calculator",
|
||||
"description": "Relative Strength Index. Identify overbought (>70) and oversold (<30) conditions",
|
||||
"url": f"{BLOG}/tools/rsi-calculator.html",
|
||||
"category": "Technical Analysis",
|
||||
"keywords": ["RSI", "relative strength index", "overbought", "oversold", "RSI divergence"]
|
||||
},
|
||||
{
|
||||
"name": "MACD Calculator",
|
||||
"description": "MACD line, signal line, histogram. Signal crossovers, zero line crosses, divergence",
|
||||
"url": f"{BLOG}/tools/macd-calculator.html",
|
||||
"category": "Technical Analysis",
|
||||
"keywords": ["MACD", "MACD indicator", "signal crossover", "MACD divergence", "histogram"]
|
||||
},
|
||||
]
|
||||
|
||||
# ===== 文章列表 =====
|
||||
ARTICLES = [
|
||||
{
|
||||
"title": "GFIL BOSS PANEL v7.0 Review",
|
||||
"summary": "Institutional trading terminal review: WebSocket <50ms, 16 calculators, 30+ instruments",
|
||||
"url": f"{BLOG}/gfil-boss-panel-v70-review.html",
|
||||
"date": "2026-05-25",
|
||||
"tags": ["GFIL", "Review", "Trading Terminal"]
|
||||
},
|
||||
{
|
||||
"title": "Gold XAUUSD Trading in 2026",
|
||||
"summary": "Why retail indicators fail. Order flow: cumulative delta, volume profile, absorption, GOFO rates",
|
||||
"url": f"{BLOG}/gold-xauusd-trading-2026.html",
|
||||
"date": "2026-05-24",
|
||||
"tags": ["Gold", "XAUUSD", "Order Flow"]
|
||||
},
|
||||
{
|
||||
"title": "TradingView vs GFIL BOSS — The Latency Truth",
|
||||
"summary": "REST 500ms-3s vs WebSocket <50ms. For scalpers, that is 60-100 pips/day difference",
|
||||
"url": f"{BLOG}/tradingview-vs-gfil-boss.html",
|
||||
"date": "2026-05-23",
|
||||
"tags": ["TradingView", "Latency", "Comparison"]
|
||||
},
|
||||
{
|
||||
"title": "Why 87% of Retail Traders Lose Money",
|
||||
"summary": "Data asymmetry: institutions get market data 15 min before retail. The real reason traders lose",
|
||||
"url": f"{BLOG}/why-retail-traders-lose-money.html",
|
||||
"date": "2026-05-22",
|
||||
"tags": ["Trading Psychology", "Data Asymmetry"]
|
||||
},
|
||||
{
|
||||
"title": "Forex Scalping Strategy 2026 — M5 London Open Setup",
|
||||
"summary": "5 pip stop, 12-15 target, delta divergence confirmation. 40% win rate, positive expectancy",
|
||||
"url": f"{BLOG}/forex-scalping-2026.html",
|
||||
"date": "2026-05-20",
|
||||
"tags": ["Forex", "Scalping", "M5", "Strategy"]
|
||||
},
|
||||
{
|
||||
"title": "How Institutions See Market Moves 15 Min Before Retail",
|
||||
"summary": "Order flow, dark pool prints, cumulative delta — the institutional information edge explained",
|
||||
"url": f"{BLOG}/institutional-traders-see-market-moves.html",
|
||||
"date": "2026-05-19",
|
||||
"tags": ["Institutional", "Order Flow", "Market Intelligence"]
|
||||
},
|
||||
{
|
||||
"title": "Order Flow Trading Guide",
|
||||
"summary": "Cumulative delta divergence, volume profile, footprint charts, absorption patterns",
|
||||
"url": f"{BLOG}/order-flow-trading.html",
|
||||
"date": "2026-06-02",
|
||||
"tags": ["Order Flow", "Delta", "Volume Profile"]
|
||||
},
|
||||
{
|
||||
"title": "WebSocket vs REST API for Trading",
|
||||
"summary": "NFP first minute: REST = 30 data points. WebSocket = 6,000. The difference is your edge",
|
||||
"url": f"{BLOG}/websocket-vs-rest-api.html",
|
||||
"date": "2026-06-02",
|
||||
"tags": ["WebSocket", "REST", "Data Latency"]
|
||||
},
|
||||
{
|
||||
"title": "WTI Crude Oil Trading Strategy 2026",
|
||||
"summary": "EIA inventory momentum, OPEC+ volatility play, crack spread correlation, energy trading",
|
||||
"url": f"{BLOG}/wti-crude-oil-2026.html",
|
||||
"date": "2026-05-17",
|
||||
"tags": ["WTI", "Crude Oil", "Energy"]
|
||||
},
|
||||
{
|
||||
"title": "Anonymous Trading Platform Guide 2026",
|
||||
"summary": "Protect your strategy from brokers, HFT firms, and market makers. Privacy-first trading",
|
||||
"url": f"{BLOG}/trading-activity-tracked.html",
|
||||
"date": "2026-05-21",
|
||||
"tags": ["Privacy", "Security", "Anonymous Trading"]
|
||||
},
|
||||
]
|
||||
|
||||
def generate():
|
||||
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
||||
|
||||
tools_path = os.path.join(OUTPUT_DIR, "tools.json")
|
||||
with open(tools_path, "w", encoding="utf-8") as f:
|
||||
json.dump({
|
||||
"count": len(TOOLS),
|
||||
"updated": "2026-06-12",
|
||||
"tools": TOOLS
|
||||
}, f, indent=2, ensure_ascii=False)
|
||||
print(f" OK tools.json ({len(TOOLS)} tools)")
|
||||
|
||||
articles_path = os.path.join(OUTPUT_DIR, "articles.json")
|
||||
with open(articles_path, "w", encoding="utf-8") as f:
|
||||
json.dump({
|
||||
"count": len(ARTICLES),
|
||||
"updated": "2026-06-12",
|
||||
"articles": ARTICLES
|
||||
}, f, indent=2, ensure_ascii=False)
|
||||
print(f" OK articles.json ({len(ARTICLES)} articles)")
|
||||
|
||||
index_path = os.path.join(OUTPUT_DIR, "index.json")
|
||||
with open(index_path, "w", encoding="utf-8") as f:
|
||||
json.dump({
|
||||
"blog": BLOG,
|
||||
"tools_count": len(TOOLS),
|
||||
"articles_count": len(ARTICLES),
|
||||
"telegram": "https://t.me/GFIL_Trading",
|
||||
"discord": "https://discord.gg/GMmMCD4MCr",
|
||||
"terminal": "https://gold-node.xyz",
|
||||
"updated": "2026-06-12"
|
||||
}, f, indent=2, ensure_ascii=False)
|
||||
print(f" OK index.json")
|
||||
|
||||
print(f"\nDone. JSON files in {OUTPUT_DIR}/")
|
||||
print(f"Upload to: /var/www/blog/api/ on RackNerd")
|
||||
print(f"Then accessible at: {BLOG}/api/tools.json")
|
||||
|
||||
if __name__ == "__main__":
|
||||
generate()
|
||||
Reference in New Issue
Block a user