Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support binance portfolio margin 1.5 #4769

Open
douggie opened this issue Sep 10, 2023 · 4 comments
Open

Support binance portfolio margin 1.5 #4769

douggie opened this issue Sep 10, 2023 · 4 comments

Comments

@douggie
Copy link
Collaborator

douggie commented Sep 10, 2023

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.

@douggie
Copy link
Collaborator Author

douggie commented Sep 15, 2023

any comments? thoughts?

@douggie
Copy link
Collaborator Author

douggie commented Nov 1, 2023

@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

@douggie
Copy link
Collaborator Author

douggie commented Nov 2, 2023

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

@douggie
Copy link
Collaborator Author

douggie commented Nov 2, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant