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

Поделиться
HTML-код
  • Опубликовано: 20 дек 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!

  • @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

  • @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 :-)

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

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

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

      Can you elaborate on your question? Thx a lot

  • @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?

  • @romeogaming6424
    @romeogaming6424 3 года назад +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  3 года назад

      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.

  • @bullfrogiesable
    @bullfrogiesable 3 года назад +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  3 года назад +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.

  • @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?

  • @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.

  • @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: ruclips.net/video/HB1CLz0Z1NY/видео.html

  • @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:
      ruclips.net/video/_IV1qfSPPwI/видео.html

  • @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.

  • @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?

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

    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?

  • @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

  • @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:
      ruclips.net/video/X50-c54BWV8/видео.html
      ?
      Might be interesting for you. Anyhow: Thanks a lot for the suggestion!

  • @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.

  • @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.

  • @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

  • @jitkadyan
    @jitkadyan 3 года назад +1

    Another Great Video sir

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

      Thank you my friend!

  • @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.

  • @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):
      ruclips.net/video/X50-c54BWV8/видео.html

  • @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 :-)

  • @duttasubhamoy
    @duttasubhamoy 3 года назад +1

    Can we short sell crypto using trading bots?

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

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

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

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

  • @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:
      ruclips.net/video/mDNIAkEZChg/видео.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.

  • @ibn-nafis3434
    @ibn-nafis3434 3 года назад +1

    Any codesource link, please

  • @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.

  • @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

  • @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 2 года назад

      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: ruclips.net/video/Yj0yEBxwLVw/видео.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.

  • @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.

  • @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.

  • @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.

  • @FRANKWHITE1996
    @FRANKWHITE1996 3 года назад +1

    Thanks for sharing

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

      Thanks for watching buddy :-)

  • @goksuceylan8844
    @goksuceylan8844 3 года назад +1

    thank you so muchhh

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

      Thanks for watching buddy :-)

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

    Thank you.

  • @mdjuneid3553
    @mdjuneid3553 3 года назад +1

    Sir Bitmex api please

  • @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?

  • @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.

  • @TheCoolsurdy
    @TheCoolsurdy 3 года назад +1

    Made a strategy that’s not profitable. Nice

  • @pushkarajchillal5018
    @pushkarajchillal5018 3 года назад +1

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

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

    wolyume

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

      Sounds right to me :D

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

      @@Algovibes hahaha of course it does...