Localize agent labels and harden frontend connection status
This commit is contained in:
10
.gitignore
vendored
10
.gitignore
vendored
@@ -44,9 +44,19 @@ ENV/
|
|||||||
|
|
||||||
# Frontend
|
# Frontend
|
||||||
node_modules
|
node_modules
|
||||||
|
/package.json
|
||||||
|
/package-lock.json
|
||||||
|
|
||||||
# Outputs
|
# Outputs
|
||||||
outputs/
|
outputs/
|
||||||
|
/production/
|
||||||
|
/smoke_test/
|
||||||
|
/smoke_live_mock/
|
||||||
|
|
||||||
|
# Local tooling state
|
||||||
|
/.omc/
|
||||||
|
/.pydeps/
|
||||||
|
/referance/
|
||||||
|
|
||||||
# Data files
|
# Data files
|
||||||
backend/data/ret_data/
|
backend/data/ret_data/
|
||||||
|
|||||||
@@ -5,38 +5,38 @@
|
|||||||
# Agent configuration for dashboard display
|
# Agent configuration for dashboard display
|
||||||
AGENT_CONFIG = {
|
AGENT_CONFIG = {
|
||||||
"portfolio_manager": {
|
"portfolio_manager": {
|
||||||
"name": "Portfolio Manager",
|
"name": "投资经理",
|
||||||
"role": "Portfolio Manager",
|
"role": "投资经理",
|
||||||
"avatar": "pm",
|
"avatar": "pm",
|
||||||
"is_team_role": True,
|
"is_team_role": True,
|
||||||
},
|
},
|
||||||
"risk_manager": {
|
"risk_manager": {
|
||||||
"name": "Risk Manager",
|
"name": "风控经理",
|
||||||
"role": "Risk Manager",
|
"role": "风控经理",
|
||||||
"avatar": "risk",
|
"avatar": "risk",
|
||||||
"is_team_role": True,
|
"is_team_role": True,
|
||||||
},
|
},
|
||||||
"sentiment_analyst": {
|
"sentiment_analyst": {
|
||||||
"name": "Sentiment Analyst",
|
"name": "情绪分析师",
|
||||||
"role": "Sentiment Analyst",
|
"role": "情绪分析师",
|
||||||
"avatar": "sentiment",
|
"avatar": "sentiment",
|
||||||
"is_team_role": False,
|
"is_team_role": False,
|
||||||
},
|
},
|
||||||
"technical_analyst": {
|
"technical_analyst": {
|
||||||
"name": "Technical Analyst",
|
"name": "技术分析师",
|
||||||
"role": "Technical Analyst",
|
"role": "技术分析师",
|
||||||
"avatar": "technical",
|
"avatar": "technical",
|
||||||
"is_team_role": False,
|
"is_team_role": False,
|
||||||
},
|
},
|
||||||
"fundamentals_analyst": {
|
"fundamentals_analyst": {
|
||||||
"name": "Fundamentals Analyst",
|
"name": "基本面分析师",
|
||||||
"role": "Fundamentals Analyst",
|
"role": "基本面分析师",
|
||||||
"avatar": "fundamentals",
|
"avatar": "fundamentals",
|
||||||
"is_team_role": False,
|
"is_team_role": False,
|
||||||
},
|
},
|
||||||
"valuation_analyst": {
|
"valuation_analyst": {
|
||||||
"name": "Valuation Analyst",
|
"name": "估值分析师",
|
||||||
"role": "Valuation Analyst",
|
"role": "估值分析师",
|
||||||
"avatar": "valuation",
|
"avatar": "valuation",
|
||||||
"is_team_role": False,
|
"is_team_role": False,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ TICKERS=AAPL,MSFT,GOOGL,NVDA,TSLA,META,AMZN
|
|||||||
# financial datasets: https://www.financialdatasets.ai/
|
# financial datasets: https://www.financialdatasets.ai/
|
||||||
|
|
||||||
FIN_DATA_SOURCE = # Preferred source: finnhub / financial_datasets / yfinance / local_csv | 首选数据源
|
FIN_DATA_SOURCE = # Preferred source: finnhub / financial_datasets / yfinance / local_csv | 首选数据源
|
||||||
ENABLED_DATA_SOURCES = # Optional allowlist, comma-separated, e.g. yfinance,finnhub,financial_datasets,local_csv | 可启用数据源列表
|
ENABLED_DATA_SOURCES = # Optional allowlist, comma-separated, e.g. financial_datasets,finnhub,yfinance,local_csv | 可启用数据源列表
|
||||||
FINANCIAL_DATASETS_API_KEY= #required | 必填
|
FINANCIAL_DATASETS_API_KEY= #required | 必填
|
||||||
FINNHUB_API_KEY= #optional | 可选
|
FINNHUB_API_KEY= #optional | 可选
|
||||||
|
|
||||||
|
|||||||
@@ -217,6 +217,11 @@ export default function LiveTradingApp() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleEventInternal = (evt) => {
|
const handleEventInternal = (evt) => {
|
||||||
|
if (evt?.type && evt.type !== 'pong') {
|
||||||
|
setConnectionStatus('connected');
|
||||||
|
setIsConnected(true);
|
||||||
|
}
|
||||||
|
|
||||||
// Helper: Update tickers from realtime prices
|
// Helper: Update tickers from realtime prices
|
||||||
const updateTickersFromPrices = (realtimePrices) => {
|
const updateTickersFromPrices = (realtimePrices) => {
|
||||||
try {
|
try {
|
||||||
@@ -263,10 +268,16 @@ export default function LiveTradingApp() {
|
|||||||
// Connection events
|
// Connection events
|
||||||
system: (e) => {
|
system: (e) => {
|
||||||
console.log('[System]', e.content);
|
console.log('[System]', e.content);
|
||||||
if (e.content.includes('Connected')) {
|
if (
|
||||||
|
e.content.includes('Connected')
|
||||||
|
|| e.content.includes('已连接')
|
||||||
|
) {
|
||||||
setConnectionStatus('connected');
|
setConnectionStatus('connected');
|
||||||
setIsConnected(true);
|
setIsConnected(true);
|
||||||
} else if (e.content.includes('Disconnected')) {
|
} else if (
|
||||||
|
e.content.includes('Disconnected')
|
||||||
|
|| e.content.includes('断开')
|
||||||
|
) {
|
||||||
setConnectionStatus('disconnected');
|
setConnectionStatus('disconnected');
|
||||||
setIsConnected(false);
|
setIsConnected(false);
|
||||||
}
|
}
|
||||||
@@ -284,6 +295,8 @@ export default function LiveTradingApp() {
|
|||||||
const state = e.state;
|
const state = e.state;
|
||||||
if (!state) return;
|
if (!state) return;
|
||||||
|
|
||||||
|
setConnectionStatus('connected');
|
||||||
|
setIsConnected(true);
|
||||||
setSystemStatus(state.status || 'initializing');
|
setSystemStatus(state.status || 'initializing');
|
||||||
setCurrentDate(state.current_date);
|
setCurrentDate(state.current_date);
|
||||||
|
|
||||||
@@ -385,6 +398,8 @@ export default function LiveTradingApp() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setConnectionStatus('connected');
|
||||||
|
setIsConnected(true);
|
||||||
console.log(`[Price Update] ${symbol}: $${price} (ret: ${ret !== undefined ? ret.toFixed(2) : 'N/A'}%)`);
|
console.log(`[Price Update] ${symbol}: $${price} (ret: ${ret !== undefined ? ret.toFixed(2) : 'N/A'}%)`);
|
||||||
|
|
||||||
// Update ticker price with animation
|
// Update ticker price with animation
|
||||||
|
|||||||
Reference in New Issue
Block a user