diff --git a/cryptoai/routes/crypto.py b/cryptoai/routes/crypto.py index 5235bbc..fcbe1f1 100644 --- a/cryptoai/routes/crypto.py +++ b/cryptoai/routes/crypto.py @@ -46,21 +46,21 @@ async def get_crypto_kline(symbol: str, timeframe: Optional[str] = None, limit: binance_api = get_binance_api() result = {} - data_processor = DataProcessor() 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["1h"] = data_processor.add_technical_indicators(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["15m"] = binance_api.get_historical_klines(symbol=symbol, interval="15m", 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"] = 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: - 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 @router.get("/news") 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) data = response.json() @@ -73,7 +73,9 @@ async def get_crypto_news(session: Session = Depends(get_db)): result.append({ "title": item["title"], "content": item["content"], - "add_time": add_time + "timestamp": timestamp, + "add_time": add_time, + "url" : item["url"] }) return result \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 7455f4d..6b06450 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,7 +29,7 @@ services: cryptoai-api: build: . container_name: cryptoai-api - image: cryptoai-api:0.2.20 + image: cryptoai-api:0.2.21 restart: always ports: - "8000:8000"