mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 06:53:52 +00:00
fix: tv chart, price direction in backtest
This commit is contained in:
parent
99122f44bc
commit
c6bad0ba08
|
@ -155,7 +155,7 @@ const ordersToMarkets = (interval: string, orders: Array<Order> | void): Array<M
|
|||
// var markers = [{ time: data[data.length - 48].time, position: 'aboveBar', color: '#f68410', shape: 'circle', text: 'D' }];
|
||||
for (let i = 0; i < orders.length; i++) {
|
||||
let order = orders[i];
|
||||
let t = order.update_time.getTime() / 1000.0;
|
||||
let t = (order.update_time || order.time).getTime() / 1000.0;
|
||||
let lastMarker = markers.length > 0 ? markers[markers.length - 1] : null;
|
||||
if (lastMarker) {
|
||||
let remainder = lastMarker.time % intervalSecs;
|
||||
|
@ -264,7 +264,7 @@ const positionBaseHistoryToLineData = (interval: string, hs: Array<PositionHisto
|
|||
}
|
||||
|
||||
// ignore duplicated entry
|
||||
if (hs[i].time.getTime() === hs[i - 1].time.getTime()) {
|
||||
if (i > 0 && hs[i].time.getTime() === hs[i - 1].time.getTime()) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,7 @@ const positionAverageCostHistoryToLineData = (interval: string, hs: Array<Positi
|
|||
}
|
||||
|
||||
// ignore duplicated entry
|
||||
if (hs[i].time.getTime() === hs[i - 1].time.getTime()) {
|
||||
if (i > 0 && hs[i].time.getTime() === hs[i - 1].time.getTime()) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
@ -414,9 +414,9 @@ func (m *SimplePriceMatching) processKLine(kline types.KLine) {
|
|||
m.LastPrice = kline.Open
|
||||
} else {
|
||||
if m.LastPrice.Compare(kline.Open) > 0 {
|
||||
m.BuyToPrice(kline.Open)
|
||||
} else {
|
||||
m.SellToPrice(kline.Open)
|
||||
} else {
|
||||
m.BuyToPrice(kline.Open)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user