GithubHelp home page GithubHelp logo

tpmmthomas / binance-copy-trade-bot Goto Github PK

View Code? Open in Web Editor NEW
95.0 11.0 39.0 81 KB

A telegram copy trading bot that follows cryptocurrency derivatives trade on the binance leaderboard.

Home Page: https://forms.gle/98SpxWP7BgjCbxe47

Python 100.00%
copy-trade cryptocurrency python telegram-bot trading binance bybit derivatives

binance-copy-trade-bot's Introduction

binance-copy-trade-bot (Updated Feb 2024)

Important

The bot is now rebranded to TraderCloneX, and is available as a service so that you do not need to run the server on your own!!! You could make use our hosted telegram server and make trades directly without worrying about technical details. Please make a registration here: https://forms.gle/98SpxWP7BgjCbxe47. We will provide you with detailed instructions on how to onboard the service soon. Ask any questions in the discussion tab.

Running the bot on your own

This program uses web scraping to monitor the positions opened by traders sharing their positions on Binance Futures Leaderboard. We then mimic the trade in your account using the Bybit api. MongoDB is the database used in this software. Bot updated and working (Feb 2024)

Environment setup (Recommended)

Using Conda

At your target directory, execute the following:

conda create -n trading python=3.9 -y
conda activate trading
git clone https://github.com/tpmmthomas/binance-copy-trade-bot.git
cd binance-copy-trade-bot
pip install -r requirements.txt

Database Setup

Follow the instructions in https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/ to set up MongoDB on the same host where the program is run.
Follow https://www.digitalocean.com/community/tutorials/how-to-secure-mongodb-on-ubuntu-20-04 to set up username and password.

Software setup

  1. Setup a telegram bot using Botfather (details on telegram official site) and mark the access token.
  2. Setup a discord channel for urgent/alert messages, and get a webhook url. (Reason is to avoid mixing them into the telegram channel and missing out on them.)
  3. Fill in the required fields in app/data/credentials.py
  4. Run python -m app.ct_main and python -m app.tgb_main. It is suggested to set both up as a systemctl service, with restart=always and a MaxRunTime so that the program is automatically restarted from time to time.
  5. Call /addcookie to add credentials required for api end-points every 2-3 days. I will not teach you how to do so here, but you can find the information on the internet.

Using the software

After the python programs are up and running, go to your telegram bot and type /start, then follow the instructions.
It should be rather straightforward but if you encounter any uncertainties, please report it to me by raising an issue.
Refer to the file telegram-commands.txt for a list of commands you can use.
I personally suggest you go to the binance leaderboard, pick a longer timespan (e.g. monthly or all-time) and choose the top traders sharing their positions.

Disclaimer

  • Users are solely responsible for their own trading decisions and the management of their accounts. TraderCloneX is not a financial advisor, and any information provided by the bot should not be taken as financial advice. Users should conduct their own due diligence and consider seeking advice from an independent financial advisor.
  • TraderCloneX does not accept any liability for loss or damage as a result of reliance on the information contained within this bot. Please be fully informed regarding the risks and costs associated with trading the financial markets. While we strive to ensure our service is both fast and reliable, TraderCloneX cannot guarantee the uptime or data accuracy of the service. Access to the bot during the launch phase is limited to users who sign up using our Bybit referral link, and this condition may be subject to change in the future.
  • By using TraderCloneX, you acknowledge and agree that you have read, understood, and accept the full terms of this disclaimer. You agree that all use of the TraderCloneX service is at your own risk, and you are fully responsible for any resulting profits or losses.
  • Remember that trading can lead to losses that exceed initial investments. Therefore, you should not trade with capital that you cannot afford to lose. If you have any doubts, it is advisable to seek advice from an independent financial advisor.

Buy Me A Coffee

Donations are welcome at the following addresses (updated Feb 2024):
BTC: bc1qyacynkmdctszja7zjzw2da50jv8wcltcxxz995
ETH / ERC20 tokens in general: 0xcF7D346C0A139DDaE79aed9e9a09bef0D61d1509

binance-copy-trade-bot's People

Contributors

diiak avatar tpmmthomas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

binance-copy-trade-bot's Issues

Issue with the proportion parameter

Hey there,
Thanks for your work on it bot.
I have tried successfully the follow/alert part, and I am now trying out the copy trading feature.
I have a question regarding the "proportion" parameter which is a bit unclear to me on how it works to define de size of the position, it would be great if you could provide an example.
Also, the commands to update this parameter (/updateall and /updateproportion) doesn't seem to be implemented in the code of the bot, so I'm not sure how to make it work?
Thanks for you help!

code problem with mongodb

hi bro
I have an error while doing the step 4 Run python -m app.ct_main
I dont know how to Fill in the required fields in app/data/credentials.py such as
auth_code = "" # set it yourself where do i have the authentification code?
admin_code = "" # set it yourself where do i have the admin code?
ip = "" where do i have the ip?

C:\Users\SIDIBE\Desktop\BOT\binance-copy-trade-bot>python -m app.ct_main
2024-03-02 16:54:04,164 - app.copy_trade_backend.ct_globals - INFO - mongodb://Admin:123456@localhost:27017/
db path is mongodb://Admin:123456@localhost:27017/
2024-03-02 16:54:04,183 - main - INFO - The copy trade program has started running.
Exception in thread pymongo_server_monitor_thread:
Traceback (most recent call last):
File "C:\Users\SIDIBE\miniconda3\Lib\threading.py", line 1073, in _bootstrap_inner
self.run()
File "C:\Users\SIDIBE\miniconda3\Lib\threading.py", line 1010, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\SIDIBE\miniconda3\Lib\site-packages\pymongo\periodic_executor.py", line 133, in _run
if not self._target():
^^^^^^^^^^^^^^
File "C:\Users\SIDIBE\miniconda3\Lib\site-packages\pymongo\monitor.py", line 61, in target
monitor._run() # type:ignore[attr-defined]
^^^^^^^^^^^^^^
File "C:\Users\SIDIBE\miniconda3\Lib\site-packages\pymongo\monitor.py", line 213, in _run
self._start_rtt_monitor()
File "C:\Users\SIDIBE\miniconda3\Lib\site-packages\pymongo\monitor.py", line 167, in _start_rtt_monitor
self._rtt_monitor.open()
File "C:\Users\SIDIBE\miniconda3\Lib\site-packages\pymongo\monitor.py", line 87, in open
self._executor.open()
File "C:\Users\SIDIBE\miniconda3\Lib\site-packages\pymongo\periodic_executor.py", line 95, in open
thread.start()
File "C:\Users\SIDIBE\miniconda3\Lib\threading.py", line 992, in start
_start_new_thread(self._bootstrap, ())
RuntimeError: can't create new thread at interpreter shutdown
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Users\SIDIBE\miniconda3\Lib\threading.py", line 1073, in _bootstrap_inner
self.run()
File "C:\Users\SIDIBE\Desktop\BOT\binance-copy-trade-bot\app\copy_trade_backend\ct_position.py", line 521, in run
urls = self.userdb.retrieve_traders()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\SIDIBE\Desktop\BOT\binance-copy-trade-bot\app\copy_trade_backend\ct_db.py", line 101, in retrieve_traders
for x in self.tradertable.find():
File "C:\Users\SIDIBE\miniconda3\Lib\site-packages\pymongo\cursor.py", line 1264, in next
if len(self.__data) or self._refresh():
^^^^^^^^^^^^^^^
File "C:\Users\SIDIBE\miniconda3\Lib\site-packages\pymongo\cursor.py", line 1181, in _refresh
self.__send_message(q)
File "C:\Users\SIDIBE\miniconda3\Lib\site-packages\pymongo\cursor.py", line 1060, in __send_message
response = client._run_operation(
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\SIDIBE\miniconda3\Lib\site-packages\pymongo_csot.py", line 107, in csot_wrapper
return func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\SIDIBE\miniconda3\Lib\site-packages\pymongo\mongo_client.py", line 1394, in _run_operation
return self._retryable_read(
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\SIDIBE\miniconda3\Lib\site-packages\pymongo\mongo_client.py", line 1492, in _retryable_read
return self._retry_internal(
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\SIDIBE\miniconda3\Lib\site-packages\pymongo_csot.py", line 107, in csot_wrapper
return func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\SIDIBE\miniconda3\Lib\site-packages\pymongo\mongo_client.py", line 1462, in _retry_internal
).run()
^^^^^
File "C:\Users\SIDIBE\miniconda3\Lib\site-packages\pymongo\mongo_client.py", line 2315, in run
return self._read() if self._is_read else self._write()
^^^^^^^^^^^^
File "C:\Users\SIDIBE\miniconda3\Lib\site-packages\pymongo\mongo_client.py", line 2437, in _read
self._server = self._get_server()
^^^^^^^^^^^^^^^^^^
File "C:\Users\SIDIBE\miniconda3\Lib\site-packages\pymongo\mongo_client.py", line 2400, in _get_server
return self._client._select_server(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\SIDIBE\miniconda3\Lib\site-packages\pymongo\mongo_client.py", line 1292, in _select_server
topology = self._get_topology()
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\SIDIBE\miniconda3\Lib\site-packages\pymongo\mongo_client.py", line 1238, in _get_topology
self._topology.open()
File "C:\Users\SIDIBE\miniconda3\Lib\site-packages\pymongo\topology.py", line 201, in open
self._ensure_opened()
File "C:\Users\SIDIBE\miniconda3\Lib\site-packages\pymongo\topology.py", line 652, in _ensure_opened
server.open()
File "C:\Users\SIDIBE\miniconda3\Lib\site-packages\pymongo\server.py", line 70, in open
self._monitor.open()
File "C:\Users\SIDIBE\miniconda3\Lib\site-packages\pymongo\monitor.py", line 87, in open
self._executor.open()
File "C:\Users\SIDIBE\miniconda3\Lib\site-packages\pymongo\periodic_executor.py", line 95, in open
thread.start()
File "C:\Users\SIDIBE\miniconda3\Lib\threading.py", line 992, in start
_start_new_thread(self._bootstrap, ())
RuntimeError: can't create new thread at interpreter shutdown

thank you

cannot fetch url after some minutes running

What ever trader i use i get
2023-04-14 16:25:56,513 - app.copy_trade_backend.ct_position - ERROR - yugoviking cannot fetch url
2023-04-14 16:25:57,014 - app.copy_trade_backend.ct_position - ERROR - TreeOfAlpha1 cannot fetch url
2023-04-14 16:25:57,526 - app.copy_trade_backend.ct_position - ERROR - yugoviking cannot fetch url
2023-04-14 16:25:58,019 - app.copy_trade_backend.ct_position - ERROR - TreeOfAlpha1 cannot fetch url
2023-04-14 16:25:58,527 - app.copy_trade_backend.ct_position - ERROR - yugoviking cannot fetch url
2023-04-14 16:25:59,019 - app.copy_trade_backend.ct_position - ERROR - TreeOfAlpha1 cannot fetch url
2023-04-14 16:25:59,513 - app.copy_trade_backend.ct_position - ERROR - yugoviking cannot fetch url
2023-04-14 16:26:00,011 - app.copy_trade_backend.ct_position - ERROR - TreeOfAlpha1 cannot fetch url
2023-04-14 16:26:00,503 - app.copy_trade_backend.ct_position - ERROR - yugoviking cannot fetch url
2023-04-14 16:26:01,000 - app.copy_trade_backend.ct_position - ERROR - TreeOfAlpha1 cannot fetch url
2023-04-14 16:26:01,501 - app.copy_trade_backend.ct_position - ERROR - yugoviking cannot fetch url

Newest version.Bybit

could someone help me set up this bad boy?

Hey, I'm not a very good programmer as I'm fairly new to Python. Could someone help me set up this bot so I could get it running. I don't know what to do lol. Please contact me via discord: sombody#1319

thanks!

Porject progress here

I would like to contribute to this project by implementing the Binance Futures API (available in my country). This would allow other users to benefit from it.

If you agree, can you give me a way to contact you in case of questions?

Looking forward to hearing from you before I start!

Rendering of trader position list

Hello,

Thank you for your work and for sharing it.

Could you consider changing the shape of a trader's positions.
I find that the table lacks clarity, for example on my capture, we do not know what the trader's new position is.

Capture d’écran 2022-11-17 à 16 26 12

Maybe we could orient ourselves on the model of the other screenshot

Capture d’écran 2022-11-16 à 22 55 20

Thanks

Percentage of user balance ?

Hi Thomas !

First of all, thank you for your great work. Is there already a way to set a percentage of user balance to use for trades instead of /setallproportions ?

Setallproportions seems to be like a percentage of the original trade, for example 1% of proportion means 0.01 ETH to trade is the original trader trades 1 ETH ?

Thank you for your answer and have a nice day

How to easily perform copy trading for a beginner?

Hello, I am new to programming. I would like to be able to run your script easily. Is it possible or do I need to have better knowledge? I see several files and I don't know which one to run for copy trading. Are they all nested together? When I go to Visual Sutdio Code and run a random file they tell me that the "app" module is missing. I already have my Bybit API keys but I don't know where to enter them. I installed all required extensions. Thank you in advance for a possible comprehensive answer :)

Binance API

I compared your old and new code from your repo.

I see you where having binance in. Then you removed, and refactored the code.

Do you know what would be the easiest way to use this bot on binance? Use the old as it or integrate binance in the new?

I made the whole selenium and telegram part myself in a week from scratch, then I was wandering for the binance api and I saw your code which is EXACTLY what I need.

Can you help me ?

Hello excuse me to disturb you, I am new to this field and I have been trying to set up this robot for 2 days now. Unfortunately I am stuck on these data to enter:
auth_code = "" # set it yourself
admin_code = "" # set it yourself
Where can I find this?

What should I exactly fill out in credentials

bot_token = "I understand this part"
auth_code = "" # set it yourself
admin_code = "" # set it yourself
ip = ""
db_user = ""
db_pw = ""

I installed mongo and everything set up but what exactly I am putting here ?

Operation of the safety ratio

Hello,

Thanks again for your work.

Can you explain to me what the safety ratio means?

Does it block the transaction when the initial amount of the transaction is greater than the determined ratio of the balance (Example with a ratio of 0.5 if I have $10000 and the order is 5001 it will block?

Thanks

ConnectionResetError in RUN inside ct_positions

ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

after 10-14h running i get this one and already tried:

  • do headers to post < FAIL
  • do a random pagination inside post method to prevent cache < FAIL (with this one it runs for 2 days before kick me out with 10054)

Anyone has this problem too and know what to do to solve it?

what is ip?

In the credential file, in "ip" field what i put ?

I am facing a error

I tried everything but I am facing this error

(trading) soumyadebnath16@Soumyas-MacBook-Air Bybit % python -m app.tgb_main
Traceback (most recent call last):
File "/Users/soumyadebnath16/Developer/anaconda3/envs/trading/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Users/soumyadebnath16/Developer/anaconda3/envs/trading/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/soumyadebnath16/binance-copy-trade-bot/Bybit/app/tgb_main.py", line 2, in
from app.telegram_frontend.tgb_db import dbOperations
File "/Users/soumyadebnath16/binance-copy-trade-bot/Bybit/app/telegram_frontend/tgb_db.py", line 5, in
from pybit.usdt_perpetual import HTTP
ModuleNotFoundError: No module named 'pybit.usdt_perpetual'
(trading) soumyadebnath16@Soumyas-MacBook-Air Bybit %

ERROR - The number of contracts exceeds maximum limit allowed: too large (ErrCode: 130006)

I tried to understand why one trade that should have been placed didn't, and I found this error in my syslog:
ERROR - The number of contracts exceeds maximum limit allowed: too large (ErrCode: 130006)

Pretty self explanatory, but I wonder if the script could be adjusted to split the order into sub-orders taking into account the maximum contracts limit?
Or at least take the maximum contract limit for the number of contracts for the trade.

Thanks!

Bybit Testnet

Hello,

thank you for your work on this project. Is it possible to connect to Bybit testnet API ? I see some commented line with test in your code, but I guess it will not work. When I change my API URL to https://api-testnet.bybit.com it's not working. Or is there any other way how to backtest/test it first?

Thanks.

Mis en route avec succès !

Hello, thank you for your previous answer! I successfully launched the bot.
The configuration with the Bybit APIs and the trader is going well. On the other hand I would like to add an additional Binance trader to my list but I have not succeeded so far and some commands do not work.

Small question regarding the /view command: the bot shows the trader's current position and then shows the time of the last position update. The last update was yesterday according to the bot but when you go to the trader's profile the position and the earnings are different.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.