mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
grid2: pull out processFilledOrder method
This commit is contained in:
parent
8c575f6f3c
commit
532d474564
|
@ -197,7 +197,6 @@ func (s *Strategy) handleOrderCanceled(o types.Order) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: consider order fee
|
|
||||||
func (s *Strategy) calculateProfit(o types.Order, buyPrice, buyQuantity fixedpoint.Value) *GridProfit {
|
func (s *Strategy) calculateProfit(o types.Order, buyPrice, buyQuantity fixedpoint.Value) *GridProfit {
|
||||||
if s.EarnBase {
|
if s.EarnBase {
|
||||||
// sell quantity - buy quantity
|
// sell quantity - buy quantity
|
||||||
|
@ -300,14 +299,7 @@ func (s *Strategy) aggregateOrderBaseFee(o types.Order) fixedpoint.Value {
|
||||||
return fixedpoint.Zero
|
return fixedpoint.Zero
|
||||||
}
|
}
|
||||||
|
|
||||||
// handleOrderFilled is called when an order status is FILLED
|
func (s *Strategy) processFilledOrder(o types.Order) {
|
||||||
func (s *Strategy) handleOrderFilled(o types.Order) {
|
|
||||||
if s.grid == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
s.logger.Infof("GRID ORDER FILLED: %s", o.String())
|
|
||||||
|
|
||||||
// check order fee
|
// check order fee
|
||||||
newSide := types.SideTypeSell
|
newSide := types.SideTypeSell
|
||||||
newPrice := o.Price
|
newPrice := o.Price
|
||||||
|
@ -386,6 +378,16 @@ func (s *Strategy) handleOrderFilled(o types.Order) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// handleOrderFilled is called when an order status is FILLED
|
||||||
|
func (s *Strategy) handleOrderFilled(o types.Order) {
|
||||||
|
if s.grid == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
s.logger.Infof("GRID ORDER FILLED: %s", o.String())
|
||||||
|
s.processFilledOrder(o)
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Strategy) checkRequiredInvestmentByQuantity(baseBalance, quoteBalance, quantity, lastPrice fixedpoint.Value, pins []Pin) (requiredBase, requiredQuote fixedpoint.Value, err error) {
|
func (s *Strategy) checkRequiredInvestmentByQuantity(baseBalance, quoteBalance, quantity, lastPrice fixedpoint.Value, pins []Pin) (requiredBase, requiredQuote fixedpoint.Value, err error) {
|
||||||
// check more investment budget details
|
// check more investment budget details
|
||||||
requiredBase = fixedpoint.Zero
|
requiredBase = fixedpoint.Zero
|
||||||
|
|
Loading…
Reference in New Issue
Block a user