update
This commit is contained in:
parent
d6df3dd865
commit
27f8001874
@ -32,12 +32,13 @@ 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, limit: Optional[int] = 200):
|
async def get_crypto_kline(symbol: str, timeframe: Optional[str] = None, limit: Optional[int] = 100):
|
||||||
|
# 检查symbol是否存在
|
||||||
if symbol.endswith("USDT"):
|
tokens = get_db_manager().search_token(symbol)
|
||||||
symbol = symbol
|
if not tokens or len(tokens) == 0:
|
||||||
else:
|
raise HTTPException(status_code=400, detail="您输入的币种在币安不存在,请检查后重新输入。")
|
||||||
symbol = symbol + "USDT"
|
|
||||||
|
symbol = tokens[0]["symbol"]
|
||||||
|
|
||||||
binance_api = get_binance_api()
|
binance_api = get_binance_api()
|
||||||
result = {}
|
result = {}
|
||||||
@ -54,11 +55,12 @@ async def get_crypto_kline(symbol: str, timeframe: Optional[str] = None, limit:
|
|||||||
@router.post("/analysis_v2")
|
@router.post("/analysis_v2")
|
||||||
async def analysis_crypto_v2(request: CryptoAnalysisRequest,
|
async def analysis_crypto_v2(request: CryptoAnalysisRequest,
|
||||||
current_user: dict = Depends(get_current_user)):
|
current_user: dict = Depends(get_current_user)):
|
||||||
|
# 检查symbol是否存在
|
||||||
if request.symbol.endswith("USDT"):
|
tokens = get_db_manager().search_token(request.symbol)
|
||||||
symbol = request.symbol
|
if not tokens or len(tokens) == 0:
|
||||||
else:
|
raise HTTPException(status_code=400, detail="您输入的币种在币安不存在,请检查后重新输入。")
|
||||||
symbol = request.symbol + "USDT"
|
|
||||||
|
symbol = tokens[0]["symbol"]
|
||||||
|
|
||||||
url = 'https://mate.aimateplus.com/v1/workflows/run'
|
url = 'https://mate.aimateplus.com/v1/workflows/run'
|
||||||
token = 'app-BbaqIAMPi0ktgaV9IizMlc2N'
|
token = 'app-BbaqIAMPi0ktgaV9IizMlc2N'
|
||||||
|
|||||||
@ -1784,7 +1784,7 @@ class DBManager:
|
|||||||
session = self.Session()
|
session = self.Session()
|
||||||
|
|
||||||
# 使用 SQLAlchemy 的 ORM 查询
|
# 使用 SQLAlchemy 的 ORM 查询
|
||||||
tokens = session.query(Token).filter(Token.symbol.like(f"{key}%")).limit(limit).all()
|
tokens = session.query(Token).filter(Token.symbol.like(f"{key}%") | Token.base_asset.like(f"{key}%")).limit(limit).all()
|
||||||
|
|
||||||
return [{
|
return [{
|
||||||
'symbol': token.symbol,
|
'symbol': token.symbol,
|
||||||
|
|||||||
@ -29,7 +29,7 @@ services:
|
|||||||
cryptoai-api:
|
cryptoai-api:
|
||||||
build: .
|
build: .
|
||||||
container_name: cryptoai-api
|
container_name: cryptoai-api
|
||||||
image: cryptoai-api:0.1.8
|
image: cryptoai-api:0.1.9
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user