PLEASE READ(January 2022)❗ This video is picked up by the Algorithm again. Thanks for your interest and support. Secondly most of the viewers understood that this is a technical implementation of a simple strategy and NOT a recommendation to trade this strategy. For those who doesn't please keep that in mind :-) FAQs / Most common problems: 1. SyntaxError: 'await' outside function I have provided a solution to solve this in this video: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-nQkaJ207xYI.html 2. The stream stops and something like "None in the columns" is popping up: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-OX5eDJDtqhc.html Solved below the videos pinned comment (Reason behind that is, if you are not getting a ping from the server an empty data frame without columns is created). 3. If you don't feel comfortable using the Binance Socket Manager or you are using Python 3.10. I recommend to use a Websocket stream. I have covered it among other newer videos in the crpytobot playlist here: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-8p240qonj0E.html 4. I have covered a lot of other concepts like cloud deployment, other trading approaches, not using SQL or using e.g. technical indicators. Please check out the cryptobot playlist here: ru-vid.com/group/PL9ATnizYJ7f8_opOpLnekEZNsNVUVbCZN There is more to come so if you are interested in that please considering leaving a sub. Thanks for watching and your support! Much appreciated ❤️
Hi, Thanks for your videos (y) I ran the code on google collab but got this error: RuntimeError: asyncio.run() cannot be called from a running event loop Can you help please?
You can always tell who the true educators are and who the snake oil salesmen are from what they promise and what they teach. You’re a true educator, great choice of the simple trading strategy. Subscribed
you are a great teacher in my opinion you might add some more Detailed explanations about what the code actual does the linkage between two or more different code files and so on just like i prompt gpt "like a child"
Definitely interested in your videos, you have a very clearn and easy to understand way of teaching. I have a question for you, if I wanted to run a strategy with multiple coins, is it a waste of resources to have the websocket save data for the whole market? Also what do you think the best way to implement manual controls would be, a simple example an on/off, would running a seperate process on telegram or discord be okay. Or is there a better way in your opinion? Lastly, I would like to thank you for this content. It's truly amazing
First of all thanks a lot for your kind words man! Secondly I already have content on these questions. Multiple symbols using BSM: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-C-SL4Tf25eg.html Multiple symbols using WebSocket and csv storage: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-mDNIAkEZChg.html Multiple symbols using WebSocket and SQL (also manual choice of buying as these are just signals) ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-8p240qonj0E.html Would be happy for a feedback below these videos! :-)
@@Algovibes thank you so much for your detailed responses. I plan on going through all your videos one by one regardless. Im currently stuck in this video so I need to master this one first, do you manage a community by any chance?
Great work, easy to follow and easy to learn. I have a question. On the while loop when getting the information of the currency by second, after an n number of iteration the code starts showing an error --> {'e': 'error', 'm': 'queue overflow. message not filled'}. It stops getting information from the server, any idea of how to solve it or what would be the reason for the error?
Reason for the error is a queue overflow. I solved it here: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-OX5eDJDtqhc.html Would be awesome if you provide me a feedback if this approach is working out for you.
Thanks for the feedback buddy. There surely will be more videos on cryptobots. Be invited to check out the videos in the cryptobot playlist until then :-)
I really like your content and I just subscribed to your channel. Please continue with the videos for cryptocurrencies. Are you by any chance from Austria or Germany? Your pronounciation sounds like it. Cheers!
Hey man, thank you so much for subscribing and your kind comment. That is a huge help for me :-) I am from Germany 🇩🇪 I am working on my pronunciation. It was bad in this video but I wanted to record it in one round :D
@@Algovibes Nein die Aussprache und dein Vokabular sind sehr gut, aber man bekommt diesen Akzent einfach sehr schwer weg. Mach weiter so, der Kanal ist richtig lehrreich! Lg aus Österreich
Love the content on your channel, especially the crypto related stuff. Looking forward to see how you would apply TA to this live data. Thanks and keep up the good work!
do you have something similar but for stocks? Any broker which you can do the same? Coding in python to live trade stocks? I mostly interested in stocks rather than cryptos. Great channel.
Hi man, thank you very much for your kind words. I didn't cover live trading with stocks yet. Just backtesting stuff and designing trading strategies but no Deployment in the market. It is on my list but can't say when I will cover that.
Nice to see how you openly ventilate the change in your opinion. In your next lunch video, take a look at the new utilities and the staking story. You can really earn a lot with trading on bitcoin. Especially if you are already planning to invest something in it for the long term. Thanks again for the update.
Crypto trading is quite profitable I'll always pick Short term trading over Holding cause I have made a lot of profit from trading different profitable coins... it is not surprising as I also trade with Mr. Henrik Bower on a short term basis.....I advice you seek the help of an expert to avoid the trauma of too much losses
@@donald.jacoby.94 Just recently acquired some bitcoin and I don't know how best to trade it or if I should hold, Please how do i get in touch with Mr. Henrik your trader?
No need to be ashamed but an Eng. would probably strongly disagree with you as my code is not clean. I am presenting the code so that it is accessible independent from the skill level. I played around with showing object oriented code but I get the feeling people prefer the code in this way. Anyhow, thanks a lot for your kind words :-)
Great content, thanks for sharing. An interesting exercise from a risk management perspective would be to take half profit at 0.15% and the other half at 0.3% so that the profit potential is slightly higher than the stop loss
You keep the stop loss at -0.15%. If you reach the first target before the stop loss, you increase the stop loss to the entry price, so that at worst you locked in your 0.15% gain
Starting out with cryptocurrencies when you want to become a data scientist is like starting out with IRL pyramid schemes when you want to become a legit business manager. Does not compute. Stop doing that, pick up a few books and do real data science exercises
"real data science exercises"...come on. In books you will find standardized approaches such as cancer prediction, houseprices and so on which are helpful without a question but If he wants to apply Data Science stuff to cryptocurrency data..why not? It is just time series data which can nearly be found everywhere. BTW I applied some methods here on cryptos: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-oyL99oa6gf8.html
I'm introducing myself in python since two months ago and seeing things like this motivates me to keep learning. The best of all is that with your explanations I can figure out what is going on, but in a very basic way anyway. Thank you very much for sharing and teaching your knowledge with the web. Greetings from Chile!
:D :D nice comment. Even if that would be the case I would probably continue with RU-vid. I love the platform and I am on this platform since I was a teenager.
Technical it isn't possible as this is not really much of real case. Especially the data gather is just for researches. If something like bitcoin just for investment or something like that, that is mostly not possible unless the data and thing can been seen and proved but because this is digital base, therefore no way those can earn money. However, using this cryptocurrency in another way like using that coin for your all personal information, all sources just like acting as your ID, bank account, insurances in one place, adding the real made machine for verification to do anything else. This is is the way they should go for the future. But not right away. Also there will be an unexpected idea happen overtime so for coming with new methods to prove legitimate and acceptable in a wide range that should be possible. As I can see those thing can use more than that. Not just some business trading or something like that, not the kind bitcoin we are looking for but with different motives.
Hi, i have a lil problem with your while true on the storing data, when i execute the code, between each frame i have like -100ms and at 80~100 frames stored i have an error message "KeyError: "None of [Index(['s', 'E', 'p'], dtype='object')] are in the [columns]"
Yep, please check this video to fix that: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-OX5eDJDtqhc.html And also check my pinned comment. I would be grateful if you give me feedback if this is working out for you!
Hi. Thanks for this video, it’s really interesting indeed. As you requested feedback, please keep providing real world examples like this but as you said maybe coding a bit more difficult (and probably reliable) trading strategies such as MACD crossover. I saw your video on macd but would be good to see one example using macd in real time to place trades. Loving your channel so far!
Not sure if I'll ever have the time to learn enough python to do something like this. But watching you TEACH was great! You are very instructive and have a calming way of teaching. I subbed for future me's sake!
This topic is super intersting! I subscribed only because you're building a trading bot. ;-) But one question: Why do you store the live price data? I'm not a Python pro, but I would use some queue datastructure to have a buffer/cache of the let's say last 5 minutes (or longer, depending on the strategy). But storing price data in an SQLite database on harddisk doesn't make sense, not even for backtesting. Even for the latter one usually works with chart data (candles).
Hey Wolfgang, thanks a lot for your comment. I use SQL as a storage for price data to avoid API calls getting historical data. You can store the prices in memory (e.g. in an array) but this would crash when taking e.g. 100s of cryptos (as I did in some follow up videos). If you have an efficient way to cashe web socket data my ears are widely open :-)
Thank you very much man for saving my ass. I didn’t have any idea how to do my final project in one of my courses. Your videos helped me to land some! Thanks a ton!
@@Algovibes Hey, have you thought about applying some kind of maschine learning algorithm to the Trading information coming from Binance to maximize profit
Hi, I had a doubt. When I tried running the script - I noticed that the values were queued up heavily. Even after 5 seconds the timestamps of the incoming data had only changed by a few micro seconds - Which means I was reading old data from the queue. So the data I'm working on isn't realtime. Is there any way to solve this?
It makes sense, BTC and crypto is off helping to regulate, rather than pretend it won't ever happen. The big institutions getting in is the catalyst that will launch us into the stratosphere. Most people don't like change but after the change is made they grow used to it and it becomes a non issue usually because their fears never materialize. The projects that initiated the process of regulation have not been ruined, they got involved in setting guidelines and helping the regulators understand the crypto space. I’d get involved more knowing that I have made over 7 btc and 15ETH from day-trade with FLOYD J JOHNSON in few weeks....
Hi, I'm very new to this and firstly, thank you for the good work you are doing helping us find our feet in this arena. I've replicated your code and tried to run the strategy. I'm however, getting a 'Lot Size' related error (see snippet below), and cannot seem to get to the bottom of it. Did you ever encounter such an error and if yes, how did you go about resolving it? ... --> 324 raise BinanceAPIException(response, response.status_code, response.text) 325 try: 326 return response.json() BinanceAPIException: APIError(code=-1013): Filter failure: LOT_SIZE
Hi Edward, thanks a lot for watching. That simply means that you don't pass a valid amount to trade. As an example min Lotsize for coin X would be 0.01. You cannot buy/sell 0.015 of that coin as the Lotsize is 0.01 and you can only trade in those steps (0.02 would be possible). BTW I have shown ways to get around Lotsizes e.g. in this video and also other videos in my cryptobot playlist. Videolink: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-FlL1X17sw8o.html
Hi Algovibes! I really enjoyed your video! I really liked how well you explain everything and make it easy to understand! I believe cryptocurrency is the future and am fascinated with algorithmic crypto trading! Please keep up the good work! I have watched a lot of videos on the subject using python and yours are the best I think! Would you consider making a trading bot video that uses other types of indicators such as MACD or CCI?
Hi buddy, thank you very much for your kind comment :-) Yes, I will and I partly already have. Be invited to check this out: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-nQkaJ207xYI.html
I try making it in binance but 2 things complicated the thing: 1) binance fee (so when you buy 0.001, you instead get 0.000999, etc.) 2) binance only allowing to buy/sell a round number (leaving some crypto behind when selling)
First thing you need to do is to change the fee currency to BNB. It just doesn't make sense to not do so. It's cheaper. And you won't have that problem anymore. Regarding the second question: In this video I was working with quantities, so that shouldn't be an issue. Could you elaborate?
My unsophisticated solution was to add error handling using try and except For example, try: the code except: print("Invalid Data") so if the API errors it just tries again
How the fuck this guy getting just 7000 subscribers???!!!!!. I already made bot works more or less like this, but database and analyzing data is something else. Good work mate 👌
Surely German engineer, cos there is no other can explain as this! I respect! (Sorry if you are Austrian) i respect the nation who servicing the quality to the world! Dicipline and all.
I have never coded or done something like this in my life but I've been playing with crypto and stocks for awhile now, how would one like me get into something such as this? Looks like it could be worth getting into
Try to learn programming or even data science.. we (data scientist) deal a lot of stuffs with big data and how can we me make something that can help us on a daily basis, pulling an insight from a data, interpreting a model, and etc. You can learn Data Analytics using Python, or even something else like programming for data scientist or even machine learning. I hope it answers you.
I have some resources on my channel like both the Python Introduction playlist and Python for Finance playlist and I am talking about how I personally learned Python here - maybe this is helping you: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-qCZiENV83rE.html In general the most important thing is to get started in my experience 😛
Hello, when I try to use the socket manager, I get an error saying "SyntaxError: 'await' outside function" Do you know why this would be? This is specifically when trying to run await socket.__aenter__() msg = await socket.recv() print(msg) Thank you and great content
"await" must be in "async" function. learn asyncio or use 'jupyter notebook' like author. async def main(): await socket.__aenter__() msg = await socket.recv() print(msg) loop = asyncio.get_event_loop() loop.run_until_complete(main())
Hello professor, another question, can you download the information from binance in longer periods, for example every 1 min? what would be the change in the code? if it works, how can it be stoppep manually? And professor, reading one of the previous questions about the repetition of records that occurs in the "while" loop in the database, you said that we could use an "if", could you kindly write the syntax of this "if"? Thank you!
Hi student :D Jokes aside. Yes you can do that with an API call. I have done that in my newest video. The stream is always grabbing realtime data. Instead of an if I would probably just set a waiting time of - say - one second in the while loop to avoid this "overflow".
This is fantastic!!! I’ve only done a small bit of coding and so am still quite new to it and you have spelled this out so perfectly and explained everything so well, it has fully engaged me and inspired me!! Thank you so much!! And for myself, I love the fact that it’s crypto!! :)
Hi Kelli, appreciate both your positivity and your kind words. Be invited to check out the other videos in the cryptobot playlist: ru-vid.com/group/PL9ATnizYJ7f8_opOpLnekEZNsNVUVbCZN
Subbed, i want to learn to create my binance bot from this channel, what video i should start with? I dont know coding, but i can follow instructions. Can you recommending the videos from a to z? Edit: does this python bot thing creating a lot of data when active 24/7? Can I open multiple position ( something like dca up and dca down) a lot of questions haha..
Hi mate, thanks a lot for your subscription. Please be invited to check out the videos in the cryptobot playlist. Covering basically everything there. Let me know if you need any support!
Great video. Also the sqlite incorporation is a handy tip. According the documention a binance api stream / websocket disconnects after 24h, what's the best way to deal with this? Since the last thing you want is missing data in your dataframe when applying calculations like moving averages and stuff.
Thanks for your comment mate :-) That's a very good point. There are some ways to deal with that: Incorporate a time tracker, so that after 24h a new connection is triggered or conditional check for a signal (pong) from the server. I will see that I am covering this problem in future videos e.g. when I am running a longer term strategy in the cloud.
Is there a way so we don't have to trade any real money? I see on Binance that you have to deposit some funds to be able to get the API credientials. Secondly, would this program still run if I got the API key but withdraw my money so it's trading no real money?
Hi Noah, this is designed for real trades. You can use this script but need to find a way to store the buyprice and sellprice (maybe in a list/dataframe/csv/other sql table).
Great content, I'm not confident enough yet to implement something like this myself, but this is really helpful. Any chance you could post your code somewhere please?
You could practice writing your own trading bot using dummy data. Instead of placing real buy and sell orders through the API, just add and subtract integers from local variables. There will be some discrepancy given that prices move between API calls, but at the very least you'll be able to formulate an algorithmic strategy before taking it live. Once live, keep the values small as you fine tune, then once confident you can ramp it up. Good luck.
Does anyone if the channels Discord is somewhat noob friendly? I'm struggling while going through the tutorials and am not sure if it's because I'm using now depreciated functions, or my own noobness
Hi thank you for the awesome video! I want to ask something: when we run the print(msg) command ( @5:17), you explain that we only take the 's' (symbol), 'p' (price), and 'E'(time). Can you help explain what the other outputs are? ('t', 'q', 'b', 'a', 'T')
Hi buddy, thanks a lot for your kind comment. Appreciate it :-) Your question is answered here: github.com/binance/binance-spot-api-docs/blob/master/web-socket-streams.md Just scroll down to Trade streams.
Passing the Sql client into pandas.read_sql will produce "AttributeError: 'OptionEngine' object has no attribute 'execute'", when you are using the latest version of sqlalchemy (2.0 or higher) to fix this either downgrade sqlalchemy or us a one time call like this: with engine.begin() as conn: df = pd.read_sql('BTCUSDT', con=conn)
To everyone, please stay away from bots/signals/courses because the vast majority of them are not even legal or actually using a concept that's working correctly.
Agreed. Please understand that I don't want to sell you anything - I just think the programming side of constructing those bots is very interesting. I always put in a disclaimer in the beginning of every video and actually showing I made bad trades (e.g. in the MACD case). Anyhow thank you for raising this necessary caution!
@@Algovibes my comment was not specific to you or anyone else, just a reminder for everyone to be careful because theres too much illegal stuff going on since it's very easy to get people to believe in it. I appreciate that you're atleast honest about it and a quick reminder for you is to really dig into if your disclaimer is enough, because from experience i know theres a lot that need to be mentioned! Just for your safety
Hi - Thank you for your content. When I execute the await socket loop, the prices are recorded sporadically. Sometimes its the same time snapshot, but others it takes a few minutes. Why is this happening and is there a better way to receive this data?
Thanks for watching! Few minutes shouldn't happen at all. As some people have issues with this approach I will probably cover an alternative in one of my next videos.
Nice video ! Is it necessary to use a SQL data base or can we just store values in arrays or something ? What would be the benefit of the SQL database ? (I'm not initially a coder so probably a noob question :) )
Thanks a lot for your kind comment :-) It's actually a very good question! It is not necessary, I just wanted to implement a DB in live trading. I have other videos where I am not using a DB. Be kindly invited to check out the cryptobot playlist.
Nope! Therefore you would have to deploy this bot in a cloud. I am planning covering that in the upcoming weeks btw. Anyhow I would rather recommend to run a bot on a local machine.
Hi, just yerderday I was wondering how feasible something like this could be! I'll probably end up doing something similar, but I'd first have it running for some time without money to analize the results and see how the bot would behaved in a real environment. To do so, is there a way I can implement real fees and other issues I might incur into? For example, I'm talking about the inability to buy the fraction I want because it would be too small
Thanks mate! :-) For Spyder you have to use a slightly different approach since the async is working differently. I think I covered that in the pinned comment somewhere. Hope that helps!
Couple of questions: - Is this possible with Webull? Not sure if they have API to use but I figure I could use something similar to what you did at the very least. - Is there no request limit(s) for the API? - Any way to increase the timeframe? Well explained video btw. SUBSCRIBED!
hi, can u please help me why im getting an error saying "mandatory parameter time stamp not sent" . i am using a different code but I get this error can u please help
Nice explanation, so small too. A binance bot I did ended up using agents and coroutines ; I'm on the "why make it simple if you can make it complicated" side >_>
Hi mate thanks a lot for your kind comment. Be kindly invited to check out my videos in the cryptobot playlist. I am covering different approaches there.
hello sir first of all bundles of thanks for this content but i have question i am unable to test binance api in this code you provided will you please explain me in miore detials
Hi, when i run the code for getting information about coin it goes as shown in video and I can even buy and sell crypto but after a while I'm getting an error: raise KeyError(f"None of [{key}] are in the [{axis_name}]") KeyError: "None of [Index(['s', 'E', 'p'], dtype='object')] are in the [columns]" Can someone help me with this?
Sure, I have answered that in the pinned comment below this video: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-OX5eDJDtqhc.html I recommend to check out my newer videos. I am showing way more convenient ways to live stream crypto data.
@@Algovibes Hello, I am getting the same error while using the recommendation in the provided link. I have just implemented the "if res" statement. I am getting "None of [Index(['s', 'E', 'p'], dtype='object')] are in the [columns]". Any other recommendations? Or have I simply implemented it wrong?
24/7 needs some adjustments as the Binance livestream is disconnecting after exactly 24 hours. The recommended way is probably a Virtual machine. I will cover that kind of stuff in the future.
Hello! Thank u for videos, very informative! I am new to sqlalchemy and sqlite, and was wondering how can I delete the previously aquired data from df. Started bot when btcusdt was 40k and these data seems to be from another world right now. Thnx in advance.
Thank you my man! Nice profile pic :D You can delete rows in a SQL DB by simply using the delete statement and then just get rid of those rows which are before a certain date.
Your list of BTCUSDT information, updates every like 1.3 seconds. I tried to copy your work, and mine is sending info like 12 times a second, which seem to result in a bunch of errors. Any help or advise?
Could you please check out the approach shown in this video here? Also check out the pinned comment below the vid please. ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-OX5eDJDtqhc.html An alternative would be to use Websocket: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-8p240qonj0E.html BTW thanks a lot for watching.
@28:09 How much profit would it be + fees? 47732,94 to 47828,39 = 0,19% profit + 0,001 Fees = 0,001 btc * 0,19 % = 0,00019 profit - 0,00000019 fee (0,001% from 0,00019 profit) = 0,00018981 btc profit? That makes sense?
Fees are shown in BNB as you save some commission if you use BNB for commission. You will find the commission inside the buying and selling statement / print out.
Thanks Buddy for the video. It is amazing. I am new to this subject. But definitely look forward to learn it. I want to trade in crypto I use binance app, can u share info how this bot technique be useful. Thanks in advance.
This video is showing the coding of a very simple trading strategy. As said in the video and in the pinned comment this is a tutorial and not a recommendation to trade this strategy.
ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-rc_Y6rdBqXM.html Hay, bei mir stimmt die Zeit nicht. In der ersten Sekunde stimmt die Zeit, danach kommt jede Sekunde ein Wert welcher nur etwa 0.2 Sekunden älter ist. Dadurch wird alles immer asynchroner.
Hi :-) Kannst du einmal den Weg im allerneusten Video abchecken ob das dein Problem löst? Danke dir: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-OX5eDJDtqhc.html
I have FTX on my list as an alternative to binance. I am not quite sure if I cover the websocket in the first tutorial. Thanks for the suggestion tho :-)
There are frameworks to set up a trading bot without needing the programming knowledge but just in my opinion the possibilities of those frameworks are quite limited.
@@Algovibes so i did anything like you explained, but in line 6 with the aenter and await command, nothing happens. i run it and nothing happens. No error, no success, just stuck with a "*" in the [] if i try it in pycharm it says error "the await command is outside of a function"
Hi, thanks for sharing. I'm facing a problem regarding real time data retrieval. Nothing happens after await socket.__aenter__() msg = await socket.recv() print(msg). I've also tried the Asyncio part but that's the same... Any helps ? Cheers ;)
Truly a great content and a great explanation. Thanks a ton... 🙂 (A small request) It would be really helpful if u could show how to trim out older data from sql table (multiple cryptos if possible) inorder to avoid huge loads of data. 😀
Hi buddy, thanks a lot. Check out this one, this is taking care of exactly that: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-n0d7kSGwskY.html You can also implement a sql import/export within this structure. Cheers!