gateio: fix spot/futures order issues (#1524)

* gateio: fix spot deployment issue

* fix status bug add test

* to actual return type

* fix linter

* ch type

* glorious: nits

* rm space

* glorious: nits

---------

Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
This commit is contained in:
Ryan O'Hara-Reid
2024-04-29 13:54:06 +10:00
committed by GitHub
parent 44d50a3617
commit 694f2f7944
6 changed files with 75 additions and 21 deletions

View File

@@ -331,6 +331,7 @@ const (
Pending
Cancelling
Liquidated
STP
)
// Type enforces a standard for order types across the code base

View File

@@ -815,6 +815,10 @@ func (s Status) String() string {
return "PENDING"
case Cancelling:
return "CANCELLING"
case Liquidated:
return "LIQUIDATED"
case STP:
return "SELF_TRADE_PREVENTION"
default:
return "UNKNOWN"
}
@@ -1141,7 +1145,7 @@ func StringToOrderStatus(status string) (Status, error) {
return PartiallyFilledCancelled, nil
case Open.String():
return Open, nil
case Closed.String():
case Closed.String(), "POSITION_CLOSED":
return Closed, nil
case Cancelled.String(), "CANCELED", "ORDER_CANCELLED":
return Cancelled, nil
@@ -1161,6 +1165,12 @@ func StringToOrderStatus(status string) (Status, error) {
return MarketUnavailable, nil
case Cancelling.String():
return Cancelling, nil
case Liquidated.String():
return Liquidated, nil
case AutoDeleverage.String(), "AUTO_DELEVERAGED":
return AutoDeleverage, nil
case STP.String(), "STP":
return STP, nil
default:
return UnknownStatus, fmt.Errorf("'%s' %w", status, errUnrecognisedOrderStatus)
}