Skip to content

Commit

Permalink
[BinanceUsdM] add edit order support
Browse files Browse the repository at this point in the history
  • Loading branch information
techfreaque committed Feb 2, 2023
1 parent 92467bd commit 602b654
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions Trading/Exchange/binanceusdm/binanceusdm_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,29 @@ async def _create_limit_trailing_stop_order(
"_create_limit_trailing_stop_order is not implemented"
)

async def edit_order(
self,
order_id: str,
order_type: trading_enums.TraderOrderType,
symbol: str,
quantity: decimal.Decimal,
price: decimal.Decimal,
stop_price: decimal.Decimal = None,
side: trading_enums.TradeOrderSide = None,
current_price: decimal.Decimal = None,
params: dict = None,
):
# Binance futures doesnt have a api for editing orders
return await self.edit_order_by_replacing(
order_id=order_id,
order_type=order_type,
symbol=symbol,
quantity=quantity,
price=price,
stop_price=stop_price,
side=side,
)


class BinanceUsdMAdapter(exchanges.CCXTAdapter):
BINANCE_MODE = "hedged"
Expand Down Expand Up @@ -301,10 +324,6 @@ def fix_order(self, raw, **kwargs):
fixed[trading_enums.ExchangeConstantsOrderColumns.TIMESTAMP.value] = (
int(fixed["info"][self.BINANCE_UPDATE_TIME]) / 1000
)
elif fixed["info"].get(self.BINANCE_TIME):
fixed[trading_enums.ExchangeConstantsOrderColumns.TIMESTAMP.value] = (
int(fixed["info"][self.BINANCE_TIME]) / 1000
)
return fixed

def _adapt_order_type(self, fixed):
Expand Down

0 comments on commit 602b654

Please sign in to comment.