mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-12 15:26:55 +08:00
fix: chart order markers not displaying due to timestamp format mismatch
- Fix milliseconds to seconds conversion in parseCustomTime (AdvancedChart & ChartWithOrders) - Add GetTraderOrdersFiltered to filter orders at database level by symbol/status - Increase order limit from 50 to 200 for more historical orders - Group multiple orders at same candle time and show count (B3, S5, etc.) - Buy markers shown below bar (green), sell markers above bar (red)
This commit is contained in:
@@ -63,9 +63,15 @@ export function ChartWithOrders({
|
||||
return 0
|
||||
}
|
||||
|
||||
// 如果已经是数字(Unix 时间戳),直接返回
|
||||
// 如果已经是数字(Unix 时间戳)
|
||||
if (typeof time === 'number') {
|
||||
console.log('[ChartWithOrders] ✅ Unix timestamp:', time, '(', new Date(time * 1000).toISOString(), ')')
|
||||
// 判断是毫秒还是秒:如果大于 10^12 则认为是毫秒(2001年之后的毫秒时间戳)
|
||||
if (time > 1000000000000) {
|
||||
const seconds = Math.floor(time / 1000)
|
||||
console.log('[ChartWithOrders] ✅ Unix timestamp (ms→s):', time, '→', seconds, '(', new Date(time).toISOString(), ')')
|
||||
return seconds
|
||||
}
|
||||
console.log('[ChartWithOrders] ✅ Unix timestamp (s):', time, '(', new Date(time * 1000).toISOString(), ')')
|
||||
return time
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user