update
This commit is contained in:
parent
d8cafea86b
commit
38d2205908
Binary file not shown.
@ -54,4 +54,27 @@ async def get_crypto_kline(symbol: str, timeframe: Optional[str] = None, limit:
|
||||
else:
|
||||
result[timeframe] = binance_api.get_historical_klines(symbol=symbol, interval=timeframe, limit=limit).to_dict(orient="records")
|
||||
|
||||
return result
|
||||
|
||||
@router.get("/news")
|
||||
async def get_crypto_news(session: Session = Depends(get_db)):
|
||||
|
||||
url = 'https://api.blockbeats.cn/h5v1/newsflash/list?page=1&limit=0&ios=1&end_time=&detective=-2'
|
||||
|
||||
response = requests.get(url)
|
||||
data = response.json()
|
||||
|
||||
result = []
|
||||
|
||||
for item in data["data"]["list"]:
|
||||
timestamp = item["add_time"]
|
||||
add_time = datetime.fromtimestamp(timestamp).strftime("%Y-%m-%d %H:%M:%S")
|
||||
result.append({
|
||||
"title": item["title"],
|
||||
"content": item["content"],
|
||||
"timestamp": timestamp,
|
||||
"add_time": add_time,
|
||||
"url" : item["url"]
|
||||
})
|
||||
|
||||
return result
|
||||
@ -29,7 +29,7 @@ services:
|
||||
cryptoai-api:
|
||||
build: .
|
||||
container_name: cryptoai-api
|
||||
image: cryptoai-api:0.2.15
|
||||
image: cryptoai-api:0.2.16
|
||||
restart: always
|
||||
ports:
|
||||
- "8000:8000"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user