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

Futures support #106

Closed
andreimerfu opened this issue Mar 13, 2022 · 7 comments
Closed

Futures support #106

andreimerfu opened this issue Mar 13, 2022 · 7 comments

Comments

@andreimerfu
Copy link
Contributor

Do you have any plan to add support for Binance futures in the near future? Thanks!

@rodrigo-brito
Copy link
Owner

Hi @andreimerfu, I am planning to support Binance Futures. But this will take a while. I'm working alone on the project.

@andreimerfu
Copy link
Contributor Author

Let me know how I can help with this feature. I'm not sure how do you want to include this feature in the current codebase. I'm wondering how we can change the Balance struct by using terms like Wallet Balance, Margin Balance, and Unrealized PNL without damaging the SPOT market. Also, I'm not sure where we'll introduce the leverage details for each asset.

Any feedback, ideas from your side will be helpful. Thanks! 🙇🏻

@rodrigo-brito
Copy link
Owner

I do not have any idea yet. The logic is more complex for Futures Market.
Maybe we can split in different brokers. Split the wallets and exchanges into two different kinds.
The backtesting is more complex too. The project needs a big refactoring for this feature.

@rodrigo-brito
Copy link
Owner

@andreimerfu we can create a new branch to explore some ideias, what you think?

@rodrigo-brito
Copy link
Owner

Currently, this is the structure of the bot
image

We can use all the structure of Data Feeds, Order Feeds, Plugins and Storage.

We have to modify controllers and exchange modules. The exchange is an interface composed by two parts

  • Broker - Execute operations (buy, sell, stop, etc)
  • Feeder - Deal with data, candles, etc.

When we are in a backtesting, we use Broker = Paperwallet, Feeder = CSV Feeder
When we are in a simulation with live data, we use Broker = Paperwallet, Feeder = Binance
When we are in production environment, we user Broker = Binance, Feeder = Binance

Theses abstractions helps to create different scenarios.

All the orders and candles are transmitted with pub-sub pattern in "feeds". For exemple, the chart moduele receives candles and orders, then it requires a subscription in OrderFeed and DataFeed.

The concept is simple, but we have a big issue with the leverage token and isolation of wallets.

@rodrigo-brito
Copy link
Owner

rodrigo-brito commented Jul 28, 2022

Now we have a testnet for futures market, it will be great in the module implementation: https://testnet.binancefuture.com/en/futures/BTCUSDT

@rodrigo-brito
Copy link
Owner

rodrigo-brito commented Mar 14, 2023

Initial support available

binance, err := exchange.NewBinanceFuture(ctx,
	exchange.WithBinanceFutureCredentials(cfg.BinanceKey, cfg.BinanceSecret),
)

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

No branches or pull requests

2 participants