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