feat(hub): enrich AI coach with fund history, closed trades, and chat uploads
- Add 15-day fund snapshot store and /api/hub/account on all instances - Summary includes yesterday/today trades, fund columns, and section 5 操作建议 - Chat context distinguishes empty positions from local monitors - Support image/document attachments in AI chat Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -8127,6 +8127,19 @@ def _hub_meta_bundle():
|
||||
}
|
||||
|
||||
|
||||
def _hub_account_bundle():
|
||||
funding_capital, trading_capital = get_exchange_capitals(force=True)
|
||||
funding_usdt = round(funding_capital, 2) if funding_capital is not None else None
|
||||
trading_usdt = round(trading_capital, 2) if trading_capital is not None else None
|
||||
available = get_available_trading_usdt()
|
||||
return {
|
||||
"funding_usdt": funding_usdt,
|
||||
"trading_usdt": trading_usdt,
|
||||
"available_trading_usdt": round(available, 2) if available is not None else None,
|
||||
"trading_day": get_trading_day(app_now()),
|
||||
}
|
||||
|
||||
|
||||
def _hub_fetch_ohlcv(symbol, timeframe, since_ms=None, limit=500):
|
||||
from hub_ohlcv_lib import fetch_ohlcv_for_hub
|
||||
|
||||
@@ -8160,6 +8173,7 @@ try:
|
||||
get_db=get_db,
|
||||
row_to_dict=row_to_dict,
|
||||
meta_fn=_hub_meta_bundle,
|
||||
account_fn=_hub_account_bundle,
|
||||
views={
|
||||
"add_order": add_order,
|
||||
"add_key": add_key,
|
||||
|
||||
Reference in New Issue
Block a user