Cryptocurrency Trading Bot which is buying 🚀 Coins using Python and Binance
HTML-код
- Опубликовано: 9 июн 2024
- Disclaimer: This video is not an investment advice and in specific not a recommendation to trade this strategy. It is simply a transformation from a trading idea to code.
Please subscribe if you find these kind of topics interesting.
Get the Notebook/Source code by becoming a Tier-2 Channel member:
/ algovibes
To delete the cronjob use crontab -r
Delete the DataBase after every session or extend the script deleting records after some time.
Prerequisites:
Fundamental video (createframe function etc.):
• How To Build a Simple ...
Stream Crypto Prices using Binance Socket Manager:
• How to get LIVE crypto...
Intersection of Pandas & SQL:
• Pandas Dataframes and ...
Cronjobs:
• Schedule Python script...
Cumulating returns:
• How To Calculate Stock...
Python Binance Docs (Binance Socket Manager as well as multiplex socket):
python-binance.readthedocs.io...
Besides that be kindly invited to check out my Cryptobot Playlist. Also Python for Finance could be interesting for you.
00:00 - 01:20 Introduction/Disclaimer
01:20 - 07:15 1. Script: Necessary data manipulations
07:15 - 10:28 1. Script: Multiple Livestream to SQL DB
10:28 - 12:15 1. Script: Accessing the Livedata
12:15 - 13:32 2. Script: Explanation of needed libaries/setup
13:32 - 18:09 2. Script: Pulling prices of last n minutes
18:09 - 20:20 2. Script: Return calculation / get the top coin
20:20 - 25:30 2. Script: Investment/flexible Quantity calculation
25:30 - 28:15 2. Script: Buying Condition/Buyprice/createframe
28:15 - 29:00 2. Script: Livestream of the bought asset
29:00 - 29:11 Careful with this SL limit! Please listen to the last chapter!
29:11 - 30:03 2. Script: Livestream of the bought asset (target profit)
30:03 - 31:12 Deployment: Download as raw .py file and renaming
31:12 - 32:23 Deployment: Creating a cronjob
32:23 - 33:20 First trade
33:20 - 34:20 Output file
34:20 - 36:21 IMPORTANT! Please listen / Trades
#Python #Tradingbot #Crypto #Binance
Danke für die Videos, finde es sehr interessant. Habe bisher mit BOTS nicht am Hut gehabt. Ist das ganze denn generell rentabel oder machst du das zum größten Teil aus der Freud zum programmieren heraus?
you are insane, nearly every week you upload high quality vids, thanks a lot for sharing your experience with us!
Thanks for watching my stuff buddy. Appreciate your kind words.
I don’t know how you do it but you always seem to have the exact video I’m looking for, good stuff!!
Nice :D That's awesome to hear.
thanks bro. waiting for your next video.
Wie immer großartig! Danke :)
Danke Dir :-)
😀😀Great content as always.
You make it look so easy
Thanks mate!
I am trying my best to explain the concepts as simple as possible.
thank you so much for share your knowledge with us! it's so helpfull for start building ours first bots.
Thanks againg!
Greetings from Argentina.
Thank you man. Greetings back to 🇦🇷!
Thank you very much for sharing us your code I am leaning a lot from your grate video's. I have couple of questions regarding the scripts. 1. Why do I have to use task scheduler to run the script? I am using Pycharm as python editor can I run it directly from the editor? 2. The first script deal with storing price data into sqlite database do I need to be concern about data size incase I let it run for long period of time ? Thanks,
I see you applied the idea of a separate database to store data and access it with a separate bot script. That's great, that was very interesting! You try new ideas and post new videos at an insane pace, haha! Keep up the great work man. Watching your various approaches got me into trying to code a bot myself too, seemed like a fun project to spend time on, and experiment a bit with the APIs.
My own approach was much more "brut force" so to speak:
- On the cache script I subscribed to the live kline data for each market, and then pulled the history from the exchange for each market one at a time. That script does not run on my PC but on a separate server, and stays up 24/7, reconnecting in case of connexion loss.
- On the bot itself, I subscribed to the live trades data for each market to get the fastest updates possible, though that's a huge lot of data as there are currently a bit less than 500 markets all receiving live trades, but that's fine. At the start of the bot, I retrieve the entire history from the cache (keep it in ram), and then I build the klines locally from the live trades and append it to the local history. Each time the price changes for any market, I compute the indicators (like, % change, EMA, MACD, RSI, StochRSI). I also can open a mplfinance live plot window for the market currently invested in.
I'm not done yet, so I don't know how it will perform trading live. But everything works fine so far and all the data is there!
Sounds very interesting. Very curious how it will perform once you are going live. You already tested some strategies?
@@wickedgummybear3104 Not at all, not yet.
Thank you very much for sharing! That sounds very interesting and I would be curious about the outcome as well!
I'm doing something like this, without the cache trick (nice move!) If you want we can talk about :)
do you happen to have a github where we can check it out?
I have been trying to figure out how to do this for a week now before I found this video, danke!
Happy to hear that. Bitte :-)
You are the BOOOOSSSSS !!! thanks a lot for sharing your knowledge, one question .... is it possible to add a filter for volume ?
keep it up !!! :)
Thanks a lot mate :-)
Gonna include volume in one of my future videos.
Hi @Algovibes.
Great video! I have been following your videos for a while now. With this video, is there a way to add technical indicators such as moving average or k% & d%? I have tried def apply indicators, but have had no success. Any ideas would be great.
Hi Matt,
yes and I have already played around with that in some of my cryptobot videos. Be invited to explore the cryptobot playlist.
If you don't find anything please let me know and I'll give you a helping hand!
King much love from 🇸🇪
❤️ Thank you
Nice video👍 Sir, it inspired me to try to make a bot of my own. respect
Awesome. Thanks a lot for your comment. Ofc trade on your own risk and test the strategies beforehand!
for some assets where the minQty is 1 ( with no decimals ) len gives wrong result rather I use precision = int(round(-math.log(minQty, 10), 0))
Thank you so much for providing these high quality videos! I would like to ask a question regarding the live data, would it be possible to get the data in a 5 minutes time frame rather than the current ms time frame? If yes, would you please be kind enough to let me know how?🙏🏽
Welcome mate! Thanks for watching :-)
I have covered all kind of time frames in my cryptobot playlist. Be kindly invited to check that out!
Brilliant once more. Thank you.
It would be interesting to thoroughly test the RSI, stoic, MACD, but adding the EMA 200 to make it more fail proof.
I have also read about the MTF EMA, where one line is 15 minutes 50, the second line is 60 minutes 50 being a good indicator too.
Some times, the EMA 200 and EMA 50 act as point of resistance/support, which could actually work as an advantage of predictability.
Also I have noticed that using the top_symbol is not the most valuable asset. Once it becomes the top, it's because It has gone through the burning period and it has, most of the time little to offer.
I am currently observing for signs of a better way of selecting a coin.
If I could code python, this would be my project to perfect.
Looking forward to your next video.
Thanks Alfred for sharing your thoughts and also your suggestion. Appreciate it!
Great video as usual. I found another way to calculate the buy_quantity (@24:59)
buy_quantity = round(investment_amt/Lotsize) * Lotsize
You forgot the prize in denominator
Thanks for sharing guys!
Does calling the .client each time increase your query weight? What is the max weight with a multiplex socket?
Can you elaborate on max weight with a multiplex socket? It is not an API call. But regarding the client call: As we are not pulling anything my guess is: No.
I had no errors running it some days in a row.
Can we do something here like buying currency pairs with 4 and 1 hour and 15 minute RSI values below 30 or 35 instead of the minute best values? We can add a possible 3-5 percent drop. Is it possible to write such a bot?
By the way, thank you for everything. You use a very descriptive and easy-to-understand style, I wish you continued success.
Definitely possible! I have noted that but can't promise anything. But that would be interesting as well!
Hi! very inspiring video!
Can you help to answer that how can I set a time sleep like 1sec to make sure a constraint my data point density(granularity)?
Thanks a lot man. Can you elaborate? In the best case give a timestamp where you want to put in a sleep function.
Hi, thanks for the videos! Really useful!
I have a question: I'm Getting "RuntimeError: Event loop stopped before Future completed." This error appears after the first loop. Do you know why?
Thanks a lot for your comment.
Seems to be in relation with Python 3.10.
Hi, grat job and thanks for sharing! Do you think it is possible to test the bot on historical data to check how it would have performed on that selected period of time? It could be useful to avoid big mistake (!) or to test different buy/sell criteria even if, of course, it will not guarantee the same performance on the future data!
Yes, that's absolutely possible. I am considering some backtesting in future videos!
I was wondering if you'd ever do a video over decision trees? I was thinking how they might be used to create a strategy based on some indicators. Maybe if given some data at a period in time it could decide to buy, sell, or do nothing, it would be better than us simply writing some buy and sell rules. Would like to see what you could do with some decision tree derived strategy
I will and I privately already played around with it! But I guess I will cover it rather beginning of next year than in this one. Anyhow thanks a lot for the suggestion.
Wowww this is nice idea. I will try it and see what will happen
very interesting! Unfortunate you didn’t strike gold with this method, sounded like an interesting idea. You could always backtest in order to get a better idea of how it would perform long term. I really liked this idea because if how simple it was. Makes me wonder what other things you could try to use as indicators for coins. Maybe volatility could play some roll in selecting, or maybe if its its like 3 day average is higher than its 3 month average. I might play around with some of these ideas!
Thanks for your feedback mate. That's the exact purpose of these videos! I think the potential which ideas you can implement are limitless. The only difficulty is transforming ideas into code. That's what I am here for :-P
@@Algovibes yeah Im pretty experienced in python, but not so much algorithmic trading with python, so now I have a new toy to play with!
very very helpful thank you
Thanks Mohamed, appreciate your comment.
thank you very much . the tuto is amazing !! please provide course of crossing of 2 ema with future trading and with take profite .
Thanks for your kind words and the suggestion man!
@@Algovibes Is it possible to do it in pyhton ? Since i searched in the net about taking profite after creat market buy in futures but i did'nt find much informations. If there are some tricks to do it please .don't hesitate to help since i'm stuck with that function and logic . I can even send the bot that buy and sell with the crossing but without profit :-(
Thanks
Thanks for watching man
Hey how do I get the info of huge orders .
Like you can take the live price .
Hi, I am pretty sure there is not a stream for that but you can get the order_book / market_depth with an API call as far as I know.
Hey mate! Wondering why you did the product of the percentage change instead of the percentage change of the first and last of the range?
great vid btw! i used to always use kline pulls but i learned how to use streaming thanks to you
Hi mate, thanks for your comment. Also possible! Going more into details on how are returns calculated here:
ruclips.net/video/fWHQwqT3lNY/видео.html
Thank you very much for the code and the idea. I am trying to do the same thing. I use 1min kline data, which updates current prices every 2 seconds.
The code presented uses "3 min previous continuous trade data" as base for percentage calculation. Kline data can also be considered continuous (2 sec discrete, and a bit delayed, but ok ) you can identify candle close prices too. I have a question about the strategy. We are trying to catch rapid price increases early, so we can go along with, right? Earlier better but too early might trigger false alarm.
- 1-2-3 minutes previous continuous data can be used as base for percentage of increase calculation.
- 1-2-3 minutes ohlc candle close prices can be used.
- 1-2-3 minutes previous continuous data min-max prices can be used to calculate pct and to open and to close trades.
- Single price data or average of consecutive few price data (SMA) can be used as base or current price...
Which one do you think better?
Hi man, thanks a lot for your comment. Yes you are right, that's the idea and you also identified the problem with that.
Well I can't tell which one would be better without having tested that. But I am working on combining this strategy with a slightly longer time horizon and then check for crossovers.
Woww thanksss you maann
Thanks for watching :-)
@@Algovibes you worth it maann
Thanks for the explanation, glad I stumbled upon this, I've come by articles and videos of people that grew a $100K to over $800K in just few months, what do you guys think they invested in and how can one outperform the market and make such profit
Well I personally would aim for realistic profits. These are far from any reality but in an irrational market like the crypto market probably achievable. Anyhow I would be cautious with those "stories". The people who are profiting big time will tell other people. People who are losing won't tell so there is a general bias one should be aware of.
Another nice video! But when you put trading script in crontab you have to remove the run_until_complete loop or you will have a new script every second and they all run together. Right?
Thanks mate. No, I wouldn't do that. I designed the script in a way that when we are invested the script will shut down before the async function will be triggered.
@@Algovibes Thanks for reply. I understood you use wallet balance to stop the script after selling. Another thing: when execute loop.stop() I get 'RuntimeError: Event loop stopped before Future completed' Is it the right way to stop after sell?
thank so much for one more video.
but could you tell me how you can buy and sell the same quantity? when I bought some crypto I lose a little bit quantity because the taxes but you don't.
Thanks for watching mate. You just have to set the commission asset to BNB. You will pay less commission when doing that as an additional pro.
If I may make a request, can you do a video that listens to events for a certain token on bsc to see when big values of the token are traded? I am finding it very hard to do from scratch. Also FYI these videos for Binance do not work in the USA anymore as they now require KYC for the API key 😔
I had to to KYC as well (I am from Europe) so I guess its the new standard. I wanted to cover another API as well. BTW thanks a lot for your suggestion.
Hi
at min 14:39 when im building the second script my list doesnt populate with any symbols, there is nothing in the sql database
can you tell me why please?
Well, that could be a lot of reasons. Is the Database file created?
Sorry again, bro. I tried to make it run, first using it as an idea to something new, and after that I tried to make it exactly like you, and it didn't run.
SQL alchemy don't create the DB, I made the same with sqlite3 and it creates the DB but it never feed it, and never got an error msg.
It's driving me insane, because I want to learn, but I don't know what am I doing wrong.
Could it be a failure because the python version?
Hi buddy, no worries man! Let me give you a perspective: These things will never change :D Just take it easy. It could be a lot of reasons and it is quite hard to identify what's causing the problem. Things I would check first: Is the livestream outputting any value at all (e.g. when printing out stuff)?
Thanks so much for sharing your ideas. I tried to follow your code and build the same database, but the problem I have is that every time the database runs smoothly for a few minutes and then suddenly it just stopped writing new data to it. Do you know if there is any api request limit from binance or anything else could be wrong?
Welcome Jerry! Thanks for watching my stuff. Well, could be a lot of reasons. First check I would do is, does the script really continuously writes data into the database (with a simple print).
@@Algovibes I tried to print while writing data to the database, but seems no way to find what was the problem. I switched to store data to csv files instead and it turns out much more stable than the database. Thanks again for your work.
Sory mate, there is a video explaining how to run the script in the task scheduler??
Only covered on Linux and Mac until now using cronjobs.
Did you check the cloud deployment vid? Might be helpful:
ruclips.net/video/mDNIAkEZChg/видео.html
import math
from decimal import Decimal
buy_quantity = float(math.floor(investment_amt/(prize*Lotsize))*Decimal(str(Lotsize)))
math.floor(investment_amt/(prize*Lotsize)): Integer number that is possible to buy
Decimal(str(Lotsize)): Precision number of lotsize
Thanks a lot for sharing! Have to try it out but seems to be way better on first sight!
Concise formula! Well done!
Hi friend I love your videos, thanks for sharing your knowledge, I'm just starting to build my first projects and your content is like gold. 👏👏
I have a problem when I try to sell some coin for the first time due to the trade commission, for example I buy 0.8 some pair and the commission is 0.0008 so my real qty bought is 0.7992, when I try sell my qty I don't have the full qty and gives me an error. How you do it to don't have this problem?
Hi man,
thanks a lot for your kind words!
You have to set your commission asset to BNB. With that you are getting lower fees and you are not running into that problem.
@@Algovibes Thanks man!
sorry, but i don't understand, how do you run both scripts? I have to run both at same time or just run the first and afther the second?
No worries. First one is populating the Database and second one extracts data from this database. The foundation video is explained here, I am going slightly more into details there:
ruclips.net/video/rc_Y6rdBqXM/видео.html
@@Algovibes thnx a lot! and amazing videos you're amazing!
Sorry again, I've watched the video. I'm doing it on my computer, so tell me if I'm wrong.
First I run from terminal the first script and I leave it running to feed the db, and after I run the second script that uses in real time the database that is updated all the time by the first script. It's ok?
What IDE is this and how do you set it up that you can do in-line execution and results?
That's Jupyter Notebook and the in-line execution is a feature.
@@Algovibes Thank you!
Guys the error problem is from the python version your using, i was using 3.8 and it wasn’t working and kept giving me errors but after I downgraded my version to 3.7.13 it worked like it was a dream thank god i was trying to solve this problem for days and finally alhamdullah I fixed it
Hi Vitona,
where do you get this error? BTW I have more up-to-date videos on cryptobots which are also working with newer Python versions. But before that let me check if your error is really occurring because of versioning.
@@Algovibes in the looping it was saying that the ssl connection can’t be done then I downgraded my version and it worked seamlessly
Hey I'm Getting RuntimeError: Event loop stopped before Future completed. Error After first loop and my PyLance showing "Code is unreacahble" for await client.close_connection() this line do you have any idea to fix this?
Didn't have any exposure to PyLance yet. Sorry!
As a general rule, stop loss should be less than the take profit otherwise you are relying on only your strategy win rate. If you have a 2 to 1 take profit to stop loss you will get positive results even at a 50% strategy win rate. Not only that you really shouldn't take profit if the price is continuing up, you should move your stop loss up with the increasing price and wait for a reversal. I didn't see anything about looking at the cost of the trade which would be max 0.1% on Binance.
Yep! Agreed. Fees are 0.075% per Trade.
Nice :)
Thanks for watching!
Great viedeo, really helpfull. I have a question, maybe stupid. I am pretty new to crypto, but isn't there a problem with Binance's fees? I believe it is 0.1% per order. Won't that make short-term trades marginally less effective?
You are right. As the bot is taking 0.5 percent profit. So subtract 0.1 for buy and 0.1 for sell order. The bot is still in profit by 0.3 percent.
If you hold BNB coin then you will be charged 0.075 (25% Discount). So your reward will become 0.35%
Thank you! And yes it is like Yasinzaii stated.
3% stop loss for a .5% possible gain... It would be better to have a rising sale price and only sell if reverses. So if you get above .5% you set that as the stop loss and move the take profit up .5% that way you will be able to catch as much of the move as possible before it reverses.
He already done that in the Trailing Stop Loss video.
@@accountramerame the point is to combine the ideas to make the bot more functional.
3% SL is nonsense. I am referring to that in the end of the video. Anyhow thanks a lot for sharing your thoughts! That's quite an interesting idea!
@@Algovibes thank you for your comment. You are building up very useful library of techniques and ideas. How much prep do you put into creating the code? Or is it off the cuff ?
can you add the links u mentioned in the description? pls
They are all in the video description. Which one do you miss?
Amazing job, but why dont you just set take profit and stop loss when you are buying, directly using Binance Algo orders?
Thanks buddy. Good suggestion, can you elaborate on that?
Hi, sorry to bother you.
I have a new error in the first file.
‘List’ object has no attribute ‘lower’
Any clue to solve it?
Solved! I don’t know how, but today after review the code it is working this part
Awesome!
hey! can u please explain me why i am getting only zeros when executing the function?
And why it aways shows me just BTC
hi, when exactly?
How do you set the commission asset to BNB always?
On the Binance platform. You have to check the box at take BNB as commission asset.
Plz do 1 change and test it out and share the results. Rather than using the percentage change of a coin consider using the slope of the prices for each minute. If the slope of the last minute or 30 second is negative then the coin is in downtrend and should be avoided. I hope it will have a drastic increase in the win percentage.
Thanks buddy for sharing your thoughts!
Moment_list = []
for symbol in symbols:
prices = qry(symbol,3).Price
first_index = prices.first_valid_index()
last_index = prices.last_valid_index()
if first_index is not None:
first_price = prices.iloc[first_index]
if first_index is None:
first_price = 0
if last_index is not None:
last_price = prices.iloc[last_index]
if last_index is None:
last_price = 0
if first_price != 0:
moment = ((last_price - first_price))*100#/first_price)*100
else:
moment = 0
Moment_list.append(moment)
@@DrR0bot did you gave it a try ?
@@Yasinzaii yes. If you change the cumret section for this one it will give you the series of slopes for all the filtered symbols. Then you just have to find the index when is the max
@@DrR0bot ok will do. How was the result ? Did you run it for long? is it worth it?
Is there an alternate method to looping the first script?
Seems problematic for me and others I see.
Can you elaborate on "looping"?
@@Algovibes the line at the end of the code loop.run_until_complete(main()) is failing. I have included the 2 extra lines of code required by Jupiter but it fails.
Hello, i am trying to build a bot that uses some methods from the code your posting, thanks so much🙏🏽 however, i am having trouble in getting accurate and timely data for all symbols/currencies.. it doesnt bring the latest data for all of them, but only does for a few.. could you possibly help me with that? Or provide me with possible reasons?
Reallly appreciate your help and support and all the efforts done in your chanel🙏🏽🙏🏽🙏🏽🙏🏽
Thanks buddy. Be invited to explore the cryptobot playlist. I have a ton of other videos covering different approaches so your problem is highly likely to be solved then. Cheers!
Hy, great video, thanks for it!
It works great when I run the script manually but when I try to run it from task scheduler i got this error:
"max() arg is an empty sequence" (win10 x64)
Can You help me in this case?
Thanks!
That was my Problem too. I solved it by using the complete filename including directories:
engine = create_engine('sqlite:////home/botpi/test/CryptoDB.db')
in both aplications.
Thanks both for your comment and sharing possible solutions!
Hi,,
I am getting an error with python 3.10
As of 3.10 the loop parameter has been removed!!!!
Any Solution?
Besides not using 3.10: No.
There is a discussion on this here:
github.com/aaugustin/websockets/issues/916
@@Algovibes installing Conda and 3.9 instead, but still not able to run it!
Now I get. .. this event loop is already running!
Hi, again awesome video. I'm getting this error: BinanceAPIException: APIError(code=-1102): Mandatory parameter 'symbol' was not sent, was empty/null, or malformed.
You know how to fix it?
Thank you man. It's just telling you that you have to pass a symbol to the buying order. Can you double check if your code is doing that?
Hello Is there a github repo for this project?
ruclips.net/channel/UC87aeHqMrlR6ED0w2SVi5nwjoin ;-) Anyhow: Thanks a lot for watching!
Thank you for this amazing project,,,,can you please give the source,,,same as the one the video,,,so we can just use it directly
Publishing the code based on engagement. So probably in the upcoming months.
when running the line" free_usd = [i for i in client.get_account()['balances'] if i ['asset'] == 'USDT'] [0]['free']" I get the error of invalid API key but all the permission are open..
APIError(code=-2015): Invalid API-key, IP, or permissions for action.
any idea how to proceed champ?
I also got this error
You need to enable the API on the Binance website. Was going over that in the Introductory Binance video. Should be linked in the vid description. If not, just let me know and I'll reference it again. Thanks guys!
How to close all open positions in Binance kindly help
There is no general API call for that. But you can surely write your own script to achieve that.
Очень круто! учусь по твоим видео! очень интересно!!! Привет с полюса холода!
Haha thank you man, спасибо❤️ Greetings back!
But Is there any way that I can make it trade within seconds
Yes! You need to establish a websocket connection to get a realtime data stream. Be kindly invited to check out my cryptobot playlist. I am doing that in a plenty of videos.
thank you mate. i got "database is locked" error.
Delete the database and populate it again is the most straightforward solution. Also: a switch to MySQL is recommended in general.
that minimum lot size explanation makes not sense. if the minimum is 0.01 then 0.198 is well above that and there is no need to round it. If the investment size was 0.009 there would be a problem... am I missing something here?
I guess yes. I don't know which case you are referring to when comparing 0.01 to 0.198. In my example it was 0.01 and 0.19 which fits fine But there are certainly better ways to implement that. Some people already commented good solutions. Anyhow my approach should work with any asset except Bitcoin.
@@Algovibes the 0.198 came from what you said when explaining the rounding up of the limit. I suppose my question is, 0.19 is higher than 0.01 so why would it need to be rounded up? Couldn't we just test that our investment is greater than the minimum limit?
Can we use these bots with us?
Well these are examples how you can build one but I don't recommend to use them. They are just meant to be seen as projects, but ofc I cannot stop you to use them.
Pls make advances pandas-dataframe tutorial,
Thx for the suggestion but could you be more specific? BTW I have a pandas playlist so be kindly invited to check that out first.
Kevin of Data School has some excellent content - ruclips.net/user/dataschoolplaylists.
why you dont use raw python ?
If you are referring to the content of this video, I have covered using raw python here:
ruclips.net/video/nQkaJ207xYI/видео.html
If the question is general:
Because presenting code is more lucid in Notebooks at least in my opinion.
Privately I am using Spyder.
how can ı get only leverage tokens ?
By filtering the list for only those values which contain an UP or DOWN.
@@Algovibes thank you for your answer but it doesn't work. comes in values that are not in futures. exclude = ['UP','DOWN']
non_lev = [symbol for symbol in symbols if all(excludes not in symbols for excludes in exclude)]
bro why buy spot&
why not?:D
Vielen Dank für deine Videos,
ich habe mir vor ein paar Wochen einen Bot gekauft, nun habe ich eine geniale Idee, kann aber selbst nicht programmieren, falls du Interesse hast können wir ja mal sprechen. beste Grüße Daniel
Hau raus! Vielleicht covere ich die in zukünftigen videos 😛
I tried this. when I run first script it runs without any error update data base also, but it stop taking data after few min (loop is continuously running since it is while true: ) . I think there is a comment asking same but I couldn't find a solution. can you please help on this
Thank you for this grate work. it help us to learn and think innovatively.
Is the async function "alive"? You can check that by just printing the received message.
If anything else fails you can btw check out my newest video. I am showing an alternative with csvs there.
Work? Profit?)
What exactly is your question?
Blogger, waiting for your reply
hm?
Hi, beautiful video... I have only one big question that I haven't solved yet... sometimes are used in your videos 2 different method to make a bot. one is the live streaming like in this video. In other, like this : ruclips.net/video/X50-c54BWV8/видео.html, you have used a complete different method... do you think are the same at the end or one is better another? i mean... just regarding the calls of data and using them to calculate indexes...
Thanks mate. These are 2 approaches: one is a live stream which doesn't even require authentication. You are not "calling" the API. The second method which I was using in this video is requesting data with an API call. Big downside of that is: It can happen, that you are sending out too many requests. I am covering both approaches here, maybe you can spot the difference better:
ruclips.net/video/g04GeHe-dJw/видео.html
Hi, Thank you for your advise! I found the other video really well made! I just have a final question... May you can answer! Do you know if is it possible to use the live streaming mixed with a history df for calculating different indexes also for the sell cobdition and not only in the buy, like as you showed on the video you suggested me? I would like to use indexes calculation on the deta got by livestreaming ( the one with the async function).
@36.21 it is not updating the sqldatabase and I am getting the following error:
DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
Would need a bit more elaboration on that to be able to help out!
@@Algovibes Thank you for your reply. I am getting the results until "multi" where I write the symbols in lower case and add @trade to it but then when I am creating "createframe" it is not showing anything in the pycharm even when I "print" it and then when i go ahead to write the function async it is not creating the database in SQL and not downloading the data to that database and after that when I go for loop = asyncio part it is giving me the above error. Can you please help me here?
@@SI-me7fm ah you are working with Pycharm.
Please follow the instructions from this vid at around minute 9 to solve this:
ruclips.net/video/nQkaJ207xYI/видео.html
@@Algovibes Thank you for your help I solved it by downgrading my Python version to 3.9 and then it started updating the database
I was struggling with the Lotsize calculations. It was returning a scientific notation that I could not get rid of. Anything over maybe 5 decimal points would error out.
I think I came up with a solution that is going to work much better for me. I swear I tried every float formatting trick that I could find online. Nothing worked. Still got scientific notations. Here is my new solution:
info = client.get_symbol_info(symbol=symbol)
price = float(client.get_symbol_ticker(symbol=symbol)['price'])
lotsize = [i for i in info['filters'] if i['filterType'] == 'LOT_SIZE'][0]['minQty']
lotsize = lotsize.find('1')
buy_quantity = round(investment_amt / price, (lotsize - 1))
Basically use the Lotsize string and count the characters to 1
'0.00000100' is what BTCUSDT might look like. Counts 0,1,2,3,4,5,6,7 and finds '1' at 0-7. I need my answer to be 6 so I subtract 1.
Any help on how the solution in the video can continue to work please let me know but I swear I can't get the lot numbers correct.
I have a way to do that shown here:
ruclips.net/video/FlL1X17sw8o/видео.html
Please let me know if that will fix your problem!