mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
add orderType parameter
This commit is contained in:
parent
45da0bd4c7
commit
94b946a993
|
@ -22,5 +22,6 @@ exchangeStrategies:
|
||||||
threshold: 1%
|
threshold: 1%
|
||||||
# max amount to buy or sell per order
|
# max amount to buy or sell per order
|
||||||
maxAmount: 1_000
|
maxAmount: 1_000
|
||||||
dryRun: true
|
|
||||||
queryInterval: 1h
|
queryInterval: 1h
|
||||||
|
orderType: LIMIT_MAKER # LIMIT_MAKER, LIMIT, MARKET
|
||||||
|
dryRun: true
|
||||||
|
|
|
@ -31,11 +31,12 @@ type Strategy struct {
|
||||||
QuoteCurrencyWeight fixedpoint.Value `json:"quoteCurrencyWeight"`
|
QuoteCurrencyWeight fixedpoint.Value `json:"quoteCurrencyWeight"`
|
||||||
BaseCurrencies []string `json:"baseCurrencies"`
|
BaseCurrencies []string `json:"baseCurrencies"`
|
||||||
Threshold fixedpoint.Value `json:"threshold"`
|
Threshold fixedpoint.Value `json:"threshold"`
|
||||||
DryRun bool `json:"dryRun"`
|
|
||||||
// max amount to buy or sell per order
|
// max amount to buy or sell per order
|
||||||
MaxAmount fixedpoint.Value `json:"maxAmount"`
|
MaxAmount fixedpoint.Value `json:"maxAmount"`
|
||||||
// interval to query marketcap data from coinmarketcap
|
// interval to query marketcap data from coinmarketcap
|
||||||
QueryInterval types.Interval `json:"queryInterval"`
|
QueryInterval types.Interval `json:"queryInterval"`
|
||||||
|
OrderType types.OrderType `json:"orderType"`
|
||||||
|
DryRun bool `json:"dryRun"`
|
||||||
|
|
||||||
subscribeSymbol string
|
subscribeSymbol string
|
||||||
activeOrderBook *bbgo.ActiveOrderBook
|
activeOrderBook *bbgo.ActiveOrderBook
|
||||||
|
@ -77,6 +78,10 @@ func (s *Strategy) Validate() error {
|
||||||
return fmt.Errorf("maxAmount shoud not less than 0")
|
return fmt.Errorf("maxAmount shoud not less than 0")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if s.OrderType == "" {
|
||||||
|
s.OrderType = types.OrderTypeLimitMaker
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +183,7 @@ func (s *Strategy) generateSubmitOrders(ctx context.Context, session *bbgo.Excha
|
||||||
order := types.SubmitOrder{
|
order := types.SubmitOrder{
|
||||||
Symbol: symbol,
|
Symbol: symbol,
|
||||||
Side: side,
|
Side: side,
|
||||||
Type: types.OrderTypeLimit,
|
Type: s.OrderType,
|
||||||
Quantity: quantity,
|
Quantity: quantity,
|
||||||
Price: currentPrice,
|
Price: currentPrice,
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,10 @@ func (s *Strategy) Validate() error {
|
||||||
return fmt.Errorf("maxAmount shoud not less than 0")
|
return fmt.Errorf("maxAmount shoud not less than 0")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if s.OrderType == "" {
|
||||||
|
s.OrderType = types.OrderTypeLimitMaker
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user