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!
@@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.
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 🙂
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.
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.
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!
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 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🙏
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 ?
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!!
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...
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
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: ua-cam.com/video/_IV1qfSPPwI/v-deo.html Otherwise this might be helpful for you: www.binance.com/de/support/faq/e707685b4e0f408fa7c1b9ccd8ea7aa9/
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?
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!
@@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!
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😉
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?
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!
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.
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.
Hi man, thanks a lot for your comment! I think I covered an - at least - similar situation here: ua-cam.com/video/4MnNft7Squk/v-deo.html Let me know if that gives you a hint.
@@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.
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!
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!
@@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 😄
@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.
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 ?
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.
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?
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.
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]"
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!
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
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 .....
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: ua-cam.com/video/lIJlhKrP_SI/v-deo.html Third video is about executing your scripts with cronjobs. Hope that is helping you out!
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.
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.
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?
@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?
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.
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.
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...
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: ua-cam.com/video/_IV1qfSPPwI/v-deo.html Stuff on Databases can be found here: ua-cam.com/video/pU53JUhSnkY/v-deo.html and: ua-cam.com/video/5bUn-D4eL4k/v-deo.html Hope this is helping you out!
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
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.
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.
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.
@@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.
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
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!
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???
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?
@@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.
@@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
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.
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.
Hi Sam, thanks a lot man. I am covering stuff like deployment and making the bot run e.g. on your local machine here: ua-cam.com/video/mDNIAkEZChg/v-deo.html
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!
Just found your channel. Loving this series, fantastic work. Subbed.
Thank you mate :-) Appreciate your comment and your sub.
Tremendous content! I really appreciate your videos... gives hope to a newbie programmer like me that I could actually augment my trading with Python.
Thanks a lot buddy. Very happy to hear that :-)
@@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.
Best vid ever... Good job Algo
Thank you for creating these videos. They are goldmine of knowledge
Thanks a ton mate. Happy to read that!
Let me thank you first for amazing content.. Keep your research on and on.. All the best!
Let me thank YOU for this kind and appreciative comment :-) All the best for you as well!
always look forward to your videos!
I enjoyed watching , Thankyou.
That's great to read. Thanks a lot for watching :-)
I'm "like number" 500... Just saying I'm pretty special.... Also i like your content!
Thanks for liking and checking out my stuff man
dude, totally subscribed
Thank you very much :-)
you're a gem mate 🙌🏼❤️
Thanks buddy ❤️
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 🙂
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.
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.
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!
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.
Very welcome Abdirashid! Also thx for the suggestion. Be invited to check out my cryptobot playlist. I already implemented a ton of concepts there.
@@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🙏
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 ?
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.
Great Content, Bring some more strategy with trailing stop loss.
Thank you very much for your feedback. Truly appreciate it! :-)
Really good job Algo
Thanks mate, appreciate your feedback :-)
Great video thank you for sharing
Thank you very much for watching mate! Appreciate your comment :-)
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!!
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...
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
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:
ua-cam.com/video/_IV1qfSPPwI/v-deo.html
Otherwise this might be helpful for you:
www.binance.com/de/support/faq/e707685b4e0f408fa7c1b9ccd8ea7aa9/
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?
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!
@@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!
Okay, subbed :)
Thank you so much! :-)
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😉
Thanks for sharing your thoughts!
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?
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!
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.
Hi Guys, problem is solved here: ua-cam.com/video/OX5eDJDtqhc/v-deo.html
Fantastic
Thanks a lot buddy
THank you...
Thank YOU for watching :-)
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?
Good question. Pretty sure it isn't possible and I honestly wouldn't see the advantage of being able to do that.
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.
Hi man, thanks a lot for your comment! I think I covered an - at least - similar situation here:
ua-cam.com/video/4MnNft7Squk/v-deo.html
Let me know if that gives you a hint.
@@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.
Perhaps put msg into a deque instead of a db. Then no worries about getting too large.
Very good idea. The other solution is btw just to manage the database by deleting entries older than x.
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!
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!
@@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 😄
@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.
Hi mate, be invited to join my discord and raise the question there or just here in the comments. Thanks!
@@Algovibes fsociety#4919
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 ?
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.
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?
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.
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]"
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!
Problem solved here: ua-cam.com/video/OX5eDJDtqhc/v-deo.html
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
I want to cover that in future videos. You mean like just buy more than one coin at once, am I right?
@@Algovibes yep
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 .....
Thanks for the suggestion. Really appreciate it! I will see what I can do.
its called running knot
Sorry can you elaborate?
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?
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:
ua-cam.com/video/lIJlhKrP_SI/v-deo.html
Third video is about executing your scripts with cronjobs. Hope that is helping you out!
Do you have any specific pattern in your minde that this trailing code can burst?
Got an example what you are thinking of?
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.
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.
@@Algovibes
Thanks,
Is that mean just like this:
print(price)
?
os it for spot trading or Future??
Spot 💡
do the entry value always have to begin with -0.00xx? same for TSLA (0.995)
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?
@@Algovibes thank you so much good sir.
really great
Thanks for your feedback :-) Appreciate it!
@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?
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.
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.
Can you use a limit order to sell?
Yes! You can specify the type of the order as a limit order.
Should ------- if df[df.Price > df.TSL].frist_valid_index(): not be ----- if df[df.Price > df.TSL].last_valid_index(): ?
Checked the pinned comment? ;-) But anyhow good catch!
would you make a tutorial about creating margin order in python-binance :))
Thanks for the suggestion!
Didn't plan that yet but I noted that for possible future content.
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...
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:
ua-cam.com/video/_IV1qfSPPwI/v-deo.html
Stuff on Databases can be found here:
ua-cam.com/video/pU53JUhSnkY/v-deo.html
and:
ua-cam.com/video/5bUn-D4eL4k/v-deo.html
Hope this is helping you out!
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
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.
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.
How do we avoid stop-loss hunting?
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.
@@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.
@@markk4203 the bot would rebuy at the dip
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
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!
Is it possible to have your notebooks ?
Not yet but I will provide a solution in the course of this year. Thanks for your patience!
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???
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?
@@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.
@@Algovibes Restarted the Jupyter Kernel, used another laptop, still same problem.
I have not tried with VScode though.
Hi everyone, solved here: ua-cam.com/video/OX5eDJDtqhc/v-deo.html
DO ONE FOR BYBIT!
Thx for the suggestion!
@@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
@@Algovibes I'm specifically interested in executing 5 - 10x leverage, the api is pybit but is slightly different from binance api
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.
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.
Hi Sam, thanks a lot man. I am covering stuff like deployment and making the bot run e.g. on your local machine here:
ua-cam.com/video/mDNIAkEZChg/v-deo.html
It was seriously interesting and yet intense.would it be possible to have this on Any equity/stock data.
Thanks buddy, happy that you like it. Yes sure, you just need a proper broker with an API.