|
|
@@ -555,27 +555,29 @@
|
|
|
console.log(' 准备添加', tradingEventsData.length, '个事件标记到价格图表');
|
|
|
tradingEventsData.forEach(event => {
|
|
|
const timestamp = event.timestamp * 1000;
|
|
|
- const side = event.side;
|
|
|
const eventType = event.event_type;
|
|
|
|
|
|
let color, symbol, symbolSize, label, symbolRotate = 0;
|
|
|
|
|
|
- if (side === 'long') {
|
|
|
+ // 根据 event_type 确定方向
|
|
|
+ // open_long 和 close_short 是买入(向上箭头)
|
|
|
+ // open_short 和 close_long 是卖出(向下箭头)
|
|
|
+ if (eventType === 'open_long' || eventType === 'close_short') {
|
|
|
symbol = 'arrow';
|
|
|
- symbolSize = 15;
|
|
|
+ symbolSize = 12;
|
|
|
symbolRotate = 0;
|
|
|
color = '#28a745';
|
|
|
label = '买入';
|
|
|
- } else if (side === 'short') {
|
|
|
+ } else if (eventType === 'open_short' || eventType === 'close_long') {
|
|
|
symbol = 'arrow';
|
|
|
- symbolSize = 15;
|
|
|
+ symbolSize = 12;
|
|
|
symbolRotate = 180;
|
|
|
color = '#dc3545';
|
|
|
label = '卖出';
|
|
|
} else {
|
|
|
color = '#6c757d';
|
|
|
symbol = 'circle';
|
|
|
- symbolSize = 10;
|
|
|
+ symbolSize = 8;
|
|
|
label = '其他';
|
|
|
}
|
|
|
|
|
|
@@ -793,27 +795,29 @@
|
|
|
console.log(' 准备添加', tradingEventsData.length, '个事件标记到BPS图表');
|
|
|
tradingEventsData.forEach(event => {
|
|
|
const timestamp = event.timestamp * 1000;
|
|
|
- const side = event.side;
|
|
|
const eventType = event.event_type;
|
|
|
|
|
|
let color, symbol, symbolSize, label, symbolRotate = 0;
|
|
|
|
|
|
- if (side === 'long') {
|
|
|
+ // 根据 event_type 确定方向
|
|
|
+ // open_long 和 close_short 是买入(向上箭头)
|
|
|
+ // open_short 和 close_long 是卖出(向下箭头)
|
|
|
+ if (eventType === 'open_long' || eventType === 'close_short') {
|
|
|
symbol = 'arrow';
|
|
|
- symbolSize = 15;
|
|
|
+ symbolSize = 12;
|
|
|
symbolRotate = 0;
|
|
|
color = '#28a745';
|
|
|
label = '买入';
|
|
|
- } else if (side === 'short') {
|
|
|
+ } else if (eventType === 'open_short' || eventType === 'close_long') {
|
|
|
symbol = 'arrow';
|
|
|
- symbolSize = 15;
|
|
|
+ symbolSize = 12;
|
|
|
symbolRotate = 180;
|
|
|
color = '#dc3545';
|
|
|
label = '卖出';
|
|
|
} else {
|
|
|
color = '#6c757d';
|
|
|
symbol = 'circle';
|
|
|
- symbolSize = 10;
|
|
|
+ symbolSize = 8;
|
|
|
label = '其他';
|
|
|
}
|
|
|
|
|
|
@@ -1058,38 +1062,29 @@
|
|
|
tradingEventsData.forEach(event => {
|
|
|
const timestamp = event.timestamp * 1000; // 转换为毫秒
|
|
|
const eventType = event.event_type;
|
|
|
- const side = event.side; // long 或 short
|
|
|
|
|
|
- // 确定颜色和符号 - 根据方向:买=向上,卖=向下
|
|
|
+ // 确定颜色和符号
|
|
|
let color, symbol, symbolSize, label, symbolRotate = 0;
|
|
|
|
|
|
- // 判断是开仓还是平仓
|
|
|
- const isOpen = eventType.includes('open');
|
|
|
- const isClose = eventType.includes('close');
|
|
|
-
|
|
|
- // 根据side确定箭头方向
|
|
|
- if (side === 'long') {
|
|
|
- // 买入 = 向上箭头
|
|
|
+ // 根据 event_type 确定方向
|
|
|
+ // open_long 和 close_short 是买入(向上箭头)
|
|
|
+ // open_short 和 close_long 是卖出(向下箭头)
|
|
|
+ if (eventType === 'open_long' || eventType === 'close_short') {
|
|
|
symbol = 'arrow';
|
|
|
- symbolSize = 15;
|
|
|
- symbolRotate = 0; // 向上
|
|
|
-
|
|
|
+ symbolSize = 12;
|
|
|
+ symbolRotate = 0;
|
|
|
color = '#28a745';
|
|
|
label = '买入';
|
|
|
- } else if (side === 'short') {
|
|
|
- // 卖出 = 向下箭头
|
|
|
+ } else if (eventType === 'open_short' || eventType === 'close_long') {
|
|
|
symbol = 'arrow';
|
|
|
- symbolSize = 15;
|
|
|
- symbolRotate = 180; // 向下
|
|
|
-
|
|
|
+ symbolSize = 12;
|
|
|
+ symbolRotate = 180;
|
|
|
color = '#dc3545';
|
|
|
label = '卖出';
|
|
|
} else {
|
|
|
- // 未知方向
|
|
|
- color = '#6c757d'; // 灰色
|
|
|
+ color = '#6c757d';
|
|
|
symbol = 'circle';
|
|
|
- symbolSize = 10;
|
|
|
- symbolRotate = 0;
|
|
|
+ symbolSize = 8;
|
|
|
label = '其他';
|
|
|
}
|
|
|
|
|
|
@@ -1099,7 +1094,7 @@
|
|
|
value: label,
|
|
|
symbol: symbol,
|
|
|
symbolSize: symbolSize,
|
|
|
- symbolRotate: symbolRotate, // 使用计算好的旋转角度
|
|
|
+ symbolRotate: symbolRotate,
|
|
|
itemStyle: {
|
|
|
color: color,
|
|
|
borderColor: '#fff',
|