update
This commit is contained in:
parent
fd409f6825
commit
702e044dd7
@ -874,6 +874,7 @@ class CryptoAgent:
|
|||||||
'initial_balance': self.hyperliquid.initial_balance,
|
'initial_balance': self.hyperliquid.initial_balance,
|
||||||
'used_margin': hl_state["total_margin_used"],
|
'used_margin': hl_state["total_margin_used"],
|
||||||
'available_balance': hl_state["available_balance"],
|
'available_balance': hl_state["available_balance"],
|
||||||
|
'available': hl_state["available_balance"], # 决策器期望的键名
|
||||||
'total_position_value': sum(abs(float(p.get("position", {}).get("szi", 0)) *
|
'total_position_value': sum(abs(float(p.get("position", {}).get("szi", 0)) *
|
||||||
float(p.get("position", {}).get("entryPx", 0)))
|
float(p.get("position", {}).get("entryPx", 0)))
|
||||||
for p in hl_state["positions"]),
|
for p in hl_state["positions"]),
|
||||||
@ -2001,6 +2002,7 @@ class CryptoAgent:
|
|||||||
'initial_balance': self.bitget.initial_balance,
|
'initial_balance': self.bitget.initial_balance,
|
||||||
'used_margin': bg_state["total_margin_used"],
|
'used_margin': bg_state["total_margin_used"],
|
||||||
'available_balance': bg_state["available_balance"],
|
'available_balance': bg_state["available_balance"],
|
||||||
|
'available': bg_state["available_balance"], # 决策器期望的键名
|
||||||
'total_position_value': total_position_value,
|
'total_position_value': total_position_value,
|
||||||
'max_total_leverage': self.bitget.max_total_leverage,
|
'max_total_leverage': self.bitget.max_total_leverage,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -538,14 +538,14 @@ async def lifespan(app: FastAPI):
|
|||||||
logger.info("股票智能体未启动(未配置股票代码)")
|
logger.info("股票智能体未启动(未配置股票代码)")
|
||||||
|
|
||||||
# 启动新闻智能体
|
# 启动新闻智能体
|
||||||
try:
|
# try:
|
||||||
from app.news_agent.news_agent import get_news_agent
|
# from app.news_agent.news_agent import get_news_agent
|
||||||
news_agent = get_news_agent()
|
# news_agent = get_news_agent()
|
||||||
_news_agent_task = asyncio.create_task(news_agent.start())
|
# _news_agent_task = asyncio.create_task(news_agent.start())
|
||||||
logger.info("新闻智能体已启动")
|
# logger.info("新闻智能体已启动")
|
||||||
except Exception as e:
|
# except Exception as e:
|
||||||
logger.error(f"新闻智能体启动失败: {e}")
|
# logger.error(f"新闻智能体启动失败: {e}")
|
||||||
logger.error(f"提示: 请确保已安装 feedparser 和 beautifulsoup4 (pip install feedparser beautifulsoup4)")
|
# logger.error(f"提示: 请确保已安装 feedparser 和 beautifulsoup4 (pip install feedparser beautifulsoup4)")
|
||||||
|
|
||||||
# 启动A股智能体
|
# 启动A股智能体
|
||||||
if getattr(settings, 'astock_monitor_enabled', True):
|
if getattr(settings, 'astock_monitor_enabled', True):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user