Cryptocurrency Trading Bot which is buying 🚀 Coins using Python and Binance

Поделиться
HTML-код
  • Опубликовано: 9 июн 2024
  • Disclaimer: This video is not an investment advice and in specific not a recommendation to trade this strategy. It is simply a transformation from a trading idea to code.
    Please subscribe if you find these kind of topics interesting.
    Get the Notebook/Source code by becoming a Tier-2 Channel member:
    / algovibes
    To delete the cronjob use crontab -r
    Delete the DataBase after every session or extend the script deleting records after some time.
    Prerequisites:
    Fundamental video (createframe function etc.):
    • How To Build a Simple ...
    Stream Crypto Prices using Binance Socket Manager:
    • How to get LIVE crypto...
    Intersection of Pandas & SQL:
    • Pandas Dataframes and ...
    Cronjobs:
    • Schedule Python script...
    Cumulating returns:
    • How To Calculate Stock...
    Python Binance Docs (Binance Socket Manager as well as multiplex socket):
    python-binance.readthedocs.io...
    Besides that be kindly invited to check out my Cryptobot Playlist. Also Python for Finance could be interesting for you.
    00:00 - 01:20 Introduction/Disclaimer
    01:20 - 07:15 1. Script: Necessary data manipulations
    07:15 - 10:28 1. Script: Multiple Livestream to SQL DB
    10:28 - 12:15 1. Script: Accessing the Livedata
    12:15 - 13:32 2. Script: Explanation of needed libaries/setup
    13:32 - 18:09 2. Script: Pulling prices of last n minutes
    18:09 - 20:20 2. Script: Return calculation / get the top coin
    20:20 - 25:30 2. Script: Investment/flexible Quantity calculation
    25:30 - 28:15 2. Script: Buying Condition/Buyprice/createframe
    28:15 - 29:00 2. Script: Livestream of the bought asset
    29:00 - 29:11 Careful with this SL limit! Please listen to the last chapter!
    29:11 - 30:03 2. Script: Livestream of the bought asset (target profit)
    30:03 - 31:12 Deployment: Download as raw .py file and renaming
    31:12 - 32:23 Deployment: Creating a cronjob
    32:23 - 33:20 First trade
    33:20 - 34:20 Output file
    34:20 - 36:21 IMPORTANT! Please listen / Trades
    #Python #Tradingbot #Crypto #Binance

Комментарии • 208

  • @Tim7421
    @Tim7421 2 года назад +1

    Danke für die Videos, finde es sehr interessant. Habe bisher mit BOTS nicht am Hut gehabt. Ist das ganze denn generell rentabel oder machst du das zum größten Teil aus der Freud zum programmieren heraus?

  • @KentokyG
    @KentokyG 2 года назад +6

    you are insane, nearly every week you upload high quality vids, thanks a lot for sharing your experience with us!

    • @Algovibes
      @Algovibes  2 года назад +1

      Thanks for watching my stuff buddy. Appreciate your kind words.

  • @connormac98
    @connormac98 2 года назад +1

    I don’t know how you do it but you always seem to have the exact video I’m looking for, good stuff!!

    • @Algovibes
      @Algovibes  2 года назад

      Nice :D That's awesome to hear.

  • @farhan6516
    @farhan6516 2 года назад +2

    thanks bro. waiting for your next video.

  • @erwinwimmer2456
    @erwinwimmer2456 2 года назад +1

    Wie immer großartig! Danke :)

  • @kennithsmit2356
    @kennithsmit2356 Год назад +1

    😀😀Great content as always.
    You make it look so easy

    • @Algovibes
      @Algovibes  Год назад

      Thanks mate!
      I am trying my best to explain the concepts as simple as possible.

  • @federicogomezmonroy7339
    @federicogomezmonroy7339 2 года назад +2

    thank you so much for share your knowledge with us! it's so helpfull for start building ours first bots.
    Thanks againg!
    Greetings from Argentina.

    • @Algovibes
      @Algovibes  2 года назад

      Thank you man. Greetings back to 🇦🇷!

  • @user-px6gh2fz5l
    @user-px6gh2fz5l 2 года назад +1

    Thank you very much for sharing us your code I am leaning a lot from your grate video's. I have couple of questions regarding the scripts. 1. Why do I have to use task scheduler to run the script? I am using Pycharm as python editor can I run it directly from the editor? 2. The first script deal with storing price data into sqlite database do I need to be concern about data size incase I let it run for long period of time ? Thanks,

  • @Slay3rOne
    @Slay3rOne 2 года назад +11

    I see you applied the idea of a separate database to store data and access it with a separate bot script. That's great, that was very interesting! You try new ideas and post new videos at an insane pace, haha! Keep up the great work man. Watching your various approaches got me into trying to code a bot myself too, seemed like a fun project to spend time on, and experiment a bit with the APIs.
    My own approach was much more "brut force" so to speak:
    - On the cache script I subscribed to the live kline data for each market, and then pulled the history from the exchange for each market one at a time. That script does not run on my PC but on a separate server, and stays up 24/7, reconnecting in case of connexion loss.
    - On the bot itself, I subscribed to the live trades data for each market to get the fastest updates possible, though that's a huge lot of data as there are currently a bit less than 500 markets all receiving live trades, but that's fine. At the start of the bot, I retrieve the entire history from the cache (keep it in ram), and then I build the klines locally from the live trades and append it to the local history. Each time the price changes for any market, I compute the indicators (like, % change, EMA, MACD, RSI, StochRSI). I also can open a mplfinance live plot window for the market currently invested in.
    I'm not done yet, so I don't know how it will perform trading live. But everything works fine so far and all the data is there!

    • @wickedgummybear3104
      @wickedgummybear3104 2 года назад +1

      Sounds very interesting. Very curious how it will perform once you are going live. You already tested some strategies?

    • @Slay3rOne
      @Slay3rOne 2 года назад +1

      @@wickedgummybear3104 Not at all, not yet.

    • @Algovibes
      @Algovibes  2 года назад +1

      Thank you very much for sharing! That sounds very interesting and I would be curious about the outcome as well!

    • @V0kai
      @V0kai 2 года назад

      I'm doing something like this, without the cache trick (nice move!) If you want we can talk about :)

    • @mmatips5867
      @mmatips5867 Год назад

      do you happen to have a github where we can check it out?

  • @karlis6235
    @karlis6235 2 года назад +2

    I have been trying to figure out how to do this for a week now before I found this video, danke!

    • @Algovibes
      @Algovibes  2 года назад

      Happy to hear that. Bitte :-)

  • @WallePink
    @WallePink 2 года назад +1

    You are the BOOOOSSSSS !!! thanks a lot for sharing your knowledge, one question .... is it possible to add a filter for volume ?
    keep it up !!! :)

    • @Algovibes
      @Algovibes  2 года назад +1

      Thanks a lot mate :-)
      Gonna include volume in one of my future videos.

  • @matttatten7791
    @matttatten7791 Год назад +1

    Hi @Algovibes.
    Great video! I have been following your videos for a while now. With this video, is there a way to add technical indicators such as moving average or k% & d%? I have tried def apply indicators, but have had no success. Any ideas would be great.

    • @Algovibes
      @Algovibes  Год назад

      Hi Matt,
      yes and I have already played around with that in some of my cryptobot videos. Be invited to explore the cryptobot playlist.
      If you don't find anything please let me know and I'll give you a helping hand!

  • @refaamoe
    @refaamoe 2 года назад +1

    King much love from 🇸🇪

  • @charleskorn8644
    @charleskorn8644 2 года назад +3

    Nice video👍 Sir, it inspired me to try to make a bot of my own. respect

    • @Algovibes
      @Algovibes  2 года назад +1

      Awesome. Thanks a lot for your comment. Ofc trade on your own risk and test the strategies beforehand!

  • @yoursandeep
    @yoursandeep 2 года назад +2

    for some assets where the minQty is 1 ( with no decimals ) len gives wrong result rather I use precision = int(round(-math.log(minQty, 10), 0))

  • @aljoharaalsalem8334
    @aljoharaalsalem8334 Год назад +1

    Thank you so much for providing these high quality videos! I would like to ask a question regarding the live data, would it be possible to get the data in a 5 minutes time frame rather than the current ms time frame? If yes, would you please be kind enough to let me know how?🙏🏽

    • @Algovibes
      @Algovibes  Год назад

      Welcome mate! Thanks for watching :-)
      I have covered all kind of time frames in my cryptobot playlist. Be kindly invited to check that out!

  • @alfredart6822
    @alfredart6822 2 года назад +6

    Brilliant once more. Thank you.
    It would be interesting to thoroughly test the RSI, stoic, MACD, but adding the EMA 200 to make it more fail proof.
    I have also read about the MTF EMA, where one line is 15 minutes 50, the second line is 60 minutes 50 being a good indicator too.
    Some times, the EMA 200 and EMA 50 act as point of resistance/support, which could actually work as an advantage of predictability.
    Also I have noticed that using the top_symbol is not the most valuable asset. Once it becomes the top, it's because It has gone through the burning period and it has, most of the time little to offer.
    I am currently observing for signs of a better way of selecting a coin.
    If I could code python, this would be my project to perfect.
    Looking forward to your next video.

    • @Algovibes
      @Algovibes  2 года назад

      Thanks Alfred for sharing your thoughts and also your suggestion. Appreciate it!

  • @fraselleeric
    @fraselleeric 2 года назад +2

    Great video as usual. I found another way to calculate the buy_quantity (@24:59)
    buy_quantity = round(investment_amt/Lotsize) * Lotsize

  • @chapmansbg
    @chapmansbg 2 года назад +2

    Does calling the .client each time increase your query weight? What is the max weight with a multiplex socket?

    • @Algovibes
      @Algovibes  2 года назад

      Can you elaborate on max weight with a multiplex socket? It is not an API call. But regarding the client call: As we are not pulling anything my guess is: No.
      I had no errors running it some days in a row.

  • @yalcn9092
    @yalcn9092 2 года назад +4

    Can we do something here like buying currency pairs with 4 and 1 hour and 15 minute RSI values below 30 or 35 instead of the minute best values? We can add a possible 3-5 percent drop. Is it possible to write such a bot?
    By the way, thank you for everything. You use a very descriptive and easy-to-understand style, I wish you continued success.

    • @Algovibes
      @Algovibes  2 года назад +1

      Definitely possible! I have noted that but can't promise anything. But that would be interesting as well!

  • @yuan-teliao9389
    @yuan-teliao9389 2 года назад +1

    Hi! very inspiring video!
    Can you help to answer that how can I set a time sleep like 1sec to make sure a constraint my data point density(granularity)?

    • @Algovibes
      @Algovibes  2 года назад +1

      Thanks a lot man. Can you elaborate? In the best case give a timestamp where you want to put in a sleep function.

  • @johnnyagosto
    @johnnyagosto 2 года назад +1

    Hi, thanks for the videos! Really useful!
    I have a question: I'm Getting "RuntimeError: Event loop stopped before Future completed." This error appears after the first loop. Do you know why?

    • @Algovibes
      @Algovibes  2 года назад

      Thanks a lot for your comment.
      Seems to be in relation with Python 3.10.

  • @pbelfio
    @pbelfio 2 года назад +1

    Hi, grat job and thanks for sharing! Do you think it is possible to test the bot on historical data to check how it would have performed on that selected period of time? It could be useful to avoid big mistake (!) or to test different buy/sell criteria even if, of course, it will not guarantee the same performance on the future data!

    • @Algovibes
      @Algovibes  2 года назад +1

      Yes, that's absolutely possible. I am considering some backtesting in future videos!

  • @deananderson8186
    @deananderson8186 2 года назад +4

    I was wondering if you'd ever do a video over decision trees? I was thinking how they might be used to create a strategy based on some indicators. Maybe if given some data at a period in time it could decide to buy, sell, or do nothing, it would be better than us simply writing some buy and sell rules. Would like to see what you could do with some decision tree derived strategy

    • @Algovibes
      @Algovibes  2 года назад +2

      I will and I privately already played around with it! But I guess I will cover it rather beginning of next year than in this one. Anyhow thanks a lot for the suggestion.

    • @al-aminibrahim1394
      @al-aminibrahim1394 2 года назад

      Wowww this is nice idea. I will try it and see what will happen

  • @deananderson8186
    @deananderson8186 2 года назад +4

    very interesting! Unfortunate you didn’t strike gold with this method, sounded like an interesting idea. You could always backtest in order to get a better idea of how it would perform long term. I really liked this idea because if how simple it was. Makes me wonder what other things you could try to use as indicators for coins. Maybe volatility could play some roll in selecting, or maybe if its its like 3 day average is higher than its 3 month average. I might play around with some of these ideas!

    • @Algovibes
      @Algovibes  2 года назад +2

      Thanks for your feedback mate. That's the exact purpose of these videos! I think the potential which ideas you can implement are limitless. The only difficulty is transforming ideas into code. That's what I am here for :-P

    • @deananderson8186
      @deananderson8186 2 года назад +1

      @@Algovibes yeah Im pretty experienced in python, but not so much algorithmic trading with python, so now I have a new toy to play with!

  • @mohamednagy5179
    @mohamednagy5179 2 года назад +1

    very very helpful thank you

    • @Algovibes
      @Algovibes  2 года назад

      Thanks Mohamed, appreciate your comment.

  • @soskokojsj3740
    @soskokojsj3740 2 года назад +3

    thank you very much . the tuto is amazing !! please provide course of crossing of 2 ema with future trading and with take profite .

    • @Algovibes
      @Algovibes  2 года назад +1

      Thanks for your kind words and the suggestion man!

    • @soskokojsj3740
      @soskokojsj3740 2 года назад

      @@Algovibes Is it possible to do it in pyhton ? Since i searched in the net about taking profite after creat market buy in futures but i did'nt find much informations. If there are some tricks to do it please .don't hesitate to help since i'm stuck with that function and logic . I can even send the bot that buy and sell with the crossing but without profit :-(

  • @meloveinflation
    @meloveinflation 2 года назад +1

    Thanks

    • @Algovibes
      @Algovibes  2 года назад

      Thanks for watching man

  • @bhushan4966
    @bhushan4966 2 года назад +2

    Hey how do I get the info of huge orders .
    Like you can take the live price .

    • @Algovibes
      @Algovibes  2 года назад +1

      Hi, I am pretty sure there is not a stream for that but you can get the order_book / market_depth with an API call as far as I know.

  • @mikeejz
    @mikeejz 2 года назад +1

    Hey mate! Wondering why you did the product of the percentage change instead of the percentage change of the first and last of the range?

    • @mikeejz
      @mikeejz 2 года назад +1

      great vid btw! i used to always use kline pulls but i learned how to use streaming thanks to you

    • @Algovibes
      @Algovibes  2 года назад

      Hi mate, thanks for your comment. Also possible! Going more into details on how are returns calculated here:
      ruclips.net/video/fWHQwqT3lNY/видео.html

  • @yusufilkerozturk4715
    @yusufilkerozturk4715 2 года назад +1

    Thank you very much for the code and the idea. I am trying to do the same thing. I use 1min kline data, which updates current prices every 2 seconds.
    The code presented uses "3 min previous continuous trade data" as base for percentage calculation. Kline data can also be considered continuous (2 sec discrete, and a bit delayed, but ok ) you can identify candle close prices too. I have a question about the strategy. We are trying to catch rapid price increases early, so we can go along with, right? Earlier better but too early might trigger false alarm.
    - 1-2-3 minutes previous continuous data can be used as base for percentage of increase calculation.
    - 1-2-3 minutes ohlc candle close prices can be used.
    - 1-2-3 minutes previous continuous data min-max prices can be used to calculate pct and to open and to close trades.
    - Single price data or average of consecutive few price data (SMA) can be used as base or current price...
    Which one do you think better?

    • @Algovibes
      @Algovibes  2 года назад

      Hi man, thanks a lot for your comment. Yes you are right, that's the idea and you also identified the problem with that.
      Well I can't tell which one would be better without having tested that. But I am working on combining this strategy with a slightly longer time horizon and then check for crossovers.

  • @al-aminibrahim1394
    @al-aminibrahim1394 2 года назад +1

    Woww thanksss you maann

  • @russellgardner5500
    @russellgardner5500 2 года назад +1

    Thanks for the explanation, glad I stumbled upon this, I've come by articles and videos of people that grew a $100K to over $800K in just few months, what do you guys think they invested in and how can one outperform the market and make such profit

    • @Algovibes
      @Algovibes  2 года назад +1

      Well I personally would aim for realistic profits. These are far from any reality but in an irrational market like the crypto market probably achievable. Anyhow I would be cautious with those "stories". The people who are profiting big time will tell other people. People who are losing won't tell so there is a general bias one should be aware of.

  • @V0kai
    @V0kai 2 года назад +1

    Another nice video! But when you put trading script in crontab you have to remove the run_until_complete loop or you will have a new script every second and they all run together. Right?

    • @Algovibes
      @Algovibes  2 года назад +1

      Thanks mate. No, I wouldn't do that. I designed the script in a way that when we are invested the script will shut down before the async function will be triggered.

    • @V0kai
      @V0kai 2 года назад

      @@Algovibes Thanks for reply. I understood you use wallet balance to stop the script after selling. Another thing: when execute loop.stop() I get 'RuntimeError: Event loop stopped before Future completed' Is it the right way to stop after sell?

  • @daubersonmol
    @daubersonmol 2 года назад +1

    thank so much for one more video.
    but could you tell me how you can buy and sell the same quantity? when I bought some crypto I lose a little bit quantity because the taxes but you don't.

    • @Algovibes
      @Algovibes  2 года назад +1

      Thanks for watching mate. You just have to set the commission asset to BNB. You will pay less commission when doing that as an additional pro.

  • @parmenides2576
    @parmenides2576 2 года назад +1

    If I may make a request, can you do a video that listens to events for a certain token on bsc to see when big values of the token are traded? I am finding it very hard to do from scratch. Also FYI these videos for Binance do not work in the USA anymore as they now require KYC for the API key 😔

    • @Algovibes
      @Algovibes  2 года назад

      I had to to KYC as well (I am from Europe) so I guess its the new standard. I wanted to cover another API as well. BTW thanks a lot for your suggestion.

  • @cristigdv
    @cristigdv 2 года назад +1

    Hi
    at min 14:39 when im building the second script my list doesnt populate with any symbols, there is nothing in the sql database
    can you tell me why please?

    • @Algovibes
      @Algovibes  2 года назад

      Well, that could be a lot of reasons. Is the Database file created?

  • @reapeobrian
    @reapeobrian 2 года назад +1

    Sorry again, bro. I tried to make it run, first using it as an idea to something new, and after that I tried to make it exactly like you, and it didn't run.
    SQL alchemy don't create the DB, I made the same with sqlite3 and it creates the DB but it never feed it, and never got an error msg.
    It's driving me insane, because I want to learn, but I don't know what am I doing wrong.
    Could it be a failure because the python version?

    • @Algovibes
      @Algovibes  2 года назад

      Hi buddy, no worries man! Let me give you a perspective: These things will never change :D Just take it easy. It could be a lot of reasons and it is quite hard to identify what's causing the problem. Things I would check first: Is the livestream outputting any value at all (e.g. when printing out stuff)?

  • @jerrywang3225
    @jerrywang3225 Год назад +1

    Thanks so much for sharing your ideas. I tried to follow your code and build the same database, but the problem I have is that every time the database runs smoothly for a few minutes and then suddenly it just stopped writing new data to it. Do you know if there is any api request limit from binance or anything else could be wrong?

    • @Algovibes
      @Algovibes  Год назад

      Welcome Jerry! Thanks for watching my stuff. Well, could be a lot of reasons. First check I would do is, does the script really continuously writes data into the database (with a simple print).

    • @jerrywang3225
      @jerrywang3225 Год назад

      @@Algovibes I tried to print while writing data to the database, but seems no way to find what was the problem. I switched to store data to csv files instead and it turns out much more stable than the database. Thanks again for your work.

  • @franciscoronci
    @franciscoronci 2 года назад +1

    Sory mate, there is a video explaining how to run the script in the task scheduler??

    • @Algovibes
      @Algovibes  2 года назад +1

      Only covered on Linux and Mac until now using cronjobs.
      Did you check the cloud deployment vid? Might be helpful:
      ruclips.net/video/mDNIAkEZChg/видео.html

  • @allanfreitas6903
    @allanfreitas6903 2 года назад +4

    import math
    from decimal import Decimal
    buy_quantity = float(math.floor(investment_amt/(prize*Lotsize))*Decimal(str(Lotsize)))
    math.floor(investment_amt/(prize*Lotsize)): Integer number that is possible to buy
    Decimal(str(Lotsize)): Precision number of lotsize

    • @Algovibes
      @Algovibes  2 года назад +1

      Thanks a lot for sharing! Have to try it out but seems to be way better on first sight!

    • @thomastthai
      @thomastthai Год назад

      Concise formula! Well done!

  • @ivanvillegas6785
    @ivanvillegas6785 2 года назад +2

    Hi friend I love your videos, thanks for sharing your knowledge, I'm just starting to build my first projects and your content is like gold. 👏👏
    I have a problem when I try to sell some coin for the first time due to the trade commission, for example I buy 0.8 some pair and the commission is 0.0008 so my real qty bought is 0.7992, when I try sell my qty I don't have the full qty and gives me an error. How you do it to don't have this problem?

    • @Algovibes
      @Algovibes  2 года назад +1

      Hi man,
      thanks a lot for your kind words!
      You have to set your commission asset to BNB. With that you are getting lower fees and you are not running into that problem.

    • @ivanvillegas6785
      @ivanvillegas6785 2 года назад

      @@Algovibes Thanks man!

  • @reapeobrian
    @reapeobrian 2 года назад +1

    sorry, but i don't understand, how do you run both scripts? I have to run both at same time or just run the first and afther the second?

    • @Algovibes
      @Algovibes  2 года назад

      No worries. First one is populating the Database and second one extracts data from this database. The foundation video is explained here, I am going slightly more into details there:
      ruclips.net/video/rc_Y6rdBqXM/видео.html

    • @reapeobrian
      @reapeobrian 2 года назад +1

      @@Algovibes thnx a lot! and amazing videos you're amazing!

    • @reapeobrian
      @reapeobrian 2 года назад +1

      Sorry again, I've watched the video. I'm doing it on my computer, so tell me if I'm wrong.
      First I run from terminal the first script and I leave it running to feed the db, and after I run the second script that uses in real time the database that is updated all the time by the first script. It's ok?

  • @TJ-ki3gp
    @TJ-ki3gp 2 года назад +2

    What IDE is this and how do you set it up that you can do in-line execution and results?

    • @Algovibes
      @Algovibes  2 года назад +1

      That's Jupyter Notebook and the in-line execution is a feature.

    • @TJ-ki3gp
      @TJ-ki3gp 2 года назад

      @@Algovibes Thank you!

  • @vitona3029
    @vitona3029 Год назад +1

    Guys the error problem is from the python version your using, i was using 3.8 and it wasn’t working and kept giving me errors but after I downgraded my version to 3.7.13 it worked like it was a dream thank god i was trying to solve this problem for days and finally alhamdullah I fixed it

    • @Algovibes
      @Algovibes  Год назад

      Hi Vitona,
      where do you get this error? BTW I have more up-to-date videos on cryptobots which are also working with newer Python versions. But before that let me check if your error is really occurring because of versioning.

    • @vitona3029
      @vitona3029 Год назад

      @@Algovibes in the looping it was saying that the ssl connection can’t be done then I downgraded my version and it worked seamlessly

  • @berkantdirim930
    @berkantdirim930 2 года назад +1

    Hey I'm Getting RuntimeError: Event loop stopped before Future completed. Error After first loop and my PyLance showing "Code is unreacahble" for await client.close_connection() this line do you have any idea to fix this?

    • @Algovibes
      @Algovibes  2 года назад +1

      Didn't have any exposure to PyLance yet. Sorry!

  • @chapmansbg
    @chapmansbg 2 года назад +1

    As a general rule, stop loss should be less than the take profit otherwise you are relying on only your strategy win rate. If you have a 2 to 1 take profit to stop loss you will get positive results even at a 50% strategy win rate. Not only that you really shouldn't take profit if the price is continuing up, you should move your stop loss up with the increasing price and wait for a reversal. I didn't see anything about looking at the cost of the trade which would be max 0.1% on Binance.

    • @Algovibes
      @Algovibes  2 года назад

      Yep! Agreed. Fees are 0.075% per Trade.

  • @FrittendenFrench
    @FrittendenFrench 2 года назад +1

    Nice :)

    • @Algovibes
      @Algovibes  2 года назад

      Thanks for watching!

  • @neuvedeno1
    @neuvedeno1 2 года назад +1

    Great viedeo, really helpfull. I have a question, maybe stupid. I am pretty new to crypto, but isn't there a problem with Binance's fees? I believe it is 0.1% per order. Won't that make short-term trades marginally less effective?

    • @Yasinzaii
      @Yasinzaii 2 года назад +2

      You are right. As the bot is taking 0.5 percent profit. So subtract 0.1 for buy and 0.1 for sell order. The bot is still in profit by 0.3 percent.

    • @Yasinzaii
      @Yasinzaii 2 года назад +1

      If you hold BNB coin then you will be charged 0.075 (25% Discount). So your reward will become 0.35%

    • @Algovibes
      @Algovibes  2 года назад

      Thank you! And yes it is like Yasinzaii stated.

  • @chapmansbg
    @chapmansbg 2 года назад +4

    3% stop loss for a .5% possible gain... It would be better to have a rising sale price and only sell if reverses. So if you get above .5% you set that as the stop loss and move the take profit up .5% that way you will be able to catch as much of the move as possible before it reverses.

    • @accountramerame
      @accountramerame 2 года назад +1

      He already done that in the Trailing Stop Loss video.

    • @chapmansbg
      @chapmansbg 2 года назад +1

      @@accountramerame the point is to combine the ideas to make the bot more functional.

    • @Algovibes
      @Algovibes  2 года назад

      3% SL is nonsense. I am referring to that in the end of the video. Anyhow thanks a lot for sharing your thoughts! That's quite an interesting idea!

    • @chapmansbg
      @chapmansbg 2 года назад

      @@Algovibes thank you for your comment. You are building up very useful library of techniques and ideas. How much prep do you put into creating the code? Or is it off the cuff ?

  • @sodiq2069
    @sodiq2069 2 года назад +1

    can you add the links u mentioned in the description? pls

    • @Algovibes
      @Algovibes  2 года назад

      They are all in the video description. Which one do you miss?

  • @giodimasi4123
    @giodimasi4123 2 года назад +1

    Amazing job, but why dont you just set take profit and stop loss when you are buying, directly using Binance Algo orders?

    • @Algovibes
      @Algovibes  2 года назад

      Thanks buddy. Good suggestion, can you elaborate on that?

  • @walduss7939
    @walduss7939 2 года назад +1

    Hi, sorry to bother you.
    I have a new error in the first file.
    ‘List’ object has no attribute ‘lower’
    Any clue to solve it?

    • @walduss7939
      @walduss7939 2 года назад +1

      Solved! I don’t know how, but today after review the code it is working this part

    • @Algovibes
      @Algovibes  2 года назад

      Awesome!

  • @rafaelar8472
    @rafaelar8472 2 года назад +1

    hey! can u please explain me why i am getting only zeros when executing the function?

    • @rafaelar8472
      @rafaelar8472 2 года назад +1

      And why it aways shows me just BTC

    • @Algovibes
      @Algovibes  2 года назад

      hi, when exactly?

  • @davidolmoscubells9338
    @davidolmoscubells9338 2 года назад +1

    How do you set the commission asset to BNB always?

    • @Algovibes
      @Algovibes  2 года назад

      On the Binance platform. You have to check the box at take BNB as commission asset.

  • @Yasinzaii
    @Yasinzaii 2 года назад +3

    Plz do 1 change and test it out and share the results. Rather than using the percentage change of a coin consider using the slope of the prices for each minute. If the slope of the last minute or 30 second is negative then the coin is in downtrend and should be avoided. I hope it will have a drastic increase in the win percentage.

    • @Algovibes
      @Algovibes  2 года назад

      Thanks buddy for sharing your thoughts!

    • @DrR0bot
      @DrR0bot 2 года назад +2

      Moment_list = []
      for symbol in symbols:
      prices = qry(symbol,3).Price
      first_index = prices.first_valid_index()
      last_index = prices.last_valid_index()
      if first_index is not None:
      first_price = prices.iloc[first_index]
      if first_index is None:
      first_price = 0

      if last_index is not None:
      last_price = prices.iloc[last_index]
      if last_index is None:
      last_price = 0
      if first_price != 0:
      moment = ((last_price - first_price))*100#/first_price)*100
      else:
      moment = 0

      Moment_list.append(moment)

    • @Yasinzaii
      @Yasinzaii 2 года назад

      @@DrR0bot did you gave it a try ?

    • @DrR0bot
      @DrR0bot 2 года назад

      @@Yasinzaii yes. If you change the cumret section for this one it will give you the series of slopes for all the filtered symbols. Then you just have to find the index when is the max

    • @Yasinzaii
      @Yasinzaii 2 года назад

      @@DrR0bot ok will do. How was the result ? Did you run it for long? is it worth it?

  • @m.r.williams8649
    @m.r.williams8649 2 года назад +1

    Is there an alternate method to looping the first script?
    Seems problematic for me and others I see.

    • @Algovibes
      @Algovibes  2 года назад

      Can you elaborate on "looping"?

    • @m.r.williams8649
      @m.r.williams8649 2 года назад

      @@Algovibes the line at the end of the code loop.run_until_complete(main()) is failing. I have included the 2 extra lines of code required by Jupiter but it fails.

  • @jujuzkhalid8917
    @jujuzkhalid8917 Год назад +1

    Hello, i am trying to build a bot that uses some methods from the code your posting, thanks so much🙏🏽 however, i am having trouble in getting accurate and timely data for all symbols/currencies.. it doesnt bring the latest data for all of them, but only does for a few.. could you possibly help me with that? Or provide me with possible reasons?
    Reallly appreciate your help and support and all the efforts done in your chanel🙏🏽🙏🏽🙏🏽🙏🏽

    • @Algovibes
      @Algovibes  Год назад

      Thanks buddy. Be invited to explore the cryptobot playlist. I have a ton of other videos covering different approaches so your problem is highly likely to be solved then. Cheers!

  • @urobee
    @urobee 2 года назад +1

    Hy, great video, thanks for it!
    It works great when I run the script manually but when I try to run it from task scheduler i got this error:
    "max() arg is an empty sequence" (win10 x64)
    Can You help me in this case?
    Thanks!

    • @Kommander_in_Fahrt
      @Kommander_in_Fahrt 2 года назад +2

      That was my Problem too. I solved it by using the complete filename including directories:
      engine = create_engine('sqlite:////home/botpi/test/CryptoDB.db')
      in both aplications.

    • @Algovibes
      @Algovibes  2 года назад +1

      Thanks both for your comment and sharing possible solutions!

  • @walduss7939
    @walduss7939 2 года назад +1

    Hi,,
    I am getting an error with python 3.10
    As of 3.10 the loop parameter has been removed!!!!
    Any Solution?

    • @Algovibes
      @Algovibes  2 года назад +1

      Besides not using 3.10: No.
      There is a discussion on this here:
      github.com/aaugustin/websockets/issues/916

    • @walduss7939
      @walduss7939 2 года назад

      @@Algovibes installing Conda and 3.9 instead, but still not able to run it!
      Now I get. .. this event loop is already running!

  • @rokjurse340
    @rokjurse340 2 года назад +1

    Hi, again awesome video. I'm getting this error: BinanceAPIException: APIError(code=-1102): Mandatory parameter 'symbol' was not sent, was empty/null, or malformed.
    You know how to fix it?

    • @Algovibes
      @Algovibes  2 года назад

      Thank you man. It's just telling you that you have to pass a symbol to the buying order. Can you double check if your code is doing that?

  • @NikaTVNika
    @NikaTVNika 2 года назад +1

    Hello Is there a github repo for this project?

    • @Algovibes
      @Algovibes  2 года назад

      ruclips.net/channel/UC87aeHqMrlR6ED0w2SVi5nwjoin ;-) Anyhow: Thanks a lot for watching!

  • @evansfaso9715
    @evansfaso9715 2 года назад +1

    Thank you for this amazing project,,,,can you please give the source,,,same as the one the video,,,so we can just use it directly

    • @Algovibes
      @Algovibes  2 года назад

      Publishing the code based on engagement. So probably in the upcoming months.

  • @hichamelouali
    @hichamelouali Год назад

    when running the line" free_usd = [i for i in client.get_account()['balances'] if i ['asset'] == 'USDT'] [0]['free']" I get the error of invalid API key but all the permission are open..
    APIError(code=-2015): Invalid API-key, IP, or permissions for action.
    any idea how to proceed champ?

    • @louisschmidtke7968
      @louisschmidtke7968 Год назад +1

      I also got this error

    • @Algovibes
      @Algovibes  Год назад

      You need to enable the API on the Binance website. Was going over that in the Introductory Binance video. Should be linked in the vid description. If not, just let me know and I'll reference it again. Thanks guys!

  • @deepannagarajan6055
    @deepannagarajan6055 2 года назад +1

    How to close all open positions in Binance kindly help

    • @Algovibes
      @Algovibes  2 года назад

      There is no general API call for that. But you can surely write your own script to achieve that.

  • @Dmitry_Rogachuk
    @Dmitry_Rogachuk 2 года назад +1

    Очень круто! учусь по твоим видео! очень интересно!!! Привет с полюса холода!

    • @Algovibes
      @Algovibes  2 года назад

      Haha thank you man, спасибо❤️ Greetings back!

  • @al-aminibrahim1394
    @al-aminibrahim1394 2 года назад +1

    But Is there any way that I can make it trade within seconds

    • @Algovibes
      @Algovibes  2 года назад +1

      Yes! You need to establish a websocket connection to get a realtime data stream. Be kindly invited to check out my cryptobot playlist. I am doing that in a plenty of videos.

  • @farhan6516
    @farhan6516 2 года назад +1

    thank you mate. i got "database is locked" error.

    • @Algovibes
      @Algovibes  2 года назад

      Delete the database and populate it again is the most straightforward solution. Also: a switch to MySQL is recommended in general.

  • @chapmansbg
    @chapmansbg 2 года назад +1

    that minimum lot size explanation makes not sense. if the minimum is 0.01 then 0.198 is well above that and there is no need to round it. If the investment size was 0.009 there would be a problem... am I missing something here?

    • @Algovibes
      @Algovibes  2 года назад

      I guess yes. I don't know which case you are referring to when comparing 0.01 to 0.198. In my example it was 0.01 and 0.19 which fits fine But there are certainly better ways to implement that. Some people already commented good solutions. Anyhow my approach should work with any asset except Bitcoin.

    • @chapmansbg
      @chapmansbg 2 года назад

      @@Algovibes the 0.198 came from what you said when explaining the rounding up of the limit. I suppose my question is, 0.19 is higher than 0.01 so why would it need to be rounded up? Couldn't we just test that our investment is greater than the minimum limit?

  • @saxofff
    @saxofff 2 года назад +1

    Can we use these bots with us?

    • @Algovibes
      @Algovibes  2 года назад +1

      Well these are examples how you can build one but I don't recommend to use them. They are just meant to be seen as projects, but ofc I cannot stop you to use them.

  • @ganisack9853
    @ganisack9853 2 года назад +1

    Pls make advances pandas-dataframe tutorial,

    • @Algovibes
      @Algovibes  2 года назад

      Thx for the suggestion but could you be more specific? BTW I have a pandas playlist so be kindly invited to check that out first.

    • @bdcash
      @bdcash 2 года назад

      Kevin of Data School has some excellent content - ruclips.net/user/dataschoolplaylists.

  • @maximilianrepstat3716
    @maximilianrepstat3716 2 года назад +1

    why you dont use raw python ?

    • @Algovibes
      @Algovibes  2 года назад

      If you are referring to the content of this video, I have covered using raw python here:
      ruclips.net/video/nQkaJ207xYI/видео.html
      If the question is general:
      Because presenting code is more lucid in Notebooks at least in my opinion.
      Privately I am using Spyder.

  • @hzlokuma3904
    @hzlokuma3904 2 года назад +1

    how can ı get only leverage tokens ?

    • @Algovibes
      @Algovibes  2 года назад

      By filtering the list for only those values which contain an UP or DOWN.

    • @hzlokuma3904
      @hzlokuma3904 2 года назад

      @@Algovibes thank you for your answer but it doesn't work. comes in values that are not in futures. exclude = ['UP','DOWN']
      non_lev = [symbol for symbol in symbols if all(excludes not in symbols for excludes in exclude)]

  • @loteronloteron3410
    @loteronloteron3410 2 года назад +1

    bro why buy spot&

  • @danielsmobile8154
    @danielsmobile8154 2 года назад +1

    Vielen Dank für deine Videos,
    ich habe mir vor ein paar Wochen einen Bot gekauft, nun habe ich eine geniale Idee, kann aber selbst nicht programmieren, falls du Interesse hast können wir ja mal sprechen. beste Grüße Daniel

    • @Algovibes
      @Algovibes  2 года назад

      Hau raus! Vielleicht covere ich die in zukünftigen videos 😛

  • @softsrilanka8746
    @softsrilanka8746 2 года назад +1

    I tried this. when I run first script it runs without any error update data base also, but it stop taking data after few min (loop is continuously running since it is while true: ) . I think there is a comment asking same but I couldn't find a solution. can you please help on this
    Thank you for this grate work. it help us to learn and think innovatively.

    • @Algovibes
      @Algovibes  2 года назад

      Is the async function "alive"? You can check that by just printing the received message.
      If anything else fails you can btw check out my newest video. I am showing an alternative with csvs there.

  • @sorsalouni380
    @sorsalouni380 2 года назад +1

    Work? Profit?)

    • @Algovibes
      @Algovibes  2 года назад

      What exactly is your question?

  • @daliu4536
    @daliu4536 2 года назад +1

    Blogger, waiting for your reply

  • @knightofLotus
    @knightofLotus 2 года назад +1

    Hi, beautiful video... I have only one big question that I haven't solved yet... sometimes are used in your videos 2 different method to make a bot. one is the live streaming like in this video. In other, like this : ruclips.net/video/X50-c54BWV8/видео.html, you have used a complete different method... do you think are the same at the end or one is better another? i mean... just regarding the calls of data and using them to calculate indexes...

    • @Algovibes
      @Algovibes  2 года назад +1

      Thanks mate. These are 2 approaches: one is a live stream which doesn't even require authentication. You are not "calling" the API. The second method which I was using in this video is requesting data with an API call. Big downside of that is: It can happen, that you are sending out too many requests. I am covering both approaches here, maybe you can spot the difference better:
      ruclips.net/video/g04GeHe-dJw/видео.html

    • @knightofLotus
      @knightofLotus 2 года назад

      Hi, Thank you for your advise! I found the other video really well made! I just have a final question... May you can answer! Do you know if is it possible to use the live streaming mixed with a history df for calculating different indexes also for the sell cobdition and not only in the buy, like as you showed on the video you suggested me? I would like to use indexes calculation on the deta got by livestreaming ( the one with the async function).

  • @SI-me7fm
    @SI-me7fm 2 года назад +1

    @36.21 it is not updating the sqldatabase and I am getting the following error:
    DeprecationWarning: There is no current event loop
    loop = asyncio.get_event_loop()

    • @Algovibes
      @Algovibes  2 года назад

      Would need a bit more elaboration on that to be able to help out!

    • @SI-me7fm
      @SI-me7fm 2 года назад +1

      @@Algovibes Thank you for your reply. I am getting the results until "multi" where I write the symbols in lower case and add @trade to it but then when I am creating "createframe" it is not showing anything in the pycharm even when I "print" it and then when i go ahead to write the function async it is not creating the database in SQL and not downloading the data to that database and after that when I go for loop = asyncio part it is giving me the above error. Can you please help me here?

    • @Algovibes
      @Algovibes  2 года назад +1

      @@SI-me7fm ah you are working with Pycharm.
      Please follow the instructions from this vid at around minute 9 to solve this:
      ruclips.net/video/nQkaJ207xYI/видео.html

    • @SI-me7fm
      @SI-me7fm 2 года назад

      @@Algovibes Thank you for your help I solved it by downgrading my Python version to 3.9 and then it started updating the database

  • @alexcalish9774
    @alexcalish9774 Год назад +1

    I was struggling with the Lotsize calculations. It was returning a scientific notation that I could not get rid of. Anything over maybe 5 decimal points would error out.
    I think I came up with a solution that is going to work much better for me. I swear I tried every float formatting trick that I could find online. Nothing worked. Still got scientific notations. Here is my new solution:
    info = client.get_symbol_info(symbol=symbol)
    price = float(client.get_symbol_ticker(symbol=symbol)['price'])
    lotsize = [i for i in info['filters'] if i['filterType'] == 'LOT_SIZE'][0]['minQty']
    lotsize = lotsize.find('1')
    buy_quantity = round(investment_amt / price, (lotsize - 1))
    Basically use the Lotsize string and count the characters to 1
    '0.00000100' is what BTCUSDT might look like. Counts 0,1,2,3,4,5,6,7 and finds '1' at 0-7. I need my answer to be 6 so I subtract 1.
    Any help on how the solution in the video can continue to work please let me know but I swear I can't get the lot numbers correct.

    • @Algovibes
      @Algovibes  Год назад

      I have a way to do that shown here:
      ruclips.net/video/FlL1X17sw8o/видео.html
      Please let me know if that will fix your problem!