diff --git a/frontend/trading.html b/frontend/trading.html
index 274c3f1..7012cee 100644
--- a/frontend/trading.html
+++ b/frontend/trading.html
@@ -391,7 +391,12 @@
暂无历史订单
-
+
+
+
+
@@ -437,7 +442,7 @@
-
+
@@ -475,7 +480,7 @@
-
+
@@ -686,7 +691,8 @@
await Promise.all([
this.fetchAccountStatus(),
this.fetchStatistics(),
- this.fetchOrders()
+ this.fetchOrders(),
+ this.fetchLatestPrices()
]);
} catch (e) {
console.error('刷新数据失败:', e);
@@ -700,13 +706,25 @@
await Promise.all([
this.fetchAccountStatus(),
this.fetchStatistics(),
- this.fetchOrders()
+ this.fetchOrders(),
+ this.fetchLatestPrices()
]);
} catch (e) {
console.error('静默刷新失败:', e);
}
},
+ async fetchLatestPrices() {
+ try {
+ const response = await axios.get('/monitor/status');
+ if (response.data.success && response.data.latest_prices) {
+ this.latestPrices = response.data.latest_prices;
+ }
+ } catch (error) {
+ console.error('获取实时价格失败:', error);
+ }
+ },
+
async fetchAccountStatus() {
try {
const response = await axios.get('/api/trading/account');
@@ -735,10 +753,6 @@
console.log('API Response:', response.data);
if (response.data.success) {
this.orders = response.data.orders || [];
- // 获取实时价格
- if (response.data.latest_prices) {
- this.latestPrices = response.data.latest_prices;
- }
console.log('Orders loaded:', this.orders.length);
console.log('Orders data:', this.orders);
console.log('Open positions:', this.orders.filter(o => o.status === 'open'));