Getting closed orders implementation, fixed Binance MARKET order creation, expanded SubmitOrder response (#572)

* GetClosedOrder implemented for Kraken and Binance, fixed Binance MARKET order creaton, added rate, fee and cost fileds on SubmitOrder responce

* return Trades on Binance SubmitOrder, new validation methods on Binance and kraken GetClosedOrderInfo

* removed the Binance extra method GetClosedOrder

* func description corrected

* removed price, fee and cost from SimulateOrder response, as we get all necessary info in response to calculate them on client side

* GetClosedOrder implementation moved to GetOrderInfo

* changed GetOrderInfo params

* removed Canceled order.Type used for Kraken

* update QueryOrder in gctscript

* add missed params to QueryOrder validator (gctscript)

* fixed testing issues

* GetClosedOrder implemented for Kraken and Binance, fixed Binance MARKET order creaton, added rate, fee and cost fileds on SubmitOrder responce

* return Trades on Binance SubmitOrder, new validation methods on Binance and kraken GetClosedOrderInfo

* removed the Binance extra method GetClosedOrder

* func description corrected

* removed price, fee and cost from SimulateOrder response, as we get all necessary info in response to calculate them on client side

* GetClosedOrder implementation moved to GetOrderInfo

* changed GetOrderInfo params

* removed Canceled order.Type used for Kraken

* update QueryOrder in gctscript

* add missed params to QueryOrder validator (gctscript)

* fixed testing issues

* pull previous changes

* linter issues fix

* updated query_order exmple in gctscript, fixed params check

* removed orderPair unnecessary conversion

Co-authored-by: Vazha Bezhanishvili <vazha.bezhanishvili@elegro.eu>
This commit is contained in:
Vazha
2020-10-22 03:54:24 +03:00
committed by GitHub
parent 4ccb495baf
commit fab9d934fe
54 changed files with 2365 additions and 2151 deletions

View File

@@ -64,6 +64,10 @@ type SubmitResponse struct {
IsOrderPlaced bool
FullyMatched bool
OrderID string
Rate float64
Fee float64
Cost float64
Trades []TradeHistory
}
// Modify contains all properties of an order
@@ -124,6 +128,7 @@ type Detail struct {
TargetAmount float64
ExecutedAmount float64
RemainingAmount float64
Cost float64
Fee float64
Exchange string
InternalOrderID string
@@ -183,6 +188,7 @@ type TradeHistory struct {
Side Side
Timestamp time.Time
IsMaker bool
FeeAsset string
}
// GetOrdersRequest used for GetOrderHistory and GetOpenOrders wrapper functions
@@ -191,9 +197,11 @@ type GetOrdersRequest struct {
Side Side
StartTicks time.Time
EndTicks time.Time
OrderID string
// Currencies Empty array = all currencies. Some endpoints only support
// singular currency enquiries
Pairs []currency.Pair
Pairs []currency.Pair
AssetType asset.Item
}
// Status defines order status types
@@ -216,6 +224,7 @@ const (
Hidden Status = "HIDDEN"
UnknownStatus Status = "UNKNOWN"
Open Status = "OPEN"
Closed Status = "CLOSED"
)
// Type enforces a standard for order types across the code base

View File

@@ -662,8 +662,12 @@ func StringToOrderStatus(status string) (Status, error) {
return PartiallyCancelled, nil
case strings.EqualFold(status, Open.String()):
return Open, nil
case strings.EqualFold(status, Closed.String()):
return Closed, nil
case strings.EqualFold(status, Cancelled.String()):
return Cancelled, nil
case strings.EqualFold(status, "CANCELED"): // Kraken case
return Cancelled, nil
case strings.EqualFold(status, PendingCancel.String()),
strings.EqualFold(status, "pending cancel"),
strings.EqualFold(status, "pending cancellation"):