Loading...
Loading...
Compare original and translation side by side
pip install requests pandas yfinancepip install python-dotenv # For API key management{baseDir}/config/settings.yamlCOINGECKO_API_KEYpip install requests pandas yfinancepip install python-dotenv # 用于API密钥管理{baseDir}/config/settings.yamlCOINGECKO_API_KEYpython {baseDir}/scripts/price_tracker.py --symbol BTCpython {baseDir}/scripts/price_tracker.py --symbols BTC,ETH,SOLpython {baseDir}/scripts/price_tracker.py --symbol BTCpython {baseDir}/scripts/price_tracker.py --symbols BTC,ETH,SOLundefinedundefined
Available watchlists: `top10`, `defi`, `layer2`, `stablecoins`, `memecoins`
可用关注列表:`top10`、`defi`、`layer2`、`stablecoins`、`memecoins`undefinedundefinedundefinedundefined{baseDir}/config/settings.yamlcache:
spot_ttl: 30 # Seconds to cache spot prices
historical_ttl: 3600 # Seconds to cache historical data
currency:
default: usd # Default fiat currency
watchlists:
custom: # Add your own watchlist
- BTC
- ETH
- SOL{baseDir}/config/settings.yamlcache:
spot_ttl: 30 # 现货价格缓存有效期(秒)
historical_ttl: 3600 # 历史数据缓存有效期(秒)
currency:
default: usd # 默认法币
watchlists:
custom: # 添加自定义关注列表
- BTC
- ETH
- SOL================================================================================
CRYPTO PRICES Updated: [timestamp]
================================================================================
Symbol Price (USD) 24h Change Volume (24h) Market Cap
--------------------------------------------------------------------------------
BTC $97,234.56 +2.34% $28.5B $1.92T
ETH $3,456.78 +1.87% $12.3B $415.2B
SOL $142.34 +5.12% $2.1B $61.4B
--------------------------------------------------------------------------------
Total 24h Change: +2.44% (weighted)
================================================================================================================================================================
CRYPTO PRICES Updated: [timestamp]
================================================================================
Symbol Price (USD) 24h Change Volume (24h) Market Cap
--------------------------------------------------------------------------------
BTC $97,234.56 +2.34% $28.5B $1.92T
ETH $3,456.78 +1.87% $12.3B $415.2B
SOL $142.34 +5.12% $2.1B $61.4B
--------------------------------------------------------------------------------
Total 24h Change: +2.44% (weighted)
================================================================================{
"prices": [
{
"symbol": "BTC",
"name": "Bitcoin",
"price": 97234.56,
"currency": "USD",
"change_24h": 2.34,
"volume_24h": 28500000000,
"market_cap": 1920000000000,
"timestamp": "[timestamp]",
"source": "coingecko"
}
],
"meta": {
"count": 1,
"currency": "USD",
"cached": false
}
}{
"prices": [
{
"symbol": "BTC",
"name": "Bitcoin",
"price": 97234.56,
"currency": "USD",
"change_24h": 2.34,
"volume_24h": 28500000000,
"market_cap": 1920000000000,
"timestamp": "[timestamp]",
"source": "coingecko"
}
],
"meta": {
"count": 1,
"currency": "USD",
"cached": false
}
}date,open,high,low,close,volume
[date],95000.00,96500.00,94200.00,96100.00,25000000000
[date],96100.00,97800.00,95800.00,97500.00,27000000000date,open,high,low,close,volume
[date],95000.00,96500.00,94200.00,96100.00,25000000000
[date],96100.00,97800.00,95800.00,97500.00,27000000000{baseDir}/config/settings.yamlundefined{baseDir}/config/settings.yamlundefinedundefinedundefined{baseDir}/references/errors.md{baseDir}/references/errors.md| Error | Cause | Solution |
|---|---|---|
| Invalid cryptocurrency ticker | Check spelling, use |
| Too many API calls | Wait 60s, or use API key for higher limits |
| No internet connection | Check connection, cached data will be used |
| Cached data older than TTL | Data still shown with warning, will refresh |
| 错误信息 | 原因 | 解决方案 |
|---|---|---|
| 加密货币代码无效 | 检查拼写,使用 |
| API调用次数超限 | 等待60秒,或使用API密钥提升限额 |
| 无网络连接 | 检查网络,将使用缓存数据 |
| 缓存数据超出有效期 | 仍会显示数据并附带提醒,将自动刷新 |
{baseDir}/references/examples.md{baseDir}/references/examples.mdpython {baseDir}/scripts/price_tracker.py --symbol BTCBTC (Bitcoin)
$97,234.56 USD
+2.34% (24h) | Vol: $28.5B | MCap: $1.92Tpython {baseDir}/scripts/price_tracker.py --symbol BTCBTC (Bitcoin)
$97,234.56 USD
+2.34% (24h) | Vol: $28.5B | MCap: $1.92Tpython {baseDir}/scripts/price_tracker.py --watchlist top10python {baseDir}/scripts/price_tracker.py --watchlist top10python {baseDir}/scripts/price_tracker.py --symbol ETH --period 90d --output csv{baseDir}/data/ETH_90d_[date].csvpython {baseDir}/scripts/price_tracker.py --symbol ETH --period 90d --output csv{baseDir}/data/ETH_90d_[date].csvfrom price_tracker import get_current_prices, get_historical_pricesfrom price_tracker import get_current_prices, get_historical_prices
**CLI Subprocess** (for non-Python or isolation):
```bash
PRICES=$(python {baseDir}/scripts/price_tracker.py --symbols BTC,ETH --format json){baseDir}/data/cache.json
**CLI子进程调用**(适用于非Python技能或隔离场景):
```bash
PRICES=$(python {baseDir}/scripts/price_tracker.py --symbols BTC,ETH --format json){baseDir}/data/cache.json| File | Purpose |
|---|---|
| Main CLI entry point |
| CoinGecko/yfinance abstraction |
| Cache read/write/invalidation |
| Output formatting |
| User configuration |
| Price cache (auto-generated) |
| 文件 | 用途 |
|---|---|
| 主CLI入口 |
| CoinGecko/yfinance抽象层 |
| 缓存读写与失效管理 |
| 输出格式处理 |
| 用户配置文件 |
| 价格缓存文件(自动生成) |