How To Build an Intraday MACD Cryptocurrency Live Trading Bot with Python using the Binance API

Поділитися
Вставка
  • Опубліковано 27 жов 2024

КОМЕНТАРІ • 113

  • @eduardob5463
    @eduardob5463 3 роки тому +10

    Well well well my friend, not only it’s a great explanation, also the code that you wrote was very clear until the last line! Congratulations, and keep like this!! Sincererelly, your fan! 😎👍💪👌

    • @Algovibes
      @Algovibes  3 роки тому +1

      Thanks a lot buddy :-) Happy to have you on board!

  • @kommayetali4540
    @kommayetali4540 3 роки тому +3

    amazing , straight forward approach , well done , sir , could we scan markets for different assets (loop through symbols ) that match the criteria(macd) instead of defining one symbol , this will be practical intraday approach , thank you

    • @Algovibes
      @Algovibes  3 роки тому +2

      Thanks for your kind comment :-)
      I am actually planning on something like that in the upcoming months! I already did something similar for stocks (Recommender system series). Thanks for your suggestion!

  • @javadvahedi6278
    @javadvahedi6278 3 роки тому +2

    Great many thanks for the great video. As a suggestion it could be great if could have a video on a bot trading based on mixed andicators, namely the SSE hybrid and QQE.

    • @Algovibes
      @Algovibes  3 роки тому +1

      Thanks for watching :-) Did you check out this one here:
      ua-cam.com/video/X50-c54BWV8/v-deo.html
      ?
      Might be interesting for you. Anyhow: Thanks a lot for the suggestion!

  • @rafalsza
    @rafalsza 3 роки тому +6

    Fetching new bars for 2021-08-18T15:12:50.044487
    Profit percentage of the MACD strategy for BNB : 50.95 % | backtest time: 3 months ago UTC | interval:1h
    Positive: 34 Negative: 52
    Fetching new bars for 2021-08-18T16:04:50.011641
    Profit percentage of the MACD strategy for REEF : -94.38 % | backtest time: 6 months ago UTC | interval:1h
    Positive: 60 Negative: 121

    • @Algovibes
      @Algovibes  3 роки тому

      Interesting! Thanks for sharing buddy

  • @jitkadyan
    @jitkadyan 3 роки тому +1

    Another Great Video sir

  • @MrMalcovic
    @MrMalcovic 2 роки тому +1

    Got a like for your comment about compensating for your losses! XD

  • @sirjaylpt
    @sirjaylpt 3 роки тому +1

    Hi. Need help. My binance api connection keeps getting disconnected

    • @Algovibes
      @Algovibes  3 роки тому

      Can you elaborate when this is happening and what errors are occurring?

  • @zkhanzut
    @zkhanzut 2 роки тому +1

    Thanks mate, would you please show some examples for Webhook using Python. Much appreciated Thank!

    • @Algovibes
      @Algovibes  2 роки тому

      Welcome! I have covered that in the cryptobot playlist. Be invited to check the videos out.

  • @randomdude79404
    @randomdude79404 3 роки тому +2

    Dear AlgoVibes , request a series where you create a robust backtesting system (code along) in Python , something that we can put on our resume as a data science project / quant project !
    Those that agree 👍🏽 the post

    • @Algovibes
      @Algovibes  3 роки тому +1

      Thanks for the suggestion! Its not on my list for near future content but I am planning on some more backtesting stuff in general for sure in the upcoming months.

    • @randomdude79404
      @randomdude79404 3 роки тому

      @@Algovibes A backtesting framework that's allows switching of timeframes would be good , also taking into account things such as latency, slippage , spread etc... In the backtest.

  • @dwightschrute483
    @dwightschrute483 2 роки тому +2

    How should we change the code to using 1 hour macd data? By the way thanks for the guide :)

    • @Algovibes
      @Algovibes  2 роки тому +1

      Hi man, thanks a lot for watching. For resample the time index please watch this one here: ua-cam.com/video/HB1CLz0Z1NY/v-deo.html

  • @devinkrike5968
    @devinkrike5968 Рік тому

    I think there is a problem with the script. For example, if you are already starting with open position, then the code will never reach it because it is stuck in a while loop on the first line. It will only get out of that loop when open_position is false and buy condition is met. if I am not mistaken, wouldn't it better to check for the position before the while loop? like you do when the open_position is true. Please advise. Heck, since you already have a while loop going in the main script, is there really a need to have it in the tradingstrat function?

  • @luisguerra721
    @luisguerra721 3 роки тому +2

    Excelent video, thanks.
    Just wondering if a strategy based on trading volumes would be more accurate for cryptos, given for currencies its normaly more correlated with price moves.
    Cheers

    • @Algovibes
      @Algovibes  3 роки тому

      Interesting question! I actually thought of integrating volume in one of my future cryptobot vids. Thanks for your kind words btw :-)

  • @Kacisse
    @Kacisse 3 роки тому +1

    noob question, the jupyter notebook says "No module named binance". Should we install the library throug pip install on our computer for it to work ? I'm on the web version.

    • @Algovibes
      @Algovibes  3 роки тому

      Yes. You need to set it up first. I have covered it here:
      ua-cam.com/video/_IV1qfSPPwI/v-deo.html

  • @FRANKWHITE1996
    @FRANKWHITE1996 3 роки тому +1

    Thanks for sharing

    • @Algovibes
      @Algovibes  3 роки тому

      Thanks for watching buddy :-)

  • @enjoi5838
    @enjoi5838 3 роки тому +2

    It's a very good and excellent video, very informative. ,i want to see how to make a bot to trade binance future usd -m

    • @Algovibes
      @Algovibes  3 роки тому

      Thank you mate. Appreciate your comment. Futures are on my list. Probably somewhen the next months.

  • @glikar1
    @glikar1 3 роки тому +1

    Thanks!

    • @Algovibes
      @Algovibes  3 роки тому

      Thanks a lot buddy for using the Super Thanks feature. BTW I have some other bots in my cryptobot playlist. Be kindly invited to check them out :-)

  • @goksuceylan8844
    @goksuceylan8844 3 роки тому +1

    thank you so muchhh

    • @Algovibes
      @Algovibes  3 роки тому

      Thanks for watching buddy :-)

  • @codepen_uz1720
    @codepen_uz1720 11 місяців тому

    hi bro. i have an error that like Account has insufficient balance for requested action but before the error the bot buy tokens can u help me please?

  • @HimanshuSharma-bz2gh
    @HimanshuSharma-bz2gh 3 роки тому +1

    Thank you.

  • @bullfrogiesable
    @bullfrogiesable 2 роки тому +1

    How can I go about backtesting this strategy that I have modified with a TP and SL? Im really confused on were to start with the backtesting. I have watched your other videos as well.

    • @Algovibes
      @Algovibes  2 роки тому +1

      Gonna cover Crypto Backtesting more detailed in the upcoming months. Until then I have a bunch of video on Backtesting trading strategies. Be invited to check out the Python for Finance playlist.

  • @raulalejandromunozaraya3878
    @raulalejandromunozaraya3878 2 роки тому +1

    why are u using jhub? for the use of pandas?

    • @Algovibes
      @Algovibes  2 роки тому

      Can you elaborate on your question? Thx a lot

  • @ageens
    @ageens 3 роки тому +1

    not like I am a trader or programmer, but are you sure you do not want buy/sell at the MACD_diff min and max values? Why 0?

    • @Algovibes
      @Algovibes  3 роки тому +1

      Might be possible as well. I just took the cross of the two lines.

  • @jr12245
    @jr12245 2 роки тому +1

    I am just a beginner in the topic but, I was wondering how many api calls are being done with this method? it seems that some of them are unnecessary since we are pulling 1min kandles and we are going to be doing api calls during that period of time. Likewise, would not be more suitable to use a stream of data instead of http requests? thank you very much for the video! :D

    • @Algovibes
      @Algovibes  2 роки тому

      Hi Jordi,
      yes that's a very good point! Please check out the other videos in the cryptobot playlist. I am showing how to work with websockets instead of api calls and much more stuff. This is just an example with simplifying assumptions.

  • @danielchung5415
    @danielchung5415 3 роки тому +2

    hello, newbie from Hong Kong, i wanna ask if we should verify the last MACD DIFF is calculated from the kline that is closed?
    As i compare my order execution with the data from the Binance web, the MACD crossing time is different from this script. That's why i wanna see if we should be so

    • @Algovibes
      @Algovibes  3 роки тому +1

      Hi man, that's awesome. Been to Hong Kong once! It was super interesting.
      You have an actual good point here. The last row of the historical data frame is pulling recent prices and CAN be NOT the closed candle.
      When you are working with a stream you can actually check if the candle is closed. I am working with streams in my newer videos.

    • @miltonfernandez9832
      @miltonfernandez9832 3 роки тому

      @@Algovibes Hi, so, what should we do to get the data from the close of the candle?

    • @miltonfernandez9832
      @miltonfernandez9832 3 роки тому

      @@Algovibes instead of the current price?

  • @romeogaming6424
    @romeogaming6424 2 роки тому +1

    Hi, thanks for the video. Do you know why the values for macd differs from the ones in tradingview? im looking the same invterval of time, and the same source "Binance". The further I get away in time the more it differs.

    • @Algovibes
      @Algovibes  2 роки тому

      Hi man, thx for watching. Probably another indicator setting? Did you check for the same timeframe? Do you have an example?

    • @knawursztlow2416
      @knawursztlow2416 2 роки тому

      Don't know why but values on tradingview are slightly different than values from binance when you look on small intervals.

  • @piotrlorenc1762
    @piotrlorenc1762 3 роки тому +1

    great tutorials, love all of them. Is it possible to place an order with binance API using amount I want to spend when buying instead of quantity?

    • @Algovibes
      @Algovibes  3 роки тому +2

      Hi buddy, thanks a lot :-)
      Not quite sure if directly with the order execution but you can do that by pulling the current price, calculate the quantity you can afford with a set capital and than just place the quantity as an order.

    • @vamsikrishnagannamaneni912
      @vamsikrishnagannamaneni912 Рік тому

      Yes with simple formula quantity = amount/currentPrice

  • @harshadbhirud
    @harshadbhirud 3 роки тому

    to get trade more profitable we need to check MACD line crossing above to signal line crossover on negative values.
    also sell when we need to check MACD line crossing bellow to signal line on positive values

    • @Algovibes
      @Algovibes  3 роки тому

      Not quite sure if I got this. Could you elaborate? Thanks in advance!

    • @harshadbhirud
      @harshadbhirud 3 роки тому +2

      @@Algovibes macd value and signal value should be negative when macd is going above signal line ie (macd.diff positive). And MACD and signal should be positive at time of cross over (MACD.diff is Negative)

    • @bas18872
      @bas18872 3 роки тому +2

      @@Algovibes maybe you can extend the strategy to a for loop and apply this additional strategy: ua-cam.com/video/Yj0yEBxwLVw/v-deo.html
      now I use for the open position:
      open_position = client.get_asset_balance(symbol[:3])
      open_position = float(open_position['free'])
      open_position = bool(open_position)
      open_position

    • @juank46983
      @juank46983 3 роки тому

      ​@@bas18872 I watched that video, but still I am beginning. Would you mind give us full script, thank in advance.

  • @matttatten7791
    @matttatten7791 2 роки тому +1

    Great video! Very informative. I am just wondering if there is a way of having the trade quantity (qty) as 100% of your funds/balance? With the current setup, if a buy order is triggered, then the price falls quickly; an APIError code 2010 insufficient balance is displayed.

    • @Algovibes
      @Algovibes  2 роки тому +1

      Thanks a lot mate. You got to set the commission asset to BNB. With that you are avoiding this error.

    • @matttatten7791
      @matttatten7791 2 роки тому +1

      @@Algovibes Thank you. Very helpful

  • @decoded47
    @decoded47 2 роки тому +1

    hey bro can cover the ema strategy aswell

    • @Algovibes
      @Algovibes  2 роки тому

      Hi mate, can you elaborate what you would like to see?

    • @decoded47
      @decoded47 2 роки тому +1

      @@Algovibes brother I am working on a bot that takes data and gives buying signal when 9ema crosses 18 and sells for vice versa

  • @ztrading16
    @ztrading16 3 роки тому

    Great content !! Can we have your notebooks please ?

    • @Algovibes
      @Algovibes  3 роки тому

      Hi, thanks for your comment :-)
      Planning on a website where I publish the code. Won't be in the near future but probably within this year.

  • @fuba44
    @fuba44 2 роки тому +1

    Maybe it's because you are trading eth, but why is it that you don't need to set the amount oc decimals or worry about the lotsize when placing an order, I'm have problems with these. A specially when trading lower priced assets. Like xmr or TRX.

    • @Algovibes
      @Algovibes  2 роки тому +1

      Addressed it here:
      ua-cam.com/video/mDNIAkEZChg/v-deo.html

    • @fuba44
      @fuba44 2 роки тому

      @@Algovibes thank you, i did manage to get the issue sorted. Funny that i missed it in your video, kind of feel i watched em pretty thoroughly. Really like your channel.

  • @umayangaphone4296
    @umayangaphone4296 3 роки тому +1

    AttributeError: module 'talib' has no attribute 'trend how to fix ? plz

    • @Algovibes
      @Algovibes  3 роки тому

      I am working with ta here not talib. That's the problem. Use ta and it will be fine.

  • @TheCoolsurdy
    @TheCoolsurdy 2 роки тому +1

    Made a strategy that’s not profitable. Nice

  • @rafalziolek
    @rafalziolek 3 роки тому +1

    Does this script make profit or rather loss?

    • @Algovibes
      @Algovibes  3 роки тому +1

      Without having backtested it my guess is it would rather result in a loss. It is just an example how the MACD can be applied.
      Check out my newest cryptobot, I played around with combining some indicators (which doesn't mean that this is a guaranteed win):
      ua-cam.com/video/X50-c54BWV8/v-deo.html

  • @duttasubhamoy
    @duttasubhamoy 2 роки тому +1

    Can we short sell crypto using trading bots?

    • @Algovibes
      @Algovibes  2 роки тому

      Yes. You would need to trade futures/Options OR DOWN coins to achieve that.

  • @SamarKhan-mn1gk
    @SamarKhan-mn1gk 3 роки тому +1

    Please make robot on rsi indicator which work on binance exchange just like when rsi 14 is on level 30 its open a buy (long) trade and when rsi 14 hits level 70 its open a sell trade ??

    • @Algovibes
      @Algovibes  3 роки тому +1

      Hi mate, thanks for your suggestion! :-)
      Planning on a RSI strategy but I probably wanna combine the RSI with another indicator as I doubt this would be profitable. But worth a try for sure!

    • @SamarKhan-mn1gk
      @SamarKhan-mn1gk 3 роки тому +1

      @@Algovibes ok thank you

  • @ibn-nafis3434
    @ibn-nafis3434 3 роки тому +1

    Any codesource link, please

  • @xd39deepsingh69
    @xd39deepsingh69 3 роки тому

    How much does it makes on an average of 100 dollars n time period of the profit?

    • @Algovibes
      @Algovibes  3 роки тому +2

      Probably negative profits. It is just a MACD strategy based on the most recent time steps. Don't see this as a valid strategy. It is just to show how you could implement technicals in a bot.

  • @MrPhongle123
    @MrPhongle123 2 роки тому +1

    Please make video bot trading only rsi

    • @Algovibes
      @Algovibes  2 роки тому +1

      Only RSI? Where would you see the advantage? I have videos where I am incorporating the RSI along with other indicators - be kindly invited to check out my cryptobot playlist.

  • @luanleandro2618
    @luanleandro2618 3 роки тому +1

    I need the cryptocurrencies that were high this month, can you help me?

    • @Algovibes
      @Algovibes  3 роки тому

      You mean cryptos which have risen the most in the current month?

  • @mdjuneid3553
    @mdjuneid3553 3 роки тому +1

    Sir Bitmex api please

  • @chapmansbg
    @chapmansbg 3 роки тому +1

    wolyume

    • @Algovibes
      @Algovibes  3 роки тому

      Sounds right to me :D

    • @chapmansbg
      @chapmansbg 3 роки тому

      @@Algovibes hahaha of course it does...

  • @pushkarajchillal5018
    @pushkarajchillal5018 3 роки тому +1

    bro can u provide email id = i want to coonect with you wanted to dicuss about stratergy.

  • @antonioluchinger8115
    @antonioluchinger8115 2 роки тому +1

    How to contact you for a coding service, thanks

    • @Algovibes
      @Algovibes  2 роки тому

      Hi antonio,
      you can contact me over the mail in the about section. I am curently not doing any one on one consulting tho.