Complete API Reference - All Available Services
راهنمای کامل API - تمام سرویسهای موجود
Base URL: http://localhost:7860
📋 Table of Contents
- Market Data & Prices
- OHLCV / Candlestick Data
- Technical Indicators
- Sentiment Analysis
- News & Headlines
- Blockchain & On-Chain Data
- Whale Tracking
- AI & Machine Learning
- HuggingFace Space Crypto API
- System & Monitoring
1. Market Data & Prices
1.1 Get Single Price
GET /api/market/price?symbol=BTC
Parameters:
symbol(required): Cryptocurrency symbol (BTC, ETH, etc.)
Example:
curl "http://localhost:7860/api/market/price?symbol=BTC"
Response:
{
"symbol": "BTC",
"price": 90241.00,
"source": "coingecko",
"timestamp": 1702406543
}
1.2 Get Multiple Prices (Multi-Source)
GET /api/multi-source/prices?symbols=BTC,ETH,BNB&limit=100
Parameters:
symbols(optional): Comma-separated symbolslimit(optional): Max results (1-250, default: 100)cross_check(optional): Validate across sources (default: true)
Example:
curl "http://localhost:7860/api/multi-source/prices?symbols=BTC,ETH&limit=10"
1.3 Get Top Coins
GET /api/service/top?limit=100
GET /api/hf-space/coins/top?limit=50
Parameters:
limit(optional): Number of coins (default: 100)
Example:
curl "http://localhost:7860/api/hf-space/coins/top?limit=10"
1.4 Get Trending Coins
GET /api/trending
GET /api/hf-space/trending
GET /coingecko/trending
Example:
curl "http://localhost:7860/api/hf-space/trending"
1.5 Get Market Overview
GET /api/market
GET /api/hf-space/market
GET /api/service/market-status
Example:
curl "http://localhost:7860/api/hf-space/market"
Response:
{
"total_market_cap": 3152683901788,
"total_volume": 148435101985,
"market_cap_percentage": {
"btc": 57.09,
"eth": 11.77
},
"active_cryptocurrencies": 19190
}
2. OHLCV / Candlestick Data
2.1 Get OHLCV Data
GET /api/market/ohlc?symbol=BTC&timeframe=1h
GET /api/multi-source/ohlc/{symbol}?timeframe=1h&limit=1000
GET /api/trading/ohlcv/{symbol}?interval=1h&limit=100
Parameters:
symbol(required): Cryptocurrency symboltimeframe/interval(optional): 1m, 5m, 15m, 30m, 1h, 4h, 1d, 1wlimit(optional): Number of candles (default: 100-1000)
Example:
# Get 100 hourly candles for BTC
curl "http://localhost:7860/api/multi-source/ohlc/BTC?timeframe=1h&limit=100"
# Get 4-hour candles for ETH
curl "http://localhost:7860/api/market/ohlc?symbol=ETH&timeframe=4h"
Response:
{
"symbol": "BTC",
"timeframe": "1h",
"data": [
{
"timestamp": 1702400000000,
"open": 90100.00,
"high": 90500.00,
"low": 89800.00,
"close": 90241.00,
"volume": 1234567890
}
],
"source": "binance"
}
2.2 Get Historical Data
GET /api/market/history?symbol=BTC&days=30
GET /api/service/history?symbol=BTC&timeframe=1h
Parameters:
symbol(required): Cryptocurrency symboldays(optional): Number of days (default: 30)timeframe(optional): 1h, 4h, 1d
3. Technical Indicators
3.1 RSI (Relative Strength Index)
GET /api/indicators/rsi?symbol=BTC&timeframe=1h&period=14
Parameters:
symbol(optional): Default "BTC"timeframe(optional): 1m, 5m, 15m, 1h, 4h, 1dperiod(optional): RSI period (default: 14)
Example:
curl "http://localhost:7860/api/indicators/rsi?symbol=BTC&timeframe=1h&period=14"
Response:
{
"success": true,
"symbol": "BTC",
"timeframe": "1h",
"indicator": "rsi",
"data": {
"value": 55.23
},
"signal": "neutral",
"description": "RSI at 55.23 - neutral zone"
}
3.2 MACD
GET /api/indicators/macd?symbol=BTC&timeframe=1h&fast=12&slow=26&signal_period=9
Parameters:
symbol,timeframefast(optional): Fast EMA period (default: 12)slow(optional): Slow EMA period (default: 26)signal_period(optional): Signal line period (default: 9)
Example:
curl "http://localhost:7860/api/indicators/macd?symbol=BTC&timeframe=1h"
Response:
{
"success": true,
"symbol": "BTC",
"indicator": "macd",
"data": {
"macd_line": 50.0,
"signal_line": 45.0,
"histogram": 5.0
},
"trend": "bullish",
"signal": "buy"
}
3.3 Bollinger Bands
GET /api/indicators/bollinger-bands?symbol=BTC&timeframe=1h&period=20&std_dev=2
Parameters:
symbol,timeframeperiod(optional): Period (default: 20)std_dev(optional): Standard deviation multiplier (default: 2.0)
Example:
curl "http://localhost:7860/api/indicators/bollinger-bands?symbol=BTC&timeframe=1h"
Response:
{
"success": true,
"symbol": "BTC",
"indicator": "bollinger_bands",
"data": {
"upper": 92500.00,
"middle": 90241.00,
"lower": 88000.00,
"bandwidth": 4.98,
"percent_b": 50.0
},
"signal": "neutral"
}
3.4 SMA (Simple Moving Average)
GET /api/indicators/sma?symbol=BTC&timeframe=1h
Response:
{
"success": true,
"data": {
"sma20": 89500.00,
"sma50": 87200.00,
"sma200": 75000.00
},
"trend": "bullish",
"signal": "buy"
}
3.5 EMA (Exponential Moving Average)
GET /api/indicators/ema?symbol=BTC&timeframe=1h
Response:
{
"success": true,
"data": {
"ema12": 90100.00,
"ema26": 89500.00,
"ema50": 87000.00
},
"trend": "bullish"
}
3.6 Stochastic RSI
GET /api/indicators/stoch-rsi?symbol=BTC&timeframe=1h&rsi_period=14&stoch_period=14
Response:
{
"success": true,
"data": {
"value": 65.5,
"k_line": 65.5,
"d_line": 60.2
},
"signal": "neutral"
}
3.7 ATR (Average True Range)
GET /api/indicators/atr?symbol=BTC&timeframe=1h&period=14
Response:
{
"success": true,
"data": {
"value": 1500.00,
"percent": 1.66
},
"volatility_level": "medium"
}
3.8 Comprehensive Analysis (ALL Indicators)
GET /api/indicators/comprehensive?symbol=BTC&timeframe=1h
Example:
curl "http://localhost:7860/api/indicators/comprehensive?symbol=BTC&timeframe=1h"
Response:
{
"success": true,
"symbol": "BTC",
"current_price": 90241.00,
"indicators": {
"bollinger_bands": {"upper": 92500, "middle": 90241, "lower": 88000},
"stoch_rsi": {"value": 55, "k_line": 55, "d_line": 52},
"atr": {"value": 1500, "percent": 1.66},
"sma": {"sma20": 89500, "sma50": 87200, "sma200": 75000},
"ema": {"ema12": 90100, "ema26": 89500},
"macd": {"macd_line": 50, "signal_line": 45, "histogram": 5},
"rsi": {"value": 55}
},
"signals": {
"bollinger_bands": "neutral",
"stoch_rsi": "neutral",
"sma": "bullish",
"ema": "bullish",
"macd": "bullish",
"rsi": "neutral"
},
"overall_signal": "BUY",
"confidence": 70,
"recommendation": "Majority bullish signals - favorable conditions for entry"
}
3.9 List All Indicator Services
GET /api/indicators/services
4. Sentiment Analysis
4.1 Fear & Greed Index
GET /api/hf-space/sentiment
GET /api/multi-source/sentiment
GET /api/sentiment/global
GET /alternative/fng
Example:
curl "http://localhost:7860/api/hf-space/sentiment"
Response:
{
"fear_greed_index": 29,
"sentiment": "fear",
"market_mood": "bearish",
"confidence": 0.85,
"source": "alternative.me"
}
4.2 Analyze Text Sentiment (AI)
POST /api/sentiment/analyze
POST /hf/sentiment
Body:
{
"text": "Bitcoin is going to the moon! Very bullish!"
}
Example:
curl -X POST "http://localhost:7860/api/sentiment/analyze" \
-H "Content-Type: application/json" \
-d '{"text": "Bitcoin is going to the moon!"}'
Response:
{
"text": "Bitcoin is going to the moon!",
"sentiment": "bullish",
"score": 0.92,
"confidence": 0.87,
"model": "CryptoBERT"
}
4.3 Bulk Sentiment Analysis
POST /hf/sentiment/batch
Body:
{
"texts": [
"BTC is going up!",
"ETH crash incoming",
"Market looks stable"
]
}
4.4 Asset-Specific Sentiment
GET /api/hf-space/sentiment/{symbol}
GET /api/resources/sentiment/coin/{symbol}
Example:
curl "http://localhost:7860/api/hf-space/sentiment/BTC"
5. News & Headlines
5.1 Get Latest News
GET /api/multi-source/news?query=cryptocurrency&limit=50
GET /api/news/latest
GET /api/hf-space/resources/category/news_apis
Parameters:
query(optional): Search query (default: "cryptocurrency")limit(optional): Max articles (default: 50)aggregate(optional): Combine from multiple sources (default: true)
Example:
curl "http://localhost:7860/api/multi-source/news?query=bitcoin&limit=20"
Response:
{
"articles": [
{
"title": "Bitcoin Reaches New High",
"description": "...",
"url": "https://...",
"source": "CoinDesk",
"publishedAt": "2025-12-12T10:00:00Z"
}
],
"total": 20,
"sources_used": ["coindesk", "cointelegraph", "cryptopanic"]
}
5.2 Get Headlines
GET /api/news/headlines
5.3 RSS Feeds
GET /rss/all
GET /rss/feed?url=https://cointelegraph.com/rss
GET /coindesk/rss
GET /cointelegraph/rss
Example:
curl "http://localhost:7860/rss/all"
6. Blockchain & On-Chain Data
6.1 Gas Prices
GET /api/blockchain/gas
GET /api/resources/onchain/gas
GET /api/crypto/blockchain/gas
Example:
curl "http://localhost:7860/api/blockchain/gas"
Response:
{
"chain": "ethereum",
"gas": {
"slow": 20,
"standard": 25,
"fast": 35,
"instant": 50
},
"unit": "gwei"
}
6.2 Blockchain Stats
GET /api/blockchain/{chain}
GET /api/blockchain/stats
Parameters:
chain: ethereum, bsc, tron
Example:
curl "http://localhost:7860/api/blockchain/ethereum"
6.3 Transaction Data
GET /api/blockchain/transactions?address={address}
GET /api/resources/onchain/transactions?address={address}&chain=ethereum
6.4 Address Balance
GET /api/resources/onchain/balance?address={address}&chain=ethereum
7. Whale Tracking
7.1 Whale Transactions
GET /api/whales/transactions
GET /api/service/whales
Example:
curl "http://localhost:7860/api/service/whales"
Response:
{
"transactions": [
{
"hash": "0x...",
"from": "0x...",
"to": "0x...",
"value": "1000 BTC",
"timestamp": "2025-12-12T10:00:00Z"
}
],
"total": 10
}
7.2 Whale Stats
GET /api/whales/stats
8. AI & Machine Learning
8.1 Available AI Models
GET /api/models/list
GET /hf/models
GET /api/models/available
Example:
curl "http://localhost:7860/api/models/list"
8.2 Load AI Model
POST /hf/models/load
Body:
{
"model_key": "cryptobert"
}
8.3 AI Price Prediction
GET /api/ai/predict/{symbol}
POST /api/ai/predict
8.4 Trading Signal
POST /api/trading/signal
Body:
{
"symbol": "BTC",
"timeframe": "1h"
}
8.5 HuggingFace Datasets
GET /hf/datasets
GET /api/resources/hf/ohlcv?symbol=BTC&timeframe=1h
GET /api/resources/hf/symbols
Example:
curl "http://localhost:7860/api/resources/hf/symbols"
9. HuggingFace Space Crypto API
External API providing market data and 281 curated resources.
9.1 Market Data
GET /api/hf-space/coins/top?limit=50
GET /api/hf-space/trending
GET /api/hf-space/market
9.2 Sentiment
GET /api/hf-space/sentiment
GET /api/hf-space/sentiment/{symbol}
9.3 Resources Database (281 resources)
GET /api/hf-space/resources/stats
GET /api/hf-space/resources/categories
GET /api/hf-space/resources/category/{category}
GET /api/hf-space/resources/all
Available Categories:
rpc_nodes(24)block_explorers(33)market_data_apis(33)news_apis(17)sentiment_apis(14)onchain_analytics_apis(14)whale_tracking_apis(10)hf_resources(9)free_http_endpoints(13)cors_proxies(7)
Example:
# Get all RPC nodes
curl "http://localhost:7860/api/hf-space/resources/category/rpc_nodes"
# Get all market data APIs
curl "http://localhost:7860/api/hf-space/resources/category/market_data_apis"
9.4 System Status
GET /api/hf-space/health
GET /api/hf-space/providers
GET /api/hf-space/status
10. System & Monitoring
10.1 Health Check
GET /health
GET /api/health
GET /api/multi-source/health
10.2 System Status
GET /api/status
GET /api/monitoring/status
10.3 Source Statistics
GET /api/multi-source/sources/status
GET /api/multi-source/monitoring/stats
GET /api/providers/stats
10.4 Background Worker
GET /api/worker/status
GET /api/worker/stats
POST /api/worker/start
POST /api/worker/stop
Quick Reference Table
| Service | Endpoint | Method |
|---|---|---|
| Prices | /api/market/price?symbol=BTC |
GET |
| Multi-Source Prices | /api/multi-source/prices |
GET |
| Top Coins | /api/hf-space/coins/top |
GET |
| Trending | /api/hf-space/trending |
GET |
| Market Overview | /api/hf-space/market |
GET |
| OHLCV | /api/multi-source/ohlc/{symbol} |
GET |
| RSI | /api/indicators/rsi?symbol=BTC |
GET |
| MACD | /api/indicators/macd?symbol=BTC |
GET |
| Bollinger Bands | /api/indicators/bollinger-bands |
GET |
| SMA | /api/indicators/sma?symbol=BTC |
GET |
| EMA | /api/indicators/ema?symbol=BTC |
GET |
| All Indicators | /api/indicators/comprehensive |
GET |
| Fear & Greed | /api/hf-space/sentiment |
GET |
| Sentiment Analysis | /api/sentiment/analyze |
POST |
| News | /api/multi-source/news |
GET |
| Gas Prices | /api/blockchain/gas |
GET |
| Whales | /api/service/whales |
GET |
| AI Models | /api/models/list |
GET |
| Resources DB | /api/hf-space/resources/stats |
GET |
| Health | /health |
GET |
Python Usage Examples
import requests
BASE_URL = "http://localhost:7860"
# Get BTC price
price = requests.get(f"{BASE_URL}/api/market/price?symbol=BTC").json()
print(f"BTC: ${price['price']:,.2f}")
# Get RSI
rsi = requests.get(f"{BASE_URL}/api/indicators/rsi?symbol=BTC&timeframe=1h").json()
print(f"RSI: {rsi['data']['value']}")
# Get comprehensive analysis
analysis = requests.get(f"{BASE_URL}/api/indicators/comprehensive?symbol=BTC").json()
print(f"Signal: {analysis['overall_signal']}")
# Get Fear & Greed
sentiment = requests.get(f"{BASE_URL}/api/hf-space/sentiment").json()
print(f"Fear & Greed: {sentiment['fear_greed_index']}")
# Analyze text sentiment
response = requests.post(
f"{BASE_URL}/api/sentiment/analyze",
json={"text": "Bitcoin is going to the moon!"}
)
print(f"Sentiment: {response.json()['sentiment']}")
# Get OHLCV candles
ohlcv = requests.get(f"{BASE_URL}/api/multi-source/ohlc/BTC?timeframe=1h&limit=100").json()
print(f"Candles: {len(ohlcv.get('data', []))}")
# Get news
news = requests.get(f"{BASE_URL}/api/multi-source/news?query=bitcoin&limit=10").json()
print(f"Articles: {len(news.get('articles', []))}")
Last updated: 2025-12-12