mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 16:25:16 +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() {
|
switch kline.Direction() {
|
||||||
case types.DirectionDown:
|
case types.DirectionDown:
|
||||||
if kline.High > kline.Open {
|
if kline.High >= kline.Open {
|
||||||
m.BuyToPrice(fixedpoint.NewFromFloat(kline.High))
|
m.BuyToPrice(fixedpoint.NewFromFloat(kline.High))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ func (m *SimplePriceMatching) processKLine(kline types.KLine) {
|
||||||
}
|
}
|
||||||
|
|
||||||
case types.DirectionUp:
|
case types.DirectionUp:
|
||||||
if kline.Low < kline.Open {
|
if kline.Low <= kline.Open {
|
||||||
m.SellToPrice(fixedpoint.NewFromFloat(kline.Low))
|
m.SellToPrice(fixedpoint.NewFromFloat(kline.Low))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,6 +427,10 @@ func (m *SimplePriceMatching) processKLine(kline types.KLine) {
|
||||||
} else {
|
} else {
|
||||||
m.BuyToPrice(fixedpoint.NewFromFloat(kline.Close))
|
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