update
This commit is contained in:
parent
82d760d25d
commit
a5b25d6482
Binary file not shown.
@ -84,7 +84,7 @@ class BinanceAPI:
|
||||
print(f"获取交易对大户持仓多空比时出错: {e}")
|
||||
return 0
|
||||
|
||||
def get_historical_klines(self, symbol: str, interval: str, start_str: str, end_str: Optional[str] = None, limit: Optional[int] = None) -> pd.DataFrame:
|
||||
def get_historical_klines(self, symbol: str, interval: str, start_str: Optional[str] = None, end_str: Optional[str] = None, limit: Optional[int] = None) -> pd.DataFrame:
|
||||
"""
|
||||
获取历史K线数据
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ from cryptoai.routes.user import get_current_user
|
||||
import requests
|
||||
from cryptoai.api.binance_api import get_binance_api
|
||||
from cryptoai.models.data_processor import DataProcessor
|
||||
|
||||
from datetime import timedelta
|
||||
# 创建路由
|
||||
router = APIRouter()
|
||||
|
||||
@ -32,20 +32,11 @@ class CryptoAnalysisRequest(BaseModel):
|
||||
timeframe: Optional[str] = None
|
||||
|
||||
@router.get("/kline/{symbol}")
|
||||
async def get_crypto_kline(symbol: str, timeframe: Optional[str] = None, start_time: Optional[str] = None, end_time: Optional[str] = None, limit: Optional[int] = 200):
|
||||
async def get_crypto_kline(symbol: str, timeframe: Optional[str] = None, limit: Optional[int] = 200):
|
||||
|
||||
binance_api = get_binance_api()
|
||||
|
||||
if not start_time:
|
||||
# 今年1月 1 日
|
||||
start_time = datetime.now().strftime("%Y-01-01 00:00:00")
|
||||
if not end_time:
|
||||
# 今天
|
||||
end_time = datetime.now().strftime("%Y-%m-%d 23:59:59")
|
||||
|
||||
print(f"symbol: {symbol}, timeframe: {timeframe}, start_time: {start_time}, end_time: {end_time}")
|
||||
|
||||
kline = binance_api.get_historical_klines(symbol, timeframe, start_time, end_time, limit=limit)
|
||||
kline = binance_api.get_historical_klines(symbol=symbol, interval=timeframe, limit=limit)
|
||||
|
||||
data_processor = DataProcessor()
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ services:
|
||||
cryptoai-api:
|
||||
build: .
|
||||
container_name: cryptoai-api
|
||||
image: cryptoai-api:0.0.25
|
||||
image: cryptoai-api:0.0.26
|
||||
restart: always
|
||||
ports:
|
||||
- "8000:8000"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user