Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: [binance] add new margin order side effect AUTO_BORROW_REPAY #1711

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions pkg/types/order.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
Expand Down Expand Up @@ -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"`
Expand Down
Loading