mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 08:15:15 +00:00
Merge pull request #441 from zenixls2/fix/431
fix: #431 for not updating lastPrice if no tade happened
This commit is contained in:
commit
c6fe3ce155
|
@ -405,7 +405,7 @@ func (m *SimplePriceMatching) processKLine(kline types.KLine) {
|
|||
|
||||
switch kline.Direction() {
|
||||
case types.DirectionDown:
|
||||
if kline.High > kline.Open {
|
||||
if kline.High >= kline.Open {
|
||||
m.BuyToPrice(fixedpoint.NewFromFloat(kline.High))
|
||||
}
|
||||
|
||||
|
@ -417,7 +417,7 @@ func (m *SimplePriceMatching) processKLine(kline types.KLine) {
|
|||
}
|
||||
|
||||
case types.DirectionUp:
|
||||
if kline.Low < kline.Open {
|
||||
if kline.Low <= kline.Open {
|
||||
m.SellToPrice(fixedpoint.NewFromFloat(kline.Low))
|
||||
}
|
||||
|
||||
|
@ -427,6 +427,10 @@ func (m *SimplePriceMatching) processKLine(kline types.KLine) {
|
|||
} else {
|
||||
m.BuyToPrice(fixedpoint.NewFromFloat(kline.Close))
|
||||
}
|
||||
default: // no trade up or down
|
||||
if (m.LastPrice == 0) {
|
||||
m.BuyToPrice(fixedpoint.NewFromFloat(kline.Close))
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user