knowm / XChange

XChange is a Java library providing a streamlined API for interacting with 60+ Bitcoin and Altcoin exchanges providing a consistent interface for trading and accessing market data.

Home Page:http://knowm.org/open-source/xchange/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support binance portfolio margin 1.5

douggie opened this issue · comments

Hi, binance's new portfolio margin 1.5 (offsetting spot and perp positions) requires new end points ((i.e https://papi.binance.com) to place, cancel orders etc etc (https://binance-docs.github.io/apidocs/pm/en/#change-log).

Unless there are any objections I am proposing I add the following methods to org.knowm.xchange.binance.service.BinanceTradeServiceRaw and then add USE_PORTFOLIO_MARGIN order flag to org.knowm.xchange.binance.dto.trade.BinanceOrderFlags to control the switching to the portfolio margin endpoints (i.e https://papi.binance.com) by using the USE_PORTFOLIO_MARGIN order flag in org.knowm.xchange.binance.service.BinanceTradeService

org.knowm.xchange.binance.service.BinanceTradeServiceRaw

  • portfolioMarginOpenOrdersAllProducts
  • newPortfolioMarginFutureOrder
  • newPortfolioMarginMarginOrder
  • portfolioMarginOrderStatusAllProducts
  • cancelPortfolioMarginOrderAllProducts
  • cancelPortfolioMarginOrderAllProducts
  • cancelAllPortfolioMarginOpenOrdersAllProducts
  • allPortfolioMarginOrders
  • myPortfolioMarginTradesAllProducts
  • portfolioMarginOpenPositions

Unless that are any comments or objections I will assume that everyone is ok with me continuing with this approach.

any comments? thoughts?

@makarid any thoughts?

think i will add 2 flagsPORTFOLIO_MARGIN and INVERSE so we can route new portfolio margin futures or spot orders to the POST /papi/v1/um/order endpoints, as well as route the the coinmargin endpoints (i.e. inverse) https://binance-docs.github.io/apidocs/delivery/en/#new-order-trade and the current default usd margin endpoints, (i.e. linear) https://binance-docs.github.io/apidocs/futures/en/#new-order-trade

As Binance has separate base URL's (i.e. https://papi.binance.com) i controlled it by setting exchange specific parameters.

arggh tests failing on kraken, will try to take a look and fix them up.