How To Build A TRADINGBOT Simulation [REALTIME] with Python and the Binance API

Поделиться
HTML-код
  • Опубликовано: 21 май 2024
  • Hi everyone,
    in this video we are setting up a Tradingbot Simulation in Python using the Binance API so that you can live test your own Trading Strategies without using real money.
    Get the Notebook/Source code by becoming a Tier-3 Channel member or get other perks like Discord to exchange with like minded people here:
    / algovibes
    Interested in automated Cryptocurrency Trading?
    Check out the videos in the Cryptobot playlist here:
    • Cryptocurrency Bots / ...
    Disclaimer: This video is not an investment advice and is for informational and educational purposes only.
    Binance API docs:
    binance-docs.github.io/apidoc...
    Websocket docs:
    websocket-client.readthedocs....
    00:00 - 02:14 Introduction / Disclaimer
    02:14 - 08:18 Get a websocket candlestick livestream
    08:18 - 14:04 Data manipulations
    14:04 - 16:40 Return calculation
    16:40 - 18:59 Storing livestream values (using dict)
    18:59 - 24:41 Trading Strategy
    24:41 - 26:25 Running the Simulation / Syntax correction (!)
    #Python #trading #crypto #binance
  • НаукаНаука

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

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

    Hi great content, learning alot from you. But in this video i think after the if in_position statement at the second if and elif statement df._c is a typo, or am i missing something?

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

      Yep! That's simply a typo. Thanks a lot for pointing that out!

  • @flydr2
    @flydr2 Год назад +3

    As usual... Extremely great info and very well explained

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

      Thanks a lot Marc, appreciate your positivity!

  • @rajeevmenon1975
    @rajeevmenon1975 Год назад +2

    I keep a keen watch on when your videos are posted. And now i have been watching your videos twice and thrice and still it never bores me. Thats bcoz of the quality in it. Request to secure your RUclips handle to avoid unnecessary messages of subscribing to a Whatsapp.

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

      Thank you so much man :-) Appreciate your positive attitude! And yes, sorry for any forms of spams/impersonation. I am trying to battle them but it's basically impossible to get fully rid of those.

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

    Awesome, i was just checking youtube for a video like this

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

      Awesome. Thanks a ton for watching :-)

  • @nguyenduyta7136
    @nguyenduyta7136 Год назад +2

    Many Thanks for many useful things. Wishing next time you open a project with a bot detect price is pumping then bot open order ==> then it close after got return 2% or 3%,….. so on . Choose which optimal number of return after backtesting or running optimization . Totally I describe as following:
    1. Detect price pumping
    2. Run optimization to choose a percent number of return which is optimal
    3. Set fund , stoploss and percent number return of a fund for one trade.
    👍👍👍👍

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

      Welcome buddy. Thanks for watching and your suggestion!

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

    i found you yeserdat and your content is great. Thanks for yoour time. A question, ahve you used the Backtesting API?

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

      Thanks buddy. Can you elaborate on Backtesting API? I covered both the Backtesting.py library and Backtrader.

  • @bryan-9742
    @bryan-9742 Год назад +1

    love the concept. can't wait till after the quarter i can take the last month of videos and create ideas with them. i'll try to join the discord. I have a plethora of interview questions if you think it would be useful.

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

      Sure! Looking forward to it. Thanks a lot Bryan

  • @UnknownUserx-xe1tm
    @UnknownUserx-xe1tm Год назад +1

    Great !!

  • @naco747
    @naco747 Год назад +2

    Great job, as always. Didn't understand why you use websocket and not the normal Client() from binance as in other videos. Any help? Thanks.
    By the way, you have a typo when cheching tp, you used 1.0002 instead of 1.002 (23:00).

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

      Thanks a lot Igna. It's just one of many approaches to get live prices. Nothing wrong about using the client!
      Thanks for pointing out the typo!

    • @naco747
      @naco747 Год назад +2

      Than YOU, for the quality content. Keep up the good work!

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

      Hi Igna,
      Here you mean using the create_test_order() function ?

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

    thank you a lot, it is always useful and enjoyable to watch your videos, you explain contents very nice, thank you again, would you please add a database to analyse more details of our bot, i personally can do it but you teach sth useful while doing that and those are very important to improve our skills.

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

      Thanks a ton for your comment mahmood. I really appreciate it!

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

    Hey Algo, thank you very much for the video, it is very useful. But I would like to understand better, is there any advantage/difference to use websocket over the Client from binance?

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

      Welcome mate! Difference is just that when using the Client you are using the code written by the creator of the python-binance library. Which code is exactly being used can be find in the library docs (he is using an async approach).

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

    Great work! I have a question i was wondering if u could help me out? When I run my own script it takes the live price as entry but I want it to take only the open price of the 1min bar and not re-enter after an exit from sl or tp until a new bar opens, can you help me how to code this? Thank you!

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

      Hi buddy. Yea that's possible. There is a value stored in the dict which is containing if a candle is closed or not. You can screen the data ticks if the candle is already closed and implement the logic.

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

      @@Algovibes Thank you! Can you feature this in your next video, I'm new to coding and I have no idea how to write it xd. I'm using the client.get_historical_klines

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

    Thanks! One question, how do I have a cryptocurrency in a different thread and also with a single websocket?

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

      Welcome mate. Can you elaborate on your question?

  • @michaelfelman6186
    @michaelfelman6186 11 месяцев назад +1

    When I run the code at 7:53, i get an output True and nothing else. I have double checked the code and it is exactly as the video. Any suggestions would be greatly appreciated.

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

    There is two conditions where you write "[...] df._c [...]" this should be "df_.c". As seen at 24:38

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

      Correct! Thx for pointing that out.

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

    I find lsma 200 and sma 12 and ema 130 is very good strategy as swing trading ,can you please back test it?

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

      Sounds quite interesting. Thanks a lot for the suggestion!

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

    Hello, Could you make a video showing how to trade using python, google cloud and td api?

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

      Hi mate,
      can you elaborate? what's td? what exactly would you be interested in?
      Cheers!

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

      @@Algovibes Hello, Thankyou for the reply. I have my own python strategy that I have come up with but I want to start trading the strategy with my trade broker using google cloud. my trade broker is TD Ameritrade.

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

    by the way, why did you stop using Python-Binance library?

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

      Nope! Still super useful. Check out my newest video e.g. :-)

  • @quant-prep2843
    @quant-prep2843 Год назад

    build a tutorial on orderbook building across multiple crypto exchanges, and how to standardize it etc

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

    When i attempt to run the cell output True. No stream comes on screen

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

      Can you double check that you don't make the mistake I made in the video (I am correcting the syntax in a later moment of the video).

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

    great video man, saw you using df_.c at first and somehow using df._c under if in_position, and it's working in your video lol

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

      Thanks mate. Can you provide a timestamp? Happy to double check!

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

    I am fadcinated by it but completely lost how do I start?

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

      Thanks buddy. Happy to read. Well where do you need a hint? I have a ton of videos for different skill levels. I am happy to recommend some stuff if you tell me where do you see your current skill level currently.

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

      @@Algovibes hey sorry for the late reply to be honest im lost with coding could you maybe give me some advice on how to get started on that? Im very overwhelmed by all the resources out there and realise that I need a solid knowledge of coding before I can dive into this

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

    how to becoming a Tier-3 Channel member

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

      Hi Dhanushka,
      thanks for your interest! Just go on my channel page and click on the Join button.
      Looking forward to welcome you! :-)

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

    I have no idea what I'm doing wrong but when I follow along with this vid, the websocket library, doesn't seem to work for me (websocket.WebSocketApp doesn't work) I went through the asyncio/websockets method instead, and it got me a live connection with Binance. I'm just fumbling around but if anyone encounters this issue this is the fix that worked for me

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

      Hi buddy, thanks a lot for sharing an alternative approach. Anyhow websocket should work. Best thing is to start with an easy print out of the stream and then build on that.