@@ -14,23 +14,24 @@ import (
14
14
15
15
// CreateOrderService create order
16
16
type CreateOrderService struct {
17
- c * Client
18
- symbol string
19
- side SideType
20
- positionSide * PositionSideType
21
- orderType OrderType
22
- timeInForce * TimeInForceType
23
- quantity string
24
- reduceOnly * string
25
- price * string
26
- newClientOrderID * string
27
- stopPrice * string
28
- workingType * WorkingType
29
- activationPrice * string
30
- callbackRate * string
31
- priceProtect * string
32
- newOrderRespType NewOrderRespType
33
- closePosition * string
17
+ c * Client
18
+ symbol string
19
+ side SideType
20
+ positionSide * PositionSideType
21
+ orderType OrderType
22
+ timeInForce * TimeInForceType
23
+ quantity string
24
+ reduceOnly * string
25
+ price * string
26
+ newClientOrderID * string
27
+ stopPrice * string
28
+ workingType * WorkingType
29
+ activationPrice * string
30
+ callbackRate * string
31
+ priceProtect * string
32
+ newOrderRespType NewOrderRespType
33
+ closePosition * string
34
+ selfTradePreventionMode * SelfTradePreventionMode
34
35
}
35
36
36
37
// Symbol set symbol
@@ -132,6 +133,12 @@ func (s *CreateOrderService) ClosePosition(closePosition bool) *CreateOrderServi
132
133
return s
133
134
}
134
135
136
+ // SelfTradePreventionMode set selfTradePreventionMode
137
+ func (s * CreateOrderService ) SelfTradePreventionMode (selfTradePreventionMode SelfTradePreventionMode ) * CreateOrderService {
138
+ s .selfTradePreventionMode = & selfTradePreventionMode
139
+ return s
140
+ }
141
+
135
142
func (s * CreateOrderService ) createOrder (ctx context.Context , endpoint string , opts ... RequestOption ) (data []byte , header * http.Header , err error ) {
136
143
r := & request {
137
144
method : http .MethodPost ,
@@ -180,6 +187,9 @@ func (s *CreateOrderService) createOrder(ctx context.Context, endpoint string, o
180
187
if s .closePosition != nil {
181
188
m ["closePosition" ] = * s .closePosition
182
189
}
190
+ if s .selfTradePreventionMode != nil {
191
+ m ["selfTradePreventionMode" ] = * s .selfTradePreventionMode
192
+ }
183
193
r .setFormParams (m )
184
194
data , header , err = s .c .callAPI (ctx , r , opts ... )
185
195
if err != nil {
@@ -668,27 +678,28 @@ func (s *CancelOrderService) Do(ctx context.Context, opts ...RequestOption) (res
668
678
669
679
// CancelOrderResponse define response of canceling order
670
680
type CancelOrderResponse struct {
671
- ClientOrderID string `json:"clientOrderId"`
672
- CumQuantity string `json:"cumQty"` // deprecated: use ExecutedQuantity instead
673
- CumQuote string `json:"cumQuote"`
674
- ExecutedQuantity string `json:"executedQty"`
675
- OrderID int64 `json:"orderId"`
676
- OrigQuantity string `json:"origQty"`
677
- Price string `json:"price"`
678
- ReduceOnly bool `json:"reduceOnly"`
679
- Side SideType `json:"side"`
680
- Status OrderStatusType `json:"status"`
681
- StopPrice string `json:"stopPrice"`
682
- Symbol string `json:"symbol"`
683
- TimeInForce TimeInForceType `json:"timeInForce"`
684
- Type OrderType `json:"type"`
685
- UpdateTime int64 `json:"updateTime"`
686
- WorkingType WorkingType `json:"workingType"`
687
- ActivatePrice string `json:"activatePrice"`
688
- PriceRate string `json:"priceRate"`
689
- OrigType string `json:"origType"`
690
- PositionSide PositionSideType `json:"positionSide"`
691
- PriceProtect bool `json:"priceProtect"`
681
+ ClientOrderID string `json:"clientOrderId"`
682
+ CumQuantity string `json:"cumQty"` // deprecated: use ExecutedQuantity instead
683
+ CumQuote string `json:"cumQuote"`
684
+ ExecutedQuantity string `json:"executedQty"`
685
+ OrderID int64 `json:"orderId"`
686
+ OrigQuantity string `json:"origQty"`
687
+ Price string `json:"price"`
688
+ ReduceOnly bool `json:"reduceOnly"`
689
+ Side SideType `json:"side"`
690
+ Status OrderStatusType `json:"status"`
691
+ StopPrice string `json:"stopPrice"`
692
+ Symbol string `json:"symbol"`
693
+ TimeInForce TimeInForceType `json:"timeInForce"`
694
+ Type OrderType `json:"type"`
695
+ UpdateTime int64 `json:"updateTime"`
696
+ WorkingType WorkingType `json:"workingType"`
697
+ ActivatePrice string `json:"activatePrice"`
698
+ PriceRate string `json:"priceRate"`
699
+ OrigType string `json:"origType"`
700
+ PositionSide PositionSideType `json:"positionSide"`
701
+ PriceProtect bool `json:"priceProtect"`
702
+ SelfTradePreventionMode SelfTradePreventionMode `json:"selfTradePreventionMode"`
692
703
}
693
704
694
705
// CancelAllOpenOrdersService cancel all open orders
0 commit comments