mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-22 07:26:50 +00:00
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:
@@ -387,22 +387,6 @@ func (b *Bithumb) PlaceTrade(ctx context.Context, orderCurrency, transactionType
|
||||
b.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, privatePlaceTrade, params, &response)
|
||||
}
|
||||
|
||||
// ModifyTrade modifies an order already on the exchange books
|
||||
func (b *Bithumb) ModifyTrade(ctx context.Context, orderID, orderCurrency, transactionType string, units float64, price int64) (OrderPlace, error) {
|
||||
response := OrderPlace{}
|
||||
|
||||
params := url.Values{}
|
||||
params.Set("order_currency", strings.ToUpper(orderCurrency))
|
||||
params.Set("payment_currency", "KRW")
|
||||
params.Set("type", strings.ToUpper(transactionType))
|
||||
params.Set("units", strconv.FormatFloat(units, 'f', -1, 64))
|
||||
params.Set("price", strconv.FormatInt(price, 10))
|
||||
params.Set("order_id", orderID)
|
||||
|
||||
return response,
|
||||
b.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, privatePlaceTrade, params, &response)
|
||||
}
|
||||
|
||||
// GetOrderDetails returns specific order details
|
||||
//
|
||||
// orderID: Order number registered for purchase/sales
|
||||
|
||||
@@ -89,7 +89,6 @@ func (b *Bithumb) SetDefaults() {
|
||||
GetOrder: true,
|
||||
CancelOrder: true,
|
||||
SubmitOrder: true,
|
||||
ModifyOrder: true,
|
||||
DepositHistory: true,
|
||||
WithdrawalHistory: true,
|
||||
UserTradeHistory: true,
|
||||
@@ -512,30 +511,8 @@ func (b *Bithumb) SubmitOrder(ctx context.Context, s *order.Submit) (order.Submi
|
||||
|
||||
// ModifyOrder will allow of changing orderbook placement and limit to
|
||||
// market conversion
|
||||
func (b *Bithumb) ModifyOrder(ctx context.Context, action *order.Modify) (*order.Modify, error) {
|
||||
if err := action.Validate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
o, err := b.ModifyTrade(ctx,
|
||||
action.ID,
|
||||
action.Pair.Base.String(),
|
||||
action.Side.Lower(),
|
||||
action.Amount,
|
||||
int64(action.Price))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &order.Modify{
|
||||
Exchange: action.Exchange,
|
||||
AssetType: action.AssetType,
|
||||
Pair: action.Pair,
|
||||
ID: o.Data[0].ContID,
|
||||
Price: float64(int64(action.Price)),
|
||||
Amount: action.Amount,
|
||||
Side: action.Side,
|
||||
}, nil
|
||||
func (b *Bithumb) ModifyOrder(_ context.Context, _ *order.Modify) (*order.ModifyResponse, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// CancelOrder cancels an order by its corresponding ID number
|
||||
|
||||
Reference in New Issue
Block a user