Cryptocurrency 💰 Trading Bot 🤖 with Python & Binance - Reversal & Trailing Stop Loss

Поделиться
HTML-код
  • Опубликовано: 8 июн 2024
  • Hi everyone,
    In this video we are building a cryptocurrency trading bot which buying condition is based on a reversal of the recent past return and is taking a Trailing Stop Loss for the selling condition.
    In the end I did some cuts as the Stop Loss Order was being triggered after roughly one hour.
    Get the Notebook/Source code by becoming a Tier-2 Channel member:
    / @algovibes
    If you like the content please subscribe to make future content possible. Thank you very much in advance! :-)
    Let me know what you think or let me know your questions in the comment below.
    Please watch the previous video to better along:
    • How To Build a Simple ...
    Video on cumulating returns:
    • How To Calculate Stock...
    Disclaimer: This video is for educational and entertainment purposes only and is not an investment advice!
    0:00 - 0:51 Trading strategy
    0:51 - 02:42 What is a Trailing Stop Loss?
    02:42 - 03:45 Subscribe etc. and Disclaimer
    03:45 - 05:00 First script: Getting live data via socket manager / SQLite storage
    05:00 - 07:00 Second script: Connect to SQLite database and the Binance API
    07:00 - 07:45 Request live data by SQL to dataframe
    07:45 - 10:24 Coding example of Trailing Stop Loss
    10:24 - 15:38 Coding the strategy: Buying condition (Reversal)
    15:38 - 21:38 Coding the strategy: Selling condition (Trailing Stop Loss)
    21:38 - 25:18 Testing the strategy / Discussing the trade outcome
    #Python #Trading #Crypto

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

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

    Hi everyone, please note there is a mistake in the script at 20:50.
    Instead of taking the first valid entry it should be the last valid entry or just iloc for the very last row and check if the condition is fulfilled.
    Thanks DanyC for pointing that out!

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

    Just found your channel. Loving this series, fantastic work. Subbed.

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

      Thank you mate :-) Appreciate your comment and your sub.

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

    Best vid ever... Good job Algo

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

    always look forward to your videos!

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

    Let me thank you first for amazing content.. Keep your research on and on.. All the best!

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

      Let me thank YOU for this kind and appreciative comment :-) All the best for you as well!

  • @Forexi-33-28
    @Forexi-33-28 2 года назад +1

    I enjoyed watching , Thankyou.

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

      That's great to read. Thanks a lot for watching :-)

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

    Thank you for creating these videos. They are goldmine of knowledge

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

      Thanks a ton mate. Happy to read that!

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

    Tremendous content! I really appreciate your videos... gives hope to a newbie programmer like me that I could actually augment my trading with Python.

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

      Thanks a lot buddy. Very happy to hear that :-)

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

      @@RobinArgumido I think much of the problem is invalid handling of the process from IS/OOS results to Monte Carlo, maybe WFA, and beyond. Most consumers don't get anywhere close to seeing these details. They fall for the marketing. And in case you're wondering, I'm not a believer in Galileo FX until I see the product and backtest it for myself. I would encourage every prospective customer to do the same.

  • @jithin.johnson
    @jithin.johnson 2 года назад +1

    you're a gem mate 🙌🏼❤️

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

      Thanks buddy ❤️

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

    dude, totally subscribed

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

      Thank you very much :-)

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

    I'm "like number" 500... Just saying I'm pretty special.... Also i like your content!

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

      Thanks for liking and checking out my stuff man

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

    Great video thank you for sharing

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

      Thank you very much for watching mate! Appreciate your comment :-)

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

    Okay, subbed :)

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

      Thank you so much! :-)

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

    Auch top erklärt, gute Geschwindigkeit, freue mich auf die nächsten! Cool wär' noch, wenn der bot periodisch den Zwischenstand des Trades in % printet, aber das ist ja nicht so schwierig, es selbst noch zu tun hehe. Was hältst du von Gridbots? Haste damit schon Erfahrungen gesasmmelt? Denke mir, relativ risky, falls die coin in den brunnen fällt aber bei verlässlichem sideways movement sicherlich ne gute Sache. Anyways, Danke erstmal für das video 🙂

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

      Glaube das habe ich in einem anderen Video mal gemacht, erinnere mich gerade nicht welches. Irgendeins in der cryptobot playlist :D
      Hab ich schon von gehört, aber noch keinen konstruiert. Aber vielleicht ja in der Zukunft.

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

    Hey nice video, congrats! I have a doubt about the stop condition, you are using the first_valid_index(), but should not be the last_valid_index() what we need here? because in the case of fist_valid_index yo get always the same row. Did i miss something here ?

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

      Thank you so much! You are absolutely right. No idea what was going through my head there. I referenced to you in the pinned comment.

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

    Hey Algovibes, thanks for the video as always.
    Let me ask you : why those values arent exactly the same as the binance portal ? It seems that using the link api is more accurate than the socket manager

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

      Thanks for watching and your comment :-)
      You already considered the 0.5 - 1 second time lag due to the database incorporation, right?
      Can you give me an example for your observation? Highly appreciated!

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

    Great Content, Bring some more strategy with trailing stop loss.

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

      Thank you very much for your feedback. Truly appreciate it! :-)

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

    Fantastic

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

    Hi Algovibes, thanks for the video. I'm wondering if there's a situation where the qty BOUGHT > qty when the bot will try to SELL due to commission? If this is the case I imagine you'll receive an error when it tries to sell? I'm wondering how you can get around this, 1 solution might be to update qty after the BUY order by subtracting the commission? Then you might run into the qty being defined as a float with too many decimal places such that it's defined past the min step size of the order. Do you have any thoughts on this?

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

      Hi man, thanks for your comment. Please just set the commission asset to BNB. You won't run into these problems then and just have to make sure you have a small deposit of BNB in your account.

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

    Really good job Algo

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

      Thanks mate, appreciate your feedback :-)

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

    Hi, very recently discovered your videos, very good. Do you ever backtest a strategy before running it on your real account? I mean testing it on e.g. 5 years of historical data. And only starting it with real money if the strategy has proven to be profitable on this backtesting period.

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

      Awesome to have you on board! Thank you :-)
      I am one of those guys who doesn't "believe" in technical indicators - BUT I love to try to prove myself wrong in implementing them. If they seem to look good in a backtest on a x min timeframe I am occasionally throwing some cash in.
      The advantage for traders who might have an edge with Technical Indicators with building those bots is: you don't have to be in front of multiple screens and wait until certain thresholds are crossed wasting your time.
      Privately I like to work with a technique which is classifying based on the time series on the last x days if the asset is going up only, then take a certain profit (target profit) and set a Trailing Stop Loss. With that I can avoid things like greedy behavior etc.
      Hope this is giving you some insights!

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

    Hi Algo, I m watching few different video of the playlist (very good content by the way ty).
    One question pop in my head about the difference between the way you can get the data. Is there a difference between the binanceWebsocket module and the the websocket ? I understand the purpose is to connect to binance stream but is there one more efficient than the other ?

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

      Hey Baptiste, thanks you very much.
      Just different ways to connect to the websocket. I would recommend using the unicorn-binance lib. Was using it in one of my newer videos in the cryptobot playlist.

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

    @Algovibes, Amazing videos! You have helped me tremendously in building my first ever trading bot. I do have a question though: What is the benefit of writing the dataframes into a db first and then pulling it back up to monitor/trace the stop loss? Couldn’t you theoretically keep the data in the pandas dataframe and work with the entries directly from there?

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

      Hey man, that's great to hear! You don't have to do that, it's just an idea. I have a lot of other approaches (e.g. csv storage) in my cryptobot playlist. Be kindly invited to check them out.
      And yes. You can also do it with a in memory storage (keeping them in a data frame) - only downside is you could run out of memory.

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

      You can do that, but the problem is when you shut down the bot it will lose its state. So you will need to periodically persist your data so that the next time you start the bot again, it can continue from existing trades and states.

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

    THank you...

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

      Thank YOU for watching :-)

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

    Fantastic, One request, how can we stream live klines for Binance Futures contracts ? I looked into documentation but got confused, any syntax for the same, or its very complicated for us, thanks

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

      Hi buddy, thanks a bunch for your comment :-)
      Worked with Klines on the very first one, did you check that?
      Be kindly invited to do so:
      ruclips.net/video/_IV1qfSPPwI/видео.html
      Otherwise this might be helpful for you:
      www.binance.com/de/support/faq/e707685b4e0f408fa7c1b9ccd8ea7aa9/

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

    Hi Algovibes, First of all thank you for all the videos you make. I have learned a lot from it. However, I have a question regarding backtesting and I hope you could help me. I would like to know when I resample a (crypto) data frame to, for example, 20 minutes or in those 20 minutes my trade met my take profit condition or my stop loss condition. So it must be calculated whether the High or Low of each minute achieves the percentage of my take profit or stop loss compared to the Open of the first minute or not. If not then move on to the next minute. How can I best do this? Thank you in advance.

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

      Hi man, thanks a lot for your comment! I think I covered an - at least - similar situation here:
      ruclips.net/video/4MnNft7Squk/видео.html
      Let me know if that gives you a hint.

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

      @@Algovibes thank you for pointing me to the video, it looks promising. I'm trying to fit that code to what I want. It's not going quite the way I want, but I'll keep trying.

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

    Could you please do a video on a smoothed moving average ? I have been trying to code it in python but somehow here is a difference in the result Tradingview gives VS what my algo does. . . . may be i dont understand the concept of smoothing .....

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

      Thanks for the suggestion. Really appreciate it! I will see what I can do.

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

    really great

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

      Thanks for your feedback :-) Appreciate it!

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

    Thank you for your amazing videos! I was wondering if you have any plans to do a Futures Trading Bot video? We would highly appreciate it if you can do one or guide me. :D Keep up the good work!!

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

      Thanks for checking them out man. Yes it is on my list but it's quite a challenge to build a real futures trading bot with the Binance API as in my country binance futures have been banned. But maybe I can use the testnet. Let's see...

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

    Hey there! Your Content is out of the world, how do you host the bot so that it runs 24/7 without having your Computer running all the time?

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

      Hi and thanks for your kind words, really appreciate it :-)
      I have some content on cloud hosting. Be invited to check that out:
      First video:
      ruclips.net/video/lIJlhKrP_SI/видео.html
      Third video is about executing your scripts with cronjobs. Hope that is helping you out!

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

    in order to run the engine do we have to install MySQL? or the modules in python are enough?
    actually where does the DataStream gets stored and how can we delete if not required for later?

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

      No, I was working with SQLite in this video, wasn't I?
      The data stream is stored in your defined table and you can delete it with SQL queries.
      Hope this helps!

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

      ​@@Algovibes I am able to get live data from 1st script but while running the 2nd script i am getting an error as
      AttributeError: 'OptionEngine' object has no attribute 'execute'.
      at line df= pd.read_sql(pair, engine)
      unable to move forward please help!

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

    Hi Algovibes, I would first highly appreciate for the rich and highly informative content out here. I hope to see more of your videos, but in the mean time i was i wondering if u could incorporate a trailing buy order with this bot.

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

      Very welcome Abdirashid! Also thx for the suggestion. Be invited to check out my cryptobot playlist. I already implemented a ton of concepts there.

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

      @@Algovibes I have definitely seen almost every video out there and they are all amazing. I would love to here if u recommend a specific video which covers the concept of trailing buy order🙏

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

    Nice video.Please I'll like to know if it is possible to automate Binance convertion(converting from one crypto to another) with Python. If so, how?

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

      Good question. Pretty sure it isn't possible and I honestly wouldn't see the advantage of being able to do that.

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

    As always another instructional video. I have a question, if the price falls into some percentage and buy trigger occurs, and price continues to fall then it will just stopped out right? So is it possible to make a strategy where price falls and after turning back we trigger the buy signal? Otherwise if we create a buy signal as price falls, and continues to fall this won't be profitable right? Thanks for this interesting video keep it up

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

      Thanks for watching and your comment :-)
      Regarding the first question: Yes, you got it. The next question is dependend on the strategy you want to rock. You can code a trend following strategy as I did in the previous video but you could also extend the strategy and only buy when the asset has fallen beforehand and gained afterwards. And yes, the strategy won't be profitable when the asset falls but the loss is limited due to the Stop Loss mechanism.
      The possibilities are kind of endless. With my videos I just want to pass some ideas what you can do. Of course everything I code is extensible.

    • @Raamanush
      @Raamanush 2 месяца назад

      Hi @algovibes, great video! Love your content and have already subbed the channel, I have the same question, once the benchmark is set at peak and the market falls then the close price will always be lower than TSL, I could think of this solution but let me know your thoughts, what do you think about calculating benchmark on a rolling basis on last n number of rows e.g. last 14 rows or may be 20. The point I am trying to make is to make benchmark more dynamic and avoid the condition of triggering SL in such situations? Would love to hear your thoughts.

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

    The entry in the code looks like a dymatic threshold,i suggest we can use a rolling exponentially weighted standard deviation of returns(a better alternative) ,which if one cumreturn above ,we order.Cos it forcus on volatility for a long time and making us to do a stable decision.Just not a mature idea😉

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

      Thanks for sharing your thoughts!

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

    Do you have any specific pattern in your minde that this trailing code can burst?

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

      Got an example what you are thinking of?

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

    Is it possible to backtest a stoploss condition using historical data instead of testing it live? I have learned much on how to backtest like in your Stoch/RSI/MACD trading bot video, but I am still trying to backtest using a stop loss in conjunction with an indicator sell condition. Thanks!

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

      It is in fact possible but it will always be biased. Reason behind that is, the data is not granular enough. Let's say you are buying for amount x. Historical you will only have say 1 minute candles meaning you know the open, high, low and close after that minute but you don't know exactly for which price you bought. Ofc If you design your strategy to buy only closed candles you can design a SL but if you take data intra candles it will be biased. Hope that is answering your question!

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

      @@Algovibes Yes that makes sense, thank you! I have many ideas for strategies but unfortunately they are being bottlenecked by my elementary Python knowledge. I have been looking into trading bot platforms that allow you to customize and backtest your own bots but knowing how to code gives you a massive edge. I have been thinking about the potential of using machine learning and backtesting large amounts of historical data and test with every variation and combination of parameters you tell it to. I imagine this might be what large institutions do? Sorry for the long comment haha, but I imagine you probably have some good insight on this topic 😄

  • @ahmed-Alziyadi
    @ahmed-Alziyadi 2 года назад +1

    Hi bro, thanks again for this video, please tell me what to do in this case:
    Instead of opennig new order I want the script just tell me the entry price.
    Then instead of the selling order i want the bot just type the stop losses signales.

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

      Welcome mate. Just print out the current price and do the same for the selling price instead of defining orders. But I got paper trading on my list as well, might be covered in the upcoming months.

    • @ahmed-Alziyadi
      @ahmed-Alziyadi 2 года назад

      @@Algovibes
      Thanks,
      Is that mean just like this:
      print(price)
      ?

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

    @Algovibes, Hello, could you help me please. I've incorporated the trailing stop loss feature you showed us in your video into one of my bots. I modified it slightly but I'm having trouble implementing it in my program structure. Would it be possible to take a look? thanks in advance.

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

      Hi mate, be invited to join my discord and raise the question there or just here in the comments. Thanks!

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

      @@Algovibes fsociety#4919

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

    Sir, What are the libraries need to be installed to run this code apart from basic python. on one of the other videos i didnt realise i need to install TA-lib to run the code. Likewise what are the packages to be installed to run this code.... Fellow subscribers can please share your knowledge...

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

      I didn't use TA-lib. I am using ta which is a technical analysis python library as well:
      technical-analysis-library-in-python.readthedocs.io/en/latest/
      I explained how to set up the Binance API wrapper here:
      ruclips.net/video/_IV1qfSPPwI/видео.html
      Stuff on Databases can be found here:
      ruclips.net/video/pU53JUhSnkY/видео.html
      and:
      ruclips.net/video/5bUn-D4eL4k/видео.html
      Hope this is helping you out!

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

    Perhaps put msg into a deque instead of a db. Then no worries about getting too large.

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

      Very good idea. The other solution is btw just to manage the database by deleting entries older than x.

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

    When I start the function for collecting the data, it stops after certain period of time, and return an error:
    "None of [Index(['s', 'E', 'p'], dtype='object')] are in the [columns]"
    can someone help please?

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

      Some people have that problem. I don't have it but I am trying to show another approach in one of the next videos to get rid of that. Sorry for the inconveniences!

    • @AbdulRehman-cx9kc
      @AbdulRehman-cx9kc 2 года назад

      I think this error has something to do with the number of API calls you are requesting. As far as I understood, there is a limit on the number of API calls per minute or something like that, I am not 100% sure as I am also just starting with this topic. you can probably avoid this error by calling the API after every 30sec or so.

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

      Hi Guys, problem is solved here: ruclips.net/video/OX5eDJDtqhc/видео.html

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

    do the entry value always have to begin with -0.00xx? same for TSLA (0.995)

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

      The strategy is checking if a certain threshold is reached in terms of cumulating returns. It buys the asset as it is assumed the asset will reverse after reaching this threshold. I am picking a drop of 0.15% here so 0.0015.
      If you want to pick a drop of say 1% you would have to define 0.01. The negative sign accounts for the drop. You can amend the strategy function if the negative sign is confusing.
      Is this answering your question?

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

      @@Algovibes thank you so much good sir.

  • @LUIZ-uf6ln
    @LUIZ-uf6ln 2 года назад +1

    Hi ,When running the script to save the data to the database after a few minutes it stops with this error
    KeyError: "None of [Index(['s', 'E', 'p'], dtype='object')] are in the [columns]"

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

      Yeah, this problem occurs for some people. I am trying to show another approach in one of the next videos to get rid of that. Sorry for the inconveniences!

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

      Problem solved here: ruclips.net/video/OX5eDJDtqhc/видео.html

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

    would you make a tutorial about creating margin order in python-binance :))

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

      Thanks for the suggestion!
      Didn't plan that yet but I noted that for possible future content.

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

    I see you have experience python can you tell me the best way, buy all the coins at once which way will be the fastest using python. I buy in a loop but I don't think there is a better option

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

      I want to cover that in future videos. You mean like just buy more than one coin at once, am I right?

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

      @@Algovibes yep

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

    Can you use a limit order to sell?

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

      Yes! You can specify the type of the order as a limit order.

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

    Is it possible to have your notebooks ?

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

      Not yet but I will provide a solution in the course of this year. Thanks for your patience!

  • @wasirehman2236
    @wasirehman2236 3 месяца назад +1

    os it for spot trading or Future??

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

    Should ------- if df[df.Price > df.TSL].frist_valid_index(): not be ----- if df[df.Price > df.TSL].last_valid_index(): ?

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

      Checked the pinned comment? ;-) But anyhow good catch!

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

    its called running knot

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

      Sorry can you elaborate?

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

    Hi Algo. I'm very grateful for these videos.
    I have been having a problem where it simply stopps exicuting after a buy order is placed. It never even runs the infinate while loop to find the price after buying, and never sells. I am quite sure I have the exact same code as you, with the fix in the pinned comment and I am quite confused by this.

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

      I can see when you run the strategy() function, there is the little [ * ] beside the code cell to denote that it is still running, but for me it is gone as soon as a buy order is placed.

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

      Hi Sam, thanks a lot man. I am covering stuff like deployment and making the bot run e.g. on your local machine here:
      ruclips.net/video/mDNIAkEZChg/видео.html

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

    Hi after running this for 10 seconds, it displays data but,
    while True:
    await socket.__aenter__()
    msg=await socket.recv()
    frame=createframe(msg)
    frame.to_sql(pair,engine,if_exists='append',index=False)
    print(frame)
    I get the following after the 16 secs ==> KeyError: "None of [Index(['s', 'E', 'p'], dtype='object')] are in the [columns]"
    I have copied your code as it is . what could be wrong???

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

      It seems to be a problem which a small percentage of people have as I have read it several times now.
      I don't have this problem and I am trying to figure out why it is occurring.
      Could you maybe give me some more information?
      Which IDE are you using and so on?
      And as stupid as it might sound if you use Jupyter: Did you try to restart the Kernel and give it another shot?

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

      @@Algovibes yes I've tried to re-run the kernel, it doesn't work. After some time it generates the same error. The msg variable contains {'e': 'error', 'm': 'Queue overflow. Message not filled'}, it seems to be a problem related to the binance api, not sure tho.

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

      @@Algovibes Restarted the Jupyter Kernel, used another laptop, still same problem.
      I have not tried with VScode though.

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

      Hi everyone, solved here: ruclips.net/video/OX5eDJDtqhc/видео.html

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

    How do we avoid stop-loss hunting?

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

      Thanks for watching and your comment.
      Why would you avoid it? You are going from high to high. Couldn't be better :-P
      But jokes aside: You can define a price target where you definitely want to sell no matter the TSL but I personally see no point doing it.

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

      ​@@Algovibes An example of stop-loss hunting (as I interpret the original question) would be when market participants drive price down to trigger stop-loss orders allowing said participants to buy low and subsequently realize profits after price rallies higher. How to avoid is beyond the scope of this video.

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

      @@markk4203 the bot would rebuy at the dip

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

    DO ONE FOR BYBIT!

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

      Thx for the suggestion!

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

      @@Algovibes I've been trying to make a bot that simply executes orders on bybit but I think all tutorials are outdated? I have been trying to get my head around it, if you do this I will love you forever

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

      @@Algovibes I'm specifically interested in executing 5 - 10x leverage, the api is pybit but is slightly different from binance api

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

    It was seriously interesting and yet intense.would it be possible to have this on Any equity/stock data.

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

      Thanks buddy, happy that you like it. Yes sure, you just need a proper broker with an API.