Crypto-Copy-Trader icon indicating copy to clipboard operation
Crypto-Copy-Trader copied to clipboard

Binance Futures Support and getting started guide

Open lucky-ali opened this issue 3 years ago • 8 comments

Does this have binance futures support and do you have steps on how to get started?

lucky-ali avatar Jul 13 '20 11:07 lucky-ali

No, now there is no support for Binance Futeres. But it would be nice if it were. Now I am working on supporting Bitmex in my fork. If the @MohammedRashad creates a develop branch, I will make a pool request there and you can see the code.

mokolotron avatar Jul 14 '20 07:07 mokolotron

Guide

How to run :

  • rename config-sample.json to config.json and fill key and secret in this file.
  • in directory project run : python api.py
  • open http://0.0.0.0:5000/ or http://127.0.0.1:5000/
  • click run button

Guide of config.json file:

  • name is custom string
  • exchange_name: must coincide with file name in EchangeInterfaces dir.
  • settings: for future settings and modes

Don't run this program with BitmexExchange it not finished yet and don't working.

To create new exchange

you need to create new class BinanceFuteres.py in ExchangeInterfaces directory and inherit it from ExchangeInterfaces/Exchange.py. Then you must implement all abstract methods from super class.

Short guide of Exchange methods:

  • process_event() : these methods using when instance of class in master role. Its called as callback and runs when from web socket came subscribable event. This method must return object of action in generic type. For example:
return {
'action': 'new_order', # name of action which checks by SlaveContainer.on_event_handler()
'order': order, # its instance of class Order in Helpers.py.
'exchange': self.exchange_name,
'original_event': event
} 

when mesage from websocket mean "copy this order". If don't need make any actions the function should return None Actions object must be in generic look for all exchange to copy order from one exchange to other. If you know better way to create actions you can tell its, and we will implement it.

  • get_open_orers(): make request to exchange to get open orders or get its from websocket. return the list of Order instances.
  • isMargin : True if short endable for this exchange
  • get_part() : calculate wich part of balance is order. For example when you create order on 50% function must return 0.5.
  • calc_quantity_from_part(): this function used in slave role and calculate the amount of order.
  • on_order_handler(), on_cancel_handler() make need actions to manipulate orders in slave exchanges. The BinanceExchange.py working, you can use it as example

If you have questions or troubles let us know.

mokolotron avatar Jul 14 '20 09:07 mokolotron

Appreciate it. I'll try to run through and see how i get on with it.

lucky-ali avatar Jul 15 '20 11:07 lucky-ali

I was unable to find the config-sample.json file. Was able to find the config.csv file. (also there was no where to select binance exchange)

I started the application using python api.py

browsed to localhost:5000 and saw some pre-existing api keys added, removed them and added my API keys (a master account, and a slave account)

I placed an order on the master account which was filled and executed on the master account, however the same was not done on the slave account.

I got no error on the website when i refresed the page and also no errors or logs regarding the order on the commandprompt window.

How can i provide the relevant information to find out what the issue is?

lucky-ali avatar Jul 20 '20 22:07 lucky-ali

I wrote this guide for the develop branch version. If you don't find config-sample.json - you are using the master branch. I am working on adding another exchange, so i changed a lot of things . Version on the master branch, only Binance Spot orders are supported.

To solve the problem just open a new Issue and

  • copy the logs from the terminal there
  • tell us which trading symbol you used
  • what type of order did you use

Then I'll see what I can do

mokolotron avatar Jul 21 '20 08:07 mokolotron

Do we have an ETA when Binance futures will be implemented, really need it since i only trade futures.

lucky-ali avatar Aug 04 '20 18:08 lucky-ali

I don't have

mokolotron avatar Aug 05 '20 06:08 mokolotron

I also really want to Binance future copy trader If anybody knows what socket function can be used for future trade, please let me know.

topcoder20022 avatar Jan 14 '22 01:01 topcoder20022