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.
http://knowm.org/open-source/xchange/
MIT License
3.81k stars 1.93k forks source link

Support binance futures and margin trading #4612

Open m1dnightc0der opened 1 year ago

m1dnightc0der commented 1 year ago

It does not see that the existing binanace (xchange-binance) only support the spot api's (api/v3) rather than the margin (/sapi/v1/margin) and futures (/fapi/v1/). I would like to implement the additional margin and futures support, and wondered if there was any guidence on how to do this, i.e. as a new exhcange within xchange-binance or via some flag using the exsitng exchange.

makarid commented 1 year ago

If you don't know, please don't start because i will implement it in this month

Στις Τρί 15 Νοε 2022 στις 5:00 μ.μ., ο/η m1dnightc0der < @.***> έγραψε:

It does not see that the existing binanace (xchange-binance) only support the spot api's (api/v3) rather than the margin (/sapi/v1/margin) and futures (/fapi/v1/). I would like to implement the additional margin and futures support, and wondered if there was any guidence on how to do this, i.e. as a new exhcange within xchange-binance or via some flag using the exsitng exchange.

— Reply to this email directly, view it on GitHub https://github.com/knowm/XChange/issues/4612, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHIWQ756X7NS2TQWLHDWIBDWIOQPFANCNFSM6AAAAAASBBDAHU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

m1dnightc0der commented 1 year ago

@makarid great news, want to collobrate on a branch? i will probably need the margin part next week, so happy to work on that. Think doing it with all the same exchange settings and adding the methods to the existing org.knowm.xchange.binance.BinanceAuthenticated and then routing to them using a combination of order flags and instrument type (i.e. perp/futs)

makarid commented 1 year ago

Great idea. I was thinking to create a separate exchange for futures but the way Binance has built their API doesn't help that approach. I like your idea better, I am starting with futures endpoints first and then I will go to the coin margined. So I guess we will create orderFlags in order to distinguish which endpoints to call when trading, WalletFeature when we call account endpoints. What about the market data endpoints?

On Wed, Nov 16, 2022, 10:58 AM m1dnightc0der @.***> wrote:

@makarid https://github.com/makarid great news, want to collobrate on a branch, i will probably need the margin part next week, so happy to work on that. Think doing it with all the same exchange settings and adding the methods to the existing org.knowm.xchange.binance.BinanceAuthenticated and then routing to them using a combination of order flags and instrument type (i.e. perp/futs)

— Reply to this email directly, view it on GitHub https://github.com/knowm/XChange/issues/4612#issuecomment-1316630995, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHIWQ77ZU6TQPNB6MIHZZO3WISO2DANCNFSM6AAAAAASBBDAHU . You are receiving this because you were mentioned.Message ID: @.***>

makarid commented 1 year ago

I guess we can use the Instrument class and check if the Instrument is CurrencyPair or FutureContract.

makarid commented 1 year ago

@m1dnightc0der will you do the margin part and i will do the futures part (USDT and CoinMargined one)? What do you think?

m1dnightc0der commented 1 year ago

sorry totally missed, this, will work on margin this week. let me know if you have a branch, will work from that

makarid commented 1 year ago

Hello @m1dnightc0der , the Binance Futures support has already been added to develop branch so, you can start from there.