diff --git a/pkg/types/order.go b/pkg/types/order.go index a2271f58c..0ac388f2b 100644 --- a/pkg/types/order.go +++ b/pkg/types/order.go @@ -39,9 +39,10 @@ var ( type MarginOrderSideEffectType string var ( - SideEffectTypeNoSideEffect MarginOrderSideEffectType = "NO_SIDE_EFFECT" - SideEffectTypeMarginBuy MarginOrderSideEffectType = "MARGIN_BUY" - SideEffectTypeAutoRepay MarginOrderSideEffectType = "AUTO_REPAY" + SideEffectTypeNoSideEffect MarginOrderSideEffectType = "NO_SIDE_EFFECT" + SideEffectTypeMarginBuy MarginOrderSideEffectType = "MARGIN_BUY" + SideEffectTypeAutoRepay MarginOrderSideEffectType = "AUTO_REPAY" + SideEffectTypeAutoBorrowRepay MarginOrderSideEffectType = "AUTO_BORROW_REPAY" ) func (t *MarginOrderSideEffectType) UnmarshalJSON(data []byte) error { @@ -65,6 +66,10 @@ func (t *MarginOrderSideEffectType) UnmarshalJSON(data []byte) error { *t = SideEffectTypeAutoRepay return nil + case string(SideEffectTypeAutoBorrowRepay), "BORROWREPAY", "AUTOBORROWREPAY": + *t = SideEffectTypeAutoBorrowRepay + return nil + } return fmt.Errorf("invalid side effect type: %s", data) @@ -143,7 +148,7 @@ type SubmitOrder struct { GroupID uint32 `json:"groupID,omitempty"` - MarginSideEffect MarginOrderSideEffectType `json:"marginSideEffect,omitempty"` // AUTO_REPAY = repay, MARGIN_BUY = borrow, defaults to NO_SIDE_EFFECT + MarginSideEffect MarginOrderSideEffectType `json:"marginSideEffect,omitempty"` // AUTO_BORROW_REPAY = borrowrepay, AUTO_REPAY = repay, MARGIN_BUY = borrow, defaults to NO_SIDE_EFFECT ReduceOnly bool `json:"reduceOnly,omitempty" db:"reduce_only"` ClosePosition bool `json:"closePosition,omitempty" db:"close_position"`