orders: Add derive modify struct method from order.Detail (#948)

* orders: Add derive modify struct method to order.Detail and then subsequent method to derive and standardize response details

* exchanges: call modify method in wrappers

* linter: fixes

* engine/wsroutineman: remove print summary

* glorious: nits, removed modifyOrder functionality for Bithumb. There are not docs to support this.

* Update exchanges/order/orders.go

Co-authored-by: Scott <gloriousCode@users.noreply.github.com>

* glorious: nits

Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
This commit is contained in:
Ryan O'Hara-Reid
2022-05-30 14:38:21 +10:00
committed by GitHub
parent 293d6104ed
commit a63aa6b616
42 changed files with 298 additions and 427 deletions

View File

@@ -405,9 +405,9 @@ func (m *OrderManager) Modify(ctx context.Context, mod *order.Modify) (*order.Mo
}
m.orderStore.commsManager.PushEvent(base.Event{
Type: "order",
Message: fmt.Sprintf(message, mod.Exchange, res.ID),
Message: fmt.Sprintf(message, mod.Exchange, res.OrderID),
})
return &order.ModifyResponse{OrderID: res.ID}, err
return &order.ModifyResponse{OrderID: res.OrderID}, err
}
// Submit will take in an order struct, send it to the exchange and
@@ -892,7 +892,7 @@ func (s *store) updateExisting(od *order.Detail) error {
// modifyExisting depends on mod.Exchange and given ID to uniquely identify an order and
// modify it.
func (s *store) modifyExisting(id string, mod *order.Modify) error {
func (s *store) modifyExisting(id string, mod *order.ModifyResponse) error {
s.m.Lock()
defer s.m.Unlock()
r, ok := s.Orders[strings.ToLower(mod.Exchange)]
@@ -903,7 +903,7 @@ func (s *store) modifyExisting(id string, mod *order.Modify) error {
if r[x].ID != id {
continue
}
r[x].UpdateOrderFromModify(mod)
r[x].UpdateOrderFromModifyResponse(mod)
if !r[x].AssetType.IsFutures() {
return nil
}