mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
grid2: add earnBase option
This commit is contained in:
parent
5f7ad125c6
commit
64d8a30ecc
|
@ -152,7 +152,7 @@ func (s *Strategy) handleOrderFilled(o types.Order) {
|
|||
}
|
||||
|
||||
// use the profit to buy more inventory in the grid
|
||||
if s.Compound {
|
||||
if s.Compound || s.EarnBase {
|
||||
quoteQuantity := o.Quantity.Mul(o.Price)
|
||||
newQuantity = quoteQuantity.Div(newPrice)
|
||||
}
|
||||
|
@ -162,6 +162,11 @@ func (s *Strategy) handleOrderFilled(o types.Order) {
|
|||
if pin, ok := s.grid.NextHigherPin(newPrice); ok {
|
||||
newPrice = fixedpoint.Value(pin)
|
||||
}
|
||||
|
||||
if s.EarnBase {
|
||||
quoteQuantity := o.Quantity.Mul(o.Price)
|
||||
newQuantity = quoteQuantity.Div(newPrice)
|
||||
}
|
||||
}
|
||||
|
||||
orderForm := types.SubmitOrder{
|
||||
|
|
Loading…
Reference in New Issue
Block a user