How To Build a Simple Cryptocurrency Live Trading Bot with Python using the Binance API

Поделиться
HTML-код
  • Опубликовано: 24 апр 2024
  • This video is about getting live cryptocurrency data via the Binance Socket Manager and store them in a database followed by analyzing this data and build a simple trend following trading strategy with the live data.
    Get the Notebook/Source code by becoming a Tier-2 Channel member:
    / @algovibes
    Let me know if you find content like this valuable. I will continue to implement some technical indicators and Machine Learning on Cryptocurrencies. I personally think that is pretty interesting. Nevertheless don't worry I am anyhow also covering stock trading topics :-)
    Disclaimer: This video is not an investment advice and is for educational and entertainment purposes only! Cryptocurrency and automated trading is bearing a high amount of risk which might result in a total loss of your invested capital.
    If you want to support me you can register for Binance with this link, but don't feel forced to:
    www.binance.com/en/register?r...
    More information on the Binance Socket Manager:
    python-binance.readthedocs.io...
    Alternatively you can use the websocket library and pick the stream provided in the official Binance API documentation:
    binance-docs.github.io/apidoc...
    Set up Binance API video:
    • Introduction To Automa...
    Python & SQL:
    • Pandas Dataframes and ...
    Cumulating returns:
    • How To Calculate Stock...
    Video on Trendfollowing:
    • Intraday Trading Strat...
    00:00 - 01:38 Introduction / Disclaimer
    01:38 - 05:05 Requesting data using the Binance Socket Manager
    05:05 - 08:28 Data Cleaning / Manipulation
    08:28 - 11:31 Getting Live Data into a SQLite DataBase
    11:31 - 14:30 Requesting Live Data from the SQL DB
    14:30 - 16:22 Explanation of Trendfollowing strategy
    16:22 - 26:25 Coding the Trading Bot (simplified)
    26:25 - 29:41 Test the Bot with real money trade
    #Python #Tradingbot #Crypto #Binance
    Code source:
    pastebin.com/iFSLxbLB
    password: S58MYqi3Xw

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

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

    PLEASE READ(January 2022)❗
    This video is picked up by the Algorithm again. Thanks for your interest and support.
    Secondly most of the viewers understood that this is a technical implementation of a simple strategy and NOT a recommendation to trade this strategy. For those who doesn't please keep that in mind :-)
    FAQs / Most common problems:
    1.
    SyntaxError: 'await' outside function
    I have provided a solution to solve this in this video:
    ruclips.net/video/nQkaJ207xYI/видео.html
    2.
    The stream stops and something like "None in the columns" is popping up:
    ruclips.net/video/OX5eDJDtqhc/видео.html
    Solved below the videos pinned comment (Reason behind that is, if you are not getting a ping from the server an empty data frame without columns is created).
    3.
    If you don't feel comfortable using the Binance Socket Manager or you are using Python 3.10. I recommend to use a Websocket stream. I have covered it among other newer videos in the crpytobot playlist here:
    ruclips.net/video/8p240qonj0E/видео.html
    4.
    I have covered a lot of other concepts like cloud deployment, other trading approaches, not using SQL or using e.g. technical indicators. Please check out the cryptobot playlist here:
    ruclips.net/p/PL9ATnizYJ7f8_opOpLnekEZNsNVUVbCZN
    There is more to come so if you are interested in that please considering leaving a sub.
    Thanks for watching and your support! Much appreciated ❤️

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

      Yep!!! Good work. Great content and well delivered.

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

      Thanks a lot!

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

      Thanks!!! How obtain with websockets in binance futures lowest timeframe ie..milliseconds is possible?

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

      Hi, Thanks for your videos (y)
      I ran the code on google collab but got this error:
      RuntimeError: asyncio.run() cannot be called from a running event loop
      Can you help please?

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

      this does not work for me: "asyncio.run() cannot be called from a running event loop"

  • @henrydikeman4223
    @henrydikeman4223 2 года назад +207

    You can always tell who the true educators are and who the snake oil salesmen are from what they promise and what they teach. You’re a true educator, great choice of the simple trading strategy. Subscribed

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

      Thanks a lot for your kind words man, I appreciate it. This is super important to me!

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

      No 300% guaranteed daily return. This must be the snakes salesman.

  • @MaryBenedict1155
    @MaryBenedict1155 Год назад +91

    Nice to see how you openly ventilate the change in your opinion. In your next lunch video, take a look at the new utilities and the staking story. You can really earn a lot with trading on bitcoin. Especially if you are already planning to invest something in it for the long term. Thanks again for the update.

    • @donald.jacoby.94
      @donald.jacoby.94 Год назад +2

      Crypto trading is quite profitable I'll always pick Short term trading over Holding cause I have made a lot of profit from trading different profitable coins... it is not surprising as I also trade with Mr. Henrik Bower on a short term basis.....I advice you seek the help of an expert to avoid the trauma of too much losses

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

      @@donald.jacoby.94 Just recently acquired some bitcoin and I don't know how best to trade it or if I should hold, Please how do i get in touch with Mr. Henrik your trader?

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

      Henrik Bower's daily signal is top-rated and one of the best you could get when it comes to trading crypto...

    • @donald.jacoby.94
      @donald.jacoby.94 Год назад

      @@JohnHealy7153 You can reach him VIA

    • @donald.jacoby.94
      @donald.jacoby.94 Год назад

      *tele* *gram*

  • @milanmeyer2059
    @milanmeyer2059 2 года назад +95

    This is pure Gold. I’m just getting into Python and strive to become a data scientist one day. This really helps and motivates a lot! Danke.

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

      Awesome to hear and also great career pick ;-)

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

      Starting out with cryptocurrencies when you want to become a data scientist is like starting out with IRL pyramid schemes when you want to become a legit business manager. Does not compute. Stop doing that, pick up a few books and do real data science exercises

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

      "real data science exercises"...come on. In books you will find standardized approaches such as cancer prediction, houseprices and so on which are helpful without a question but If he wants to apply Data Science stuff to cryptocurrency data..why not? It is just time series data which can nearly be found everywhere. BTW I applied some methods here on cryptos:
      ruclips.net/video/oyL99oa6gf8/видео.html

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

      @@milanmeyer2059 I have a better way of doing same.

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

      German ❤️

  • @user-zo1np4lh5u
    @user-zo1np4lh5u 2 года назад +53

    I love how clean your code is makes me feel ashamed of how lousy I've been writing mine xD Great work

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

      No need to be ashamed but an Eng. would probably strongly disagree with you as my code is not clean. I am presenting the code so that it is accessible independent from the skill level. I played around with showing object oriented code but I get the feeling people prefer the code in this way. Anyhow, thanks a lot for your kind words :-)

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

      @@Algovibes I'm sorry, how can I copy your script?
      Or following to your video instructions is onlyway?

  • @Oz_rhodes
    @Oz_rhodes 2 года назад +25

    You provided a clear explanation of the code and aims and the script was great. Keep up the great work and thank you.

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

      Thank YOU for watching, the feedback and your kind words :-)

  • @clementfelley8170
    @clementfelley8170 2 года назад +55

    Great content, thanks for sharing. An interesting exercise from a risk management perspective would be to take half profit at 0.15% and the other half at 0.3% so that the profit potential is slightly higher than the stop loss

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

      Thanks for your comment and also thanks for sharing your thoughts! Yes definitely, I am just taking some parameters here to show the base concept.

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

      And losses what about them?

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

      You keep the stop loss at -0.15%. If you reach the first target before the stop loss, you increase the stop loss to the entry price, so that at worst you locked in your 0.15% gain

  • @brazed420
    @brazed420 2 года назад +125

    When Musk was tweeting about doge a few months ago we had a guy make a discord bot that would @ us every time he tweets

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

      That is awesome! 😄

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

      Link please 😃

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

      @@ua6919 Its been deleted/offline ever since he stopped being able to push doge up

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

      @@brazed420 oh np. Great idea anyway, thanks for sharing

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

      The fact that I just did the same makes me want to befriend you 🤣

  • @stefanfredin7120
    @stefanfredin7120 2 года назад +12

    Not sure if I'll ever have the time to learn enough python to do something like this. But watching you TEACH was great! You are very instructive and have a calming way of teaching. I subbed for future me's sake!

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

      What an awesome comment. Thank you buddy.

  • @joelalarconbarrientos3843
    @joelalarconbarrientos3843 2 года назад +13

    I'm introducing myself in python since two months ago and seeing things like this motivates me to keep learning. The best of all is that with your explanations I can figure out what is going on, but in a very basic way anyway.
    Thank you very much for sharing and teaching your knowledge with the web. Greetings from Chile!

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

      Hey Joel,
      that's awesome to read. Thanks a lot for your comment and I am sending you my best regards to Chile!

  • @nolan2736
    @nolan2736 2 года назад +29

    Hi, to make sure I understood, we have to run the 'data fetch' script in parallel of the stragety script ?

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

      Yeap

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

      Exactly. But btw if you don't feel comfortable with SQL I also build some examples without that. Be invited to check out the cryptobot playlist!

  • @AhmedMohammed-zy3pf
    @AhmedMohammed-zy3pf 2 года назад +2

    From a non coder this is simple and amazing thank you. Subscribed

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

      Thanks a lot for subscribing mate :-)

  • @capture-everything54
    @capture-everything54 2 года назад +2

    Has never done a video like this before at all in youtube. There has never been an account of how to write a bot and trade with real money on binance. thanks.

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

      I am sure there is! But anyhow I appreciate your comment :-) Thanks for watching mate.

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

    Hi thank you for the awesome video! I want to ask something:
    when we run the print(msg) command ( @5:17), you explain that we only take the 's' (symbol), 'p' (price), and 'E'(time). Can you help explain what the other outputs are? ('t', 'q', 'b', 'a', 'T')

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

      Hi buddy, thanks a lot for your kind comment. Appreciate it :-)
      Your question is answered here:
      github.com/binance/binance-spot-api-docs/blob/master/web-socket-streams.md
      Just scroll down to Trade streams.

  • @martingiannechini1
    @martingiannechini1 2 года назад +18

    Hi. Thanks for this video, it’s really interesting indeed. As you requested feedback, please keep providing real world examples like this but as you said maybe coding a bit more difficult (and probably reliable) trading strategies such as MACD crossover. I saw your video on macd but would be good to see one example using macd in real time to place trades. Loving your channel so far!

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

      Hi buddy, thanks a lot for your feedback.
      I already did that. Be invited to check out the cryptobot playlist.

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

      isn't MACD proven to be unusable nowadays? At least on the stock market I believe it is due to automated trading funds saturating.

  • @TheCryptoStudent
    @TheCryptoStudent 8 месяцев назад +1

    After losing lot of amount on manual trading and thinking of going for bot trading, this one is really a great resource to begin with

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

    Thank you!! Please continue the series!

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

      Hi mate, thank YOU for watching :-) There are a lot more videos on the cryptobot playlist. Be kindly invited to check them out. Anyhow I am planning on some more crypto vids.

  • @patrickwalsh1154
    @patrickwalsh1154 2 года назад +9

    Hi Algovibes! I really enjoyed your video! I really liked how well you explain everything and make it easy to understand! I believe cryptocurrency is the future and am fascinated with algorithmic crypto trading! Please keep up the good work! I have watched a lot of videos on the subject using python and yours are the best I think! Would you consider making a trading bot video that uses other types of indicators such as MACD or CCI?

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

      Hi buddy, thank you very much for your kind comment :-)
      Yes, I will and I partly already have.
      Be invited to check this out:
      ruclips.net/video/nQkaJ207xYI/видео.html

  • @cuteypatootie
    @cuteypatootie 2 года назад +17

    I love topics like this specifically - coding and crypto! And Python!

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

      Me too :D Awesome to share my interest with other people. Thanks for your feedback!

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

    Thanks a lot for this very interesting video combining Python and Crypto.
    You explain it well and your code is clean.
    Just subscribed :-)
    Catching up on your previous content will take a while, but I think it's worth it.

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

      Thank you very much for subscribing and your kind words!
      Looking forward to know what you think about the other vids :-)

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

    Very very veery interesting! Thanks for share, very well explained! See you in a next video! 👌

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

      Thank you buddy :-)
      You are kindly invited to check out my cryptobot playlist, maybe you will find another relevant stuff for you.
      And looking forward to see you as well :-)

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

    This is fantastic!!! I’ve only done a small bit of coding and so am still quite new to it and you have spelled this out so perfectly and explained everything so well, it has fully engaged me and inspired me!! Thank you so much!! And for myself, I love the fact that it’s crypto!! :)

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

      Hi Kelli, appreciate both your positivity and your kind words. Be invited to check out the other videos in the cryptobot playlist:
      ruclips.net/p/PL9ATnizYJ7f8_opOpLnekEZNsNVUVbCZN

  • @sayemmohammad6450
    @sayemmohammad6450 2 года назад +28

    Thank you very much man for saving my ass. I didn’t have any idea how to do my final project in one of my courses. Your videos helped me to land some! Thanks a ton!

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

      Awesome to hear! Thank you very much for your kind comment :-)

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

      College?

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

      @@Algovibes Hey, have you thought about applying some kind of maschine learning algorithm to the Trading information coming from Binance to maximize profit

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

    Thanks for amazing content! You are really adding a lot of value!!!!

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

      Thanks a lot mate. Appreciate your comment.

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

    Love the content on your channel, especially the crypto related stuff. Looking forward to see how you would apply TA to this live data.
    Thanks and keep up the good work!

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

      Thank you very much for your kind words and your feedback :-) Appreciate it.

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

    Hope you keep doing these videos man! Love following this series

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

      Thanks for the feedback buddy. There surely will be more videos on cryptobots. Be invited to check out the videos in the cryptobot playlist until then :-)

  • @HimanshuSharma-bz2gh
    @HimanshuSharma-bz2gh 2 года назад +1

    Thank you. Dude! I mean really! thank you!!! Keep up the good work.

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

    one of the best algo python youtube channel

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

      Thank you my friend. Your comment means a lot to me ❤️

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

    Hello professor, another question, can you download the information from binance in longer periods, for example every 1 min? what would be the change in the code? if it works, how can it be stoppep manually?
    And professor, reading one of the previous questions about the repetition of records that occurs in the "while" loop in the database, you said that we could use an "if", could you kindly write the syntax of this "if"? Thank you!

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

      Hi student :D
      Jokes aside.
      Yes you can do that with an API call. I have done that in my newest video. The stream is always grabbing realtime data.
      Instead of an if I would probably just set a waiting time of - say - one second in the while loop to avoid this "overflow".

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

    Hi - Thank you for your content. When I execute the await socket loop, the prices are recorded sporadically. Sometimes its the same time snapshot, but others it takes a few minutes. Why is this happening and is there a better way to receive this data?

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

      Thanks for watching! Few minutes shouldn't happen at all. As some people have issues with this approach I will probably cover an alternative in one of my next videos.

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

    Excellent video! Please keep up with the good work! Thank you !

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

      Thank you - literally - Buddy :-)

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

    Thank you so much, you tutorial is perfect to start with in algorithmic trading

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

      Thanks for watching mate :-)

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

    This topic is super intersting! I subscribed only because you're building a trading bot. ;-)
    But one question: Why do you store the live price data? I'm not a Python pro, but I would use some queue datastructure to have a buffer/cache of the let's say last 5 minutes (or longer, depending on the strategy). But storing price data in an SQLite database on harddisk doesn't make sense, not even for backtesting. Even for the latter one usually works with chart data (candles).

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

      Hey Wolfgang, thanks a lot for your comment. I use SQL as a storage for price data to avoid API calls getting historical data. You can store the prices in memory (e.g. in an array) but this would crash when taking e.g. 100s of cryptos (as I did in some follow up videos). If you have an efficient way to cashe web socket data my ears are widely open :-)

  • @ricardoandresleongomez5267
    @ricardoandresleongomez5267 2 года назад +5

    Great work, easy to follow and easy to learn. I have a question. On the while loop when getting the information of the currency by second, after an n number of iteration the code starts showing an error --> {'e': 'error', 'm': 'queue overflow. message not filled'}. It stops getting information from the server, any idea of how to solve it or what would be the reason for the error?

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

      Reason for the error is a queue overflow. I solved it here:
      ruclips.net/video/OX5eDJDtqhc/видео.html
      Would be awesome if you provide me a feedback if this approach is working out for you.

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

    That's way tooo much interesting keep making video on this topic please...

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

      Thanks for your feedback buddy :-)

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

    First time I watch your videos. Love them. Subscribed.

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

      Thank you buddy ❤️

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

    Amazing stuff... more content like this please!!

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

      Thanks for your feedback mate, appreciate it!

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

    Hi, i have a lil problem with your while true on the storing data, when i execute the code, between each frame i have like -100ms and at 80~100 frames stored i have an error message "KeyError: "None of [Index(['s', 'E', 'p'], dtype='object')] are in the [columns]"

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

      Yep, please check this video to fix that:
      ruclips.net/video/OX5eDJDtqhc/видео.html
      And also check my pinned comment.
      I would be grateful if you give me feedback if this is working out for you!

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

    This is definitely interesting. Thank you for this video.

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

      Thanks for watching mate!

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

    Very useful videos. I was exactly looking for this kind of techniques mixing data analysis ideas and simple investment strategies. Thanks a lot! I am waiting for the next related videos you will make:)

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

      Hey Adrian, thanks a lot for your comment. Be invited to check out the Crypobot playlist - I already built a lot of stuff there.

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

    Great video. Also the sqlite incorporation is a handy tip.
    According the documention a binance api stream / websocket disconnects after 24h, what's the best way to deal with this? Since the last thing you want is missing data in your dataframe when applying calculations like moving averages and stuff.

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

      Thanks for your comment mate :-)
      That's a very good point.
      There are some ways to deal with that: Incorporate a time tracker, so that after 24h a new connection is triggered or conditional check for a signal (pong) from the server. I will see that I am covering this problem in future videos e.g. when I am running a longer term strategy in the cloud.

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

    Nice video !
    Is it necessary to use a SQL data base or can we just store values in arrays or something ? What would be the benefit of the SQL database ? (I'm not initially a coder so probably a noob question :) )

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

      Thanks a lot for your kind comment :-)
      It's actually a very good question! It is not necessary, I just wanted to implement a DB in live trading. I have other videos where I am not using a DB.
      Be kindly invited to check out the cryptobot playlist.

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

      Depending on the dataset size array will just explode your memory

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

      @@gabrielceolato2 that and a database is persistent across runtimes, contrary to lists or arrays

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

      You can store it in memory db too like memcached or redis, read/write will be slightly faster then sql

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

    Going to be 1 million views. Congratulations...
    I'm happy for you.. Keep going.. Cheers

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

      Thanks Ali for your support and positivity. Means a lot to me!

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

    This is really good! Was thinking of doing the same w Coinbase API.

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

      Hi, thanks for watching and your feedback :-)
      Be kindly invited to let me know your insights working with the Coinbase API. Maybe it is better :-)

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

    Definitely interested in your videos, you have a very clearn and easy to understand way of teaching.
    I have a question for you, if I wanted to run a strategy with multiple coins, is it a waste of resources to have the websocket save data for the whole market?
    Also what do you think the best way to implement manual controls would be, a simple example an on/off, would running a seperate process on telegram or discord be okay. Or is there a better way in your opinion?
    Lastly, I would like to thank you for this content. It's truly amazing

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

      First of all thanks a lot for your kind words man!
      Secondly I already have content on these questions.
      Multiple symbols using BSM:
      ruclips.net/video/C-SL4Tf25eg/видео.html
      Multiple symbols using WebSocket and csv storage:
      ruclips.net/video/mDNIAkEZChg/видео.html
      Multiple symbols using WebSocket and SQL (also manual choice of buying as these are just signals)
      ruclips.net/video/8p240qonj0E/видео.html
      Would be happy for a feedback below these videos! :-)

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

      @@Algovibes thank you so much for your detailed responses. I plan on going through all your videos one by one regardless.
      Im currently stuck in this video so I need to master this one first, do you manage a community by any chance?

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

    Nice explanation, so small too. A binance bot I did ended up using agents and coroutines ; I'm on the "why make it simple if you can make it complicated" side >_>

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

      Hi mate thanks a lot for your kind comment. Be kindly invited to check out my videos in the cryptobot playlist. I am covering different approaches there.

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

    Great Work, I learned from you a lot. Thank you so much

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

      Awesome to hear. Thank you very much for your kind words! :-)

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

    Cool vodeo. ! How do you connect your Binance account with jupyter notebook ?

  • @slaxblake
    @slaxblake 2 года назад +16

    I try making it in binance but 2 things complicated the thing:
    1) binance fee (so when you buy 0.001, you instead get 0.000999, etc.)
    2) binance only allowing to buy/sell a round number (leaving some crypto behind when selling)

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

      well IF you have the funds you can enlarge your positions or you can washtrade up to VIP Tier 2 or 3

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

      First thing you need to do is to change the fee currency to BNB. It just doesn't make sense to not do so. It's cheaper.
      And you won't have that problem anymore.
      Regarding the second question: In this video I was working with quantities, so that shouldn't be an issue. Could you elaborate?

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

    Hi, just yerderday I was wondering how feasible something like this could be!
    I'll probably end up doing something similar, but I'd first have it running for some time without money to analize the results and see how the bot would behaved in a real environment.
    To do so, is there a way I can implement real fees and other issues I might incur into? For example, I'm talking about the inability to buy the fraction I want because it would be too small

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

      Hi buddy, thanks for your comment!
      Can't you just implement the buying logic in the data stream and add the potential profit to an array or similar?

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

    Hi, I was wondering: if you use 'if cumret[-1] > entry' and entry is set as a positive value "0.001" we are actually entering when price has just risen. Shouldn't we use 'if cumret[-1]

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

      Thanks for your kind words man :-)
      Just that we are on the same page: But that should be the goal right? So we want to enter the trade when the asset is rising. That's a "momentum" strategy not a reversal.

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

    I am already subscribed!!! long ago, your videos are amazing

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

      Awesome man, thanks a lot for your support!

  • @RafeedChowdhury
    @RafeedChowdhury 2 года назад +8

    Can we see the result of the strategy another time as bitcoin is in downtrend now. Of course continue with the crypto! I'm with you

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

      It actually was a bad time to trade on that day :-D Anyhow thank you very much for your feedback and your support!

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

    Thank you, great video!
    Do you know this error is showed?
    {‘e’: ‘error’, ‘m’: ‘Queue overflow. Message not filled’}

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

      Thanks for watching! This error is coming up for some people. I don't have this problem but I am still investigating on this issue.

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

      yes me too

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

      I have tried making queuesize to 10000 but still getting this error

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

      @@goldenbeast5160 Can you reduce the queusize to 100 and give me feedback again?

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

      My unsophisticated solution was to add error handling using try and except For example, try: the code except: print("Invalid Data") so if the API errors it just tries again

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

    Liked and subscribed! Excellent work, thanks for sharing

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

      Awesome, thanks a lot for subscribing! :-)

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

    Thanks for these videos.
    Waiting the next ones will be so useful for me as well.

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

      Welcome :-) There will be surely more on crypto. Until then I set up a cryptobot playlist.

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

    How to place a future prepetual order using python

  • @someone-eo1zf
    @someone-eo1zf 2 года назад +30

    I have never coded or done something like this in my life but I've been playing with crypto and stocks for awhile now, how would one like me get into something such as this? Looks like it could be worth getting into

    • @EmannuelleAlpha
      @EmannuelleAlpha 2 года назад +9

      Try to learn programming or even data science.. we (data scientist) deal a lot of stuffs with big data and how can we me make something that can help us on a daily basis, pulling an insight from a data, interpreting a model, and etc. You can learn Data Analytics using Python, or even something else like programming for data scientist or even machine learning.
      I hope it answers you.

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

      I have some resources on my channel like both the Python Introduction playlist and Python for Finance playlist and I am talking about how I personally learned Python here - maybe this is helping you:
      ruclips.net/video/qCZiENV83rE/видео.html
      In general the most important thing is to get started in my experience 😛

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

      Lol then ur gonna have to start from scratch, learn python basics before doing something as in depth as this

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

    Why weren't you shown in the search when I was searching for these kinds of tutorial?! Only for half years later you appear by chance! better later than never! subscribed!

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

      Thank you so much for your sub man. That's a huge help for me!

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

    Hi , your videos are phenomenal , is there anyway I could reach out to you ? I have a bunch of strategy ideas and have doubts backtesting it on python

  • @iambonmucho
    @iambonmucho 2 года назад +47

    Imagine you forgot to stop the script executing and you become accidentally a millionaire overnight.

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

      :D :D

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

      Technical it isn't possible as this is not really much of real case. Especially the data gather is just for researches. If something like bitcoin just for investment or something like that, that is mostly not possible unless the data and thing can been seen and proved but because this is digital base, therefore no way those can earn money.
      However, using this cryptocurrency in another way like using that coin for your all personal information, all sources just like acting as your ID, bank account, insurances in one place, adding the real made machine for verification to do anything else. This is is the way they should go for the future. But not right away.
      Also there will be an unexpected idea happen overtime so for coming with new methods to prove legitimate and acceptable in a wide range that should be possible. As I can see those thing can use more than that. Not just some business trading or something like that, not the kind bitcoin we are looking for but with different motives.

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

    Great content, I'm not confident enough yet to implement something like this myself, but this is really helpful. Any chance you could post your code somewhere please?

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

      Thank you buddy! :-)
      You will be in some time for sure!

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

      You could practice writing your own trading bot using dummy data. Instead of placing real buy and sell orders through the API, just add and subtract integers from local variables. There will be some discrepancy given that prices move between API calls, but at the very least you'll be able to formulate an algorithmic strategy before taking it live. Once live, keep the values small as you fine tune, then once confident you can ramp it up. Good luck.

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

      @@ryanm7263 am i stupid here or its not working? i used with my own binance api keys and bot doesnt buy or sell

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

    Thank you so much. This is really interesting to watch..

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

      Thanks for your feedback my friend!

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

    Fantastic video. I was thinking if it was possible to delete everything beyond the last x observations from the SQL database if there is no order in place, as we only want the info of the previous x observations.

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

    Couple of questions:
    - Is this possible with Webull? Not sure if they have API to use but I figure I could use something similar to what you did at the very least.
    - Is there no request limit(s) for the API?
    - Any way to increase the timeframe?
    Well explained video btw. SUBSCRIBED!

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

      Thanks dude! :-)
      Didn't test out webull yet. There is a request limit for the API!
      What exactly do you mean with increasing the timeframe?

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

      @@Algovibes so if I'm not mistaken this captures every second of movement. What if I wanted every 10mins or so?

  • @danielkawooya7386
    @danielkawooya7386 10 месяцев назад +1

    This is what I have been looking for. Tired of 3rd party software! Thank you so much.

    • @Algovibes
      @Algovibes  10 месяцев назад

      Welcome buddy, be invited to check out my other stuff! Cheers :-)

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

    Thank you for the tutorial and knowledge sir !

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

      Thanks for watching buddy :-)

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

    Really good quality video, I'm watching more and subscribing ! Also I'm interested in crypto trading, not equity trading :)

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

      Hi mate, thanks a lot for your comment and support. Really appreciate it :-) I will do both btw.

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

    Great Video, Thanks!
    Any idea how can I pull the transactions volume (not the currency value)?

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

      Hi mate,
      thanks a lot :-)
      Yes, that's possible. Try the following:
      Change the socket first by defining:
      socket = bsm.kline_socket('BNBBTC')
      and the retrieved msg will contain a Volume parameter as well.
      But you need to amend the functions then.

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

      @@Algovibes Great! Thanks meet :) keep it up

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

    Thank you very much, very cool video. Please continue to create similar videos related to the binance API. Like put and subscribed!

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

      Thanks mate, really appreciate your comment :-)
      I just published one some days ago using a reversal and Trailing Stop Loss. Be kindly invited to check that out and let me know what you think:
      ruclips.net/video/V6z1ME3-0_I/видео.html

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

    Man you are freaking awseome - thank you for the lessons

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

      Thanks a lot man :-)

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

    This video is very helpful for me. Cleared many of my doubts for live price trading through web socket data stream.
    Please make this kind of video. Love ❤ from 🇮🇳.

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

      Happy to hear that. Thanks for watching and your comment. Love and all best wishes back to India ❤️

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

    Thanks for this. Are you considering any kind of backtesting of strategies and how to do that? Thanks!

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

      Hi buddy, thanks for watching.
      I have a lot of videos on backtesting on my channel. This particular strategy is just an example which is not worth to backtest.

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

    Very very good video please make more video on more strategy automated
    Thank-you very much

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

      Thanks buddy, there are some more videos in the cryptobot playlist but I surely do some more of them :-)

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

    Great content man! Keep it up. Thanks you

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

      Thank you mate :-) Appreciate your comment.

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

    I subbed, Thank you for your knowledge

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

      Thanks a lot for your support mate :-)

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

    Good work man, very interesting contents. 👏👏👏👏👏

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

      Thank you very much for your feedback! :-)

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

    Thank you for sharing the great video!! ❤

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

      Thanks for watching mate :-)

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

    very nice and thank you for sharing your knowledge...I think trading with cryptocurrency is not well known yet. But this will definitely change over time and your tutorials are unique in this case

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

      Thanks a bunch for your feedback! Appreciate it :-) Either it will change or it will burst, lets see :-D

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

    Very helpful tutorial. Thank you.

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

      Thanks for watching mate :-)

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

    Nice job and explanation, congrat, please continue.

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

      Thanks for your feedback. Appreciate it :-)

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

    Amazing thank you!

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

      Thanks for watching :-)

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

    I really like your content and I just subscribed to your channel. Please continue with the videos for cryptocurrencies.
    Are you by any chance from Austria or Germany? Your pronounciation sounds like it.
    Cheers!

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

      Hey man, thank you so much for subscribing and your kind comment. That is a huge help for me :-) I am from Germany 🇩🇪 I am working on my pronunciation. It was bad in this video but I wanted to record it in one round :D

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

      @@Algovibes Nein die Aussprache und dein Vokabular sind sehr gut, aber man bekommt diesen Akzent einfach sehr schwer weg. Mach weiter so, der Kanal ist richtig lehrreich!
      Lg aus Österreich

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

    At time index 19:05, it appears last_valid_index() is an attribute of cumret? Where does that come from? Thanks!

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

      Cumret is a series (pandas object) and we are just applying a pandas function on it.
      Is this answering your question?

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

      @@Algovibes I did not realize that was a pandas function. Thanks!

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

    Super great content dude!! keep going this is amazing

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

    Binary Trading is very hard for me...too much sentiments to overcome.
    I have been searching for an ideal bot, especially one I can tinker with code.
    Great tutorial.
    Is it Interesting???
    I totally absorbed it. Great tutorial along with simple explanation.
    Now I can start coding my own bot. Thank you very much. Any improvements you make, I would like to follow.

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

      Thank you so much for your kind words. Really appreciate them!

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

    How the fuck this guy getting just 7000 subscribers???!!!!!.
    I already made bot works more or less like this, but database and analyzing data is something else.
    Good work mate 👌

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

      Hi buddy,
      I really appreciate your kind words :-) Thanks a lot for watching!

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

    Hello litlle man, been looking for while for a good video about trading bots,and really the first time i understand how everything works. Keep up the good work

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

      Thanks a lot Mohammed!

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

    Thank you for the Video.. Really Helpful!! Please do more videos on same topics.. :)

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

      Thanks for watching man. I have a lot of similar videos with different approaches in my cryptobot playlist. Be kindly invited to check that out.

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

    Great video! Are you a data engineer for web3 company?

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

      Thanks man, no I am working in DS.

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

    Hats down, very useful content, thank you soo much !!

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

      Thank you man. Appreciate your kind words.

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

    For your analytics, subscribed

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

      Thanks buddy! :-)

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

      @@Algovibes need your constant guidance as I've started algo few weeks back

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

    Hello thank for this great content. The fact that you kind of ´ preload ´ the database live in the array, does it make the bot faster / more reactive to place order on the exchange ?
    I’m interesting on the topic of bot’s rapidness when the receive a signal in order to take action, I find this issue significant in scalping for example, do you have any content on this topic ?
    Warm regards

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

      Hi Paul,
      thanks a lot for your comment. It actually makes the bot slightly slower (we are talking about milliseconds here) as there is another step involved (reading data from the DB). I have shown how you can directly work with a livestream in my newer videos. Be invited to check them out!

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

    Hi, awesome video!
    One question, what would happen if i dont put the condition "last_entry < -0.0015"?
    Thnks a lot!

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

      Thanks a lot for your comment :-)
      Then you don't have an exit in case the crypto is dropping.
      As an alternative you could implement a (Trailing) Stop Loss. Did that here, be kindly invited to check that out:
      ruclips.net/video/V6z1ME3-0_I/видео.html

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

      @@Algovibes Awesome man, yeah i was checking that one too.
      Have another question.. How could you get live data that doesnt fall on delay.. ? After a while, it keeps writing prices from three minutes ago for example.

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

    Subbed, i want to learn to create my binance bot from this channel, what video i should start with? I dont know coding, but i can follow instructions. Can you recommending the videos from a to z?
    Edit: does this python bot thing creating a lot of data when active 24/7? Can I open multiple position ( something like dca up and dca down) a lot of questions haha..

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

      Hi mate, thanks a lot for your subscription. Please be invited to check out the videos in the cryptobot playlist. Covering basically everything there. Let me know if you need any support!

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

    Thanks alot ,I'll start looking into Crypto trading

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

      Thanks for watching and your support mate :-) Appreciate it. Sure have a look but be aware that it can be a lot more risky than stocks.

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

    Thanks man this is really cool. I'm planning to implement an auto regressive linear regression algorithm to decide when to buy. We'll see how that goes but thanks again!

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

      Thanks a lot. Would be quite curious about your results! Feel free to share them!

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

    Great video! One question, my API connection fetches the pricedata mutliple times per second and then gives an error, how can i reduce the fetching to once per second like it in your program?

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

      Hi buddy, thanks a lot.
      Can you please check out the approach shown here:
      ruclips.net/video/OX5eDJDtqhc/видео.html
      An alternative using websocket would be here:
      ruclips.net/video/mDNIAkEZChg/видео.html
      In a nutshell when using the BSM approach you just have to make sure a message exists before wrapping it in your data frame.

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

      @@Algovibes vielen Dank

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

    Surely German engineer, cos there is no other can explain as this! I respect! (Sorry if you are Austrian) i respect the nation who servicing the quality to the world! Dicipline and all.

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

      Not an engineer :D Anyhow: Thanks a lot for your kind words mate.

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

    you are so helfull man god bless you love from india

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

      Thanks a lot for your kind words Nandan! Love back to 🇮🇳