update
This commit is contained in:
parent
347b126977
commit
82d760d25d
Binary file not shown.
@ -84,7 +84,7 @@ class BinanceAPI:
|
|||||||
print(f"获取交易对大户持仓多空比时出错: {e}")
|
print(f"获取交易对大户持仓多空比时出错: {e}")
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def get_historical_klines(self, symbol: str, interval: str, start_str: str, end_str: Optional[str] = None) -> pd.DataFrame:
|
def get_historical_klines(self, symbol: str, interval: str, start_str: str, end_str: Optional[str] = None, limit: Optional[int] = None) -> pd.DataFrame:
|
||||||
"""
|
"""
|
||||||
获取历史K线数据
|
获取历史K线数据
|
||||||
|
|
||||||
@ -102,7 +102,8 @@ class BinanceAPI:
|
|||||||
symbol=symbol,
|
symbol=symbol,
|
||||||
interval=interval,
|
interval=interval,
|
||||||
start_str=start_str,
|
start_str=start_str,
|
||||||
end_str=end_str
|
end_str=end_str,
|
||||||
|
limit=limit
|
||||||
)
|
)
|
||||||
|
|
||||||
# 转换为DataFrame
|
# 转换为DataFrame
|
||||||
|
|||||||
@ -32,7 +32,7 @@ class CryptoAnalysisRequest(BaseModel):
|
|||||||
timeframe: Optional[str] = None
|
timeframe: Optional[str] = None
|
||||||
|
|
||||||
@router.get("/kline/{symbol}")
|
@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):
|
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):
|
||||||
|
|
||||||
binance_api = get_binance_api()
|
binance_api = get_binance_api()
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ async def get_crypto_kline(symbol: str, timeframe: Optional[str] = None, start_t
|
|||||||
|
|
||||||
print(f"symbol: {symbol}, timeframe: {timeframe}, start_time: {start_time}, end_time: {end_time}")
|
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)
|
kline = binance_api.get_historical_klines(symbol, timeframe, start_time, end_time, limit=limit)
|
||||||
|
|
||||||
data_processor = DataProcessor()
|
data_processor = DataProcessor()
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ services:
|
|||||||
cryptoai-api:
|
cryptoai-api:
|
||||||
build: .
|
build: .
|
||||||
container_name: cryptoai-api
|
container_name: cryptoai-api
|
||||||
image: cryptoai-api:0.0.24
|
image: cryptoai-api:0.0.25
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user