mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-05 15:10:59 +00:00
gctrpc/ordermanager/binance: Add new getManagedOrders command and various improvements (#712)
* first draft of getmanaged orders RPC call * - ClientIDs for binance, especially spot asset - applied old ClientOrderId for cancelled orders - added clientOrderId to GCTRPC * added tests for Matchfilter and GetManagedOrders * smaller fixes * comment fix added getFilteredOrders to store changed store mutex to RWMutex smaller fixes * fixed bug in Detail Copy and added test * fixes for Scotts review * processSubmittedOrder was missing clientOrderId * changed: TestGetOrdersFiltered expanded fixed: warning, where variable name collided with package name fixed: used req.AssetType in binance_wrapper.go Co-authored-by: Mark Dzulko <81071907+Mark-numus@users.noreply.github.com>
This commit is contained in:
@@ -805,12 +805,13 @@ func (b *Binance) SubmitOrder(s *order.Submit) (order.SubmitResponse, error) {
|
||||
}
|
||||
|
||||
var orderRequest = NewOrderRequest{
|
||||
Symbol: s.Pair,
|
||||
Side: sideType,
|
||||
Price: s.Price,
|
||||
Quantity: s.Amount,
|
||||
TradeType: requestParamsOrderType,
|
||||
TimeInForce: timeInForce,
|
||||
Symbol: s.Pair,
|
||||
Side: sideType,
|
||||
Price: s.Price,
|
||||
Quantity: s.Amount,
|
||||
TradeType: requestParamsOrderType,
|
||||
TimeInForce: timeInForce,
|
||||
NewClientOrderID: s.ClientOrderID,
|
||||
}
|
||||
response, err := b.NewOrder(&orderRequest)
|
||||
if err != nil {
|
||||
@@ -864,14 +865,14 @@ func (b *Binance) SubmitOrder(s *order.Submit) (order.SubmitResponse, error) {
|
||||
default:
|
||||
return submitOrderResponse, errors.New("invalid type, check api docs for updates")
|
||||
}
|
||||
order, err := b.FuturesNewOrder(s.Pair, reqSide,
|
||||
o, err := b.FuturesNewOrder(s.Pair, reqSide,
|
||||
"", oType, "GTC", "",
|
||||
s.ClientOrderID, "", "",
|
||||
s.Amount, s.Price, 0, 0, 0, s.ReduceOnly)
|
||||
if err != nil {
|
||||
return submitOrderResponse, err
|
||||
}
|
||||
submitOrderResponse.OrderID = strconv.FormatInt(order.OrderID, 10)
|
||||
submitOrderResponse.OrderID = strconv.FormatInt(o.OrderID, 10)
|
||||
submitOrderResponse.IsOrderPlaced = true
|
||||
case asset.USDTMarginedFutures:
|
||||
var reqSide string
|
||||
@@ -1050,6 +1051,7 @@ func (b *Binance) GetOrderInfo(orderID string, pair currency.Pair, assetType ass
|
||||
Amount: resp.OrigQty,
|
||||
Exchange: b.Name,
|
||||
ID: strconv.FormatInt(resp.OrderID, 10),
|
||||
ClientOrderID: resp.ClientOrderID,
|
||||
Side: orderSide,
|
||||
Type: orderType,
|
||||
Pair: pair,
|
||||
@@ -1191,17 +1193,18 @@ func (b *Binance) GetActiveOrders(req *order.GetOrdersRequest) ([]order.Detail,
|
||||
orderSide := order.Side(strings.ToUpper(resp[x].Side))
|
||||
orderType := order.Type(strings.ToUpper(resp[x].Type))
|
||||
orders = append(orders, order.Detail{
|
||||
Amount: resp[x].OrigQty,
|
||||
Date: resp[x].Time,
|
||||
Exchange: b.Name,
|
||||
ID: strconv.FormatInt(resp[x].OrderID, 10),
|
||||
Side: orderSide,
|
||||
Type: orderType,
|
||||
Price: resp[x].Price,
|
||||
Status: order.Status(resp[x].Status),
|
||||
Pair: req.Pairs[i],
|
||||
AssetType: asset.Spot,
|
||||
LastUpdated: resp[x].UpdateTime,
|
||||
Amount: resp[x].OrigQty,
|
||||
Date: resp[x].Time,
|
||||
Exchange: b.Name,
|
||||
ID: strconv.FormatInt(resp[x].OrderID, 10),
|
||||
ClientOrderID: resp[x].ClientOrderID,
|
||||
Side: orderSide,
|
||||
Type: orderType,
|
||||
Price: resp[x].Price,
|
||||
Status: order.Status(resp[x].Status),
|
||||
Pair: req.Pairs[i],
|
||||
AssetType: req.AssetType,
|
||||
LastUpdated: resp[x].UpdateTime,
|
||||
})
|
||||
}
|
||||
case asset.CoinMarginedFutures:
|
||||
|
||||
Reference in New Issue
Block a user