mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-05 07:26:47 +00:00
orders: Add methods to derive SubmitResponse and Detail types (#955)
* orders: deprecate SubmitResponse return and change to *order.Detail construct detail from order.Submit struct * orders: add coverage, fix tests * coinut: rm test for checking * orders: revert change for return and change field ID to a more explicit name OrderID * orders: Add method to see if the order was placed * order: change field name in Cancel type to be more explicit * orders: standardize field -> OrderID * backtester: populate change * orders: add test * gctscript: fix field name * linter: fix issues * linter: more fixes * linter: forever * exchanges_tests: populate order.Submit field exchange name * Update exchanges/order/order_types.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * Update exchanges/order/orders.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * glorious: nits * glorious: nits * thrasher: nits Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io> Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
This commit is contained in:
@@ -970,7 +970,7 @@ func (s *RPCServer) GetOrders(ctx context.Context, r *gctrpc.GetOrdersRequest) (
|
||||
}
|
||||
o := &gctrpc.OrderDetails{
|
||||
Exchange: r.Exchange,
|
||||
Id: resp[x].ID,
|
||||
Id: resp[x].OrderID,
|
||||
ClientOrderId: resp[x].ClientOrderID,
|
||||
BaseCurrency: resp[x].Pair.Base.String(),
|
||||
QuoteCurrency: resp[x].Pair.Quote.String(),
|
||||
@@ -1059,7 +1059,7 @@ func (s *RPCServer) GetManagedOrders(_ context.Context, r *gctrpc.GetOrdersReque
|
||||
}
|
||||
o := &gctrpc.OrderDetails{
|
||||
Exchange: r.Exchange,
|
||||
Id: resp[x].ID,
|
||||
Id: resp[x].OrderID,
|
||||
ClientOrderId: resp[x].ClientOrderID,
|
||||
BaseCurrency: resp[x].Pair.Base.String(),
|
||||
QuoteCurrency: resp[x].Pair.Quote.String(),
|
||||
@@ -1150,7 +1150,7 @@ func (s *RPCServer) GetOrder(ctx context.Context, r *gctrpc.GetOrderRequest) (*g
|
||||
|
||||
return &gctrpc.OrderDetails{
|
||||
Exchange: result.Exchange,
|
||||
Id: result.ID,
|
||||
Id: result.OrderID,
|
||||
ClientOrderId: result.ClientOrderID,
|
||||
BaseCurrency: result.Pair.Base.String(),
|
||||
QuoteCurrency: result.Pair.Quote.String(),
|
||||
@@ -1236,9 +1236,9 @@ func (s *RPCServer) SubmitOrder(ctx context.Context, r *gctrpc.SubmitOrderReques
|
||||
|
||||
return &gctrpc.SubmitOrderResponse{
|
||||
OrderId: resp.OrderID,
|
||||
OrderPlaced: resp.IsOrderPlaced,
|
||||
OrderPlaced: resp.WasOrderPlaced(),
|
||||
Trades: trades,
|
||||
}, err
|
||||
}, nil
|
||||
}
|
||||
|
||||
// SimulateOrder simulates an order specified by exchange, currency pair and asset
|
||||
@@ -1384,7 +1384,7 @@ func (s *RPCServer) CancelOrder(ctx context.Context, r *gctrpc.CancelOrderReques
|
||||
&order.Cancel{
|
||||
Exchange: r.Exchange,
|
||||
AccountID: r.AccountId,
|
||||
ID: r.OrderId,
|
||||
OrderID: r.OrderId,
|
||||
Side: side,
|
||||
WalletAddress: r.WalletAddress,
|
||||
Pair: p,
|
||||
@@ -1434,7 +1434,7 @@ func (s *RPCServer) CancelBatchOrders(ctx context.Context, r *gctrpc.CancelBatch
|
||||
status[orderID] = order.Cancelled.String()
|
||||
request[x] = order.Cancel{
|
||||
AccountID: r.AccountId,
|
||||
ID: orderID,
|
||||
OrderID: orderID,
|
||||
Side: side,
|
||||
WalletAddress: r.WalletAddress,
|
||||
Pair: pair,
|
||||
@@ -1495,17 +1495,14 @@ func (s *RPCServer) ModifyOrder(ctx context.Context, r *gctrpc.ModifyOrderReques
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
mod := order.Modify{
|
||||
resp, err := s.OrderManager.Modify(ctx, &order.Modify{
|
||||
Exchange: r.Exchange,
|
||||
AssetType: assetType,
|
||||
Pair: pair,
|
||||
ID: r.OrderId,
|
||||
|
||||
Amount: r.Amount,
|
||||
Price: r.Price,
|
||||
}
|
||||
resp, err := s.OrderManager.Modify(ctx, &mod)
|
||||
OrderID: r.OrderId,
|
||||
Amount: r.Amount,
|
||||
Price: r.Price,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -4304,7 +4301,7 @@ func (s *RPCServer) GetFuturesPositions(ctx context.Context, r *gctrpc.GetFuture
|
||||
}
|
||||
od := &gctrpc.OrderDetails{
|
||||
Exchange: pos[i].Orders[j].Exchange,
|
||||
Id: pos[i].Orders[j].ID,
|
||||
Id: pos[i].Orders[j].OrderID,
|
||||
ClientOrderId: pos[i].Orders[j].ClientOrderID,
|
||||
BaseCurrency: pos[i].Orders[j].Pair.Base.String(),
|
||||
QuoteCurrency: pos[i].Orders[j].Pair.Quote.String(),
|
||||
|
||||
Reference in New Issue
Block a user