update
This commit is contained in:
parent
efaa43722c
commit
74fa117ad2
@ -46,21 +46,21 @@ async def get_crypto_kline(symbol: str, timeframe: Optional[str] = None, limit:
|
|||||||
binance_api = get_binance_api()
|
binance_api = get_binance_api()
|
||||||
result = {}
|
result = {}
|
||||||
|
|
||||||
data_processor = DataProcessor()
|
|
||||||
|
|
||||||
if timeframe is None:
|
if timeframe is None:
|
||||||
result["15m"] = data_processor.add_technical_indicators(binance_api.get_historical_klines(symbol=symbol, interval="15m", limit=limit)).to_dict(orient="records")
|
result["15m"] = binance_api.get_historical_klines(symbol=symbol, interval="15m", limit=limit).to_dict(orient="records")
|
||||||
result["1h"] = data_processor.add_technical_indicators(binance_api.get_historical_klines(symbol=symbol, interval="1h", limit=limit)).to_dict(orient="records")
|
result["1h"] = binance_api.get_historical_klines(symbol=symbol, interval="1h", limit=limit).to_dict(orient="records")
|
||||||
result["4h"] = data_processor.add_technical_indicators(binance_api.get_historical_klines(symbol=symbol, interval="4h", limit=limit)).to_dict(orient="records")
|
result["4h"] = binance_api.get_historical_klines(symbol=symbol, interval="4h", limit=limit).to_dict(orient="records")
|
||||||
|
# result["1d"] = binance_api.get_historical_klines(symbol=symbol, interval="1d", limit=limit).to_dict(orient="records")
|
||||||
else:
|
else:
|
||||||
result[timeframe] = data_processor.add_technical_indicators(binance_api.get_historical_klines(symbol=symbol, interval=timeframe, limit=limit)).to_dict(orient="records")
|
result[timeframe] = binance_api.get_historical_klines(symbol=symbol, interval=timeframe, limit=limit).to_dict(orient="records")
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@router.get("/news")
|
@router.get("/news")
|
||||||
async def get_crypto_news(session: Session = Depends(get_db)):
|
async def get_crypto_news(session: Session = Depends(get_db)):
|
||||||
|
|
||||||
url = 'https://api.blockbeats.cn/h5v1/newsflash/list?page=1&limit=15&ios=1&end_time=&detective=-2'
|
url = 'https://api.blockbeats.cn/h5v1/newsflash/list?page=1&limit=0&ios=1&end_time=&detective=-2'
|
||||||
|
|
||||||
response = requests.get(url)
|
response = requests.get(url)
|
||||||
data = response.json()
|
data = response.json()
|
||||||
@ -73,7 +73,9 @@ async def get_crypto_news(session: Session = Depends(get_db)):
|
|||||||
result.append({
|
result.append({
|
||||||
"title": item["title"],
|
"title": item["title"],
|
||||||
"content": item["content"],
|
"content": item["content"],
|
||||||
"add_time": add_time
|
"timestamp": timestamp,
|
||||||
|
"add_time": add_time,
|
||||||
|
"url" : item["url"]
|
||||||
})
|
})
|
||||||
|
|
||||||
return result
|
return result
|
||||||
@ -29,7 +29,7 @@ services:
|
|||||||
cryptoai-api:
|
cryptoai-api:
|
||||||
build: .
|
build: .
|
||||||
container_name: cryptoai-api
|
container_name: cryptoai-api
|
||||||
image: cryptoai-api:0.2.20
|
image: cryptoai-api:0.2.21
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user