Instead of calculating it yourself, I'm pretty sure you can pull price precision and quantity precision data from the Binance API for every pair you want to trade. On the other hand, that would put more unnecessary weight request on the API, too much weight and the Binance API starts refusing the queries. Also, great video, I've kinda given up trying to trade for profits, but I always learn so much Python from your videos, thanks!
Always good content here thanks. for those who wants to round price and qty on futures you can do this: def get_symbol_info(symbol): info = client.futures_exchange_info() for item in info['symbols']: if(item['symbol'] == symbol): price_dec = item['pricePrecision'] qty_dec = item['quantityPrecision'] return price_dec, qty_dec price_precision = get_symbol_info(symbol)[0] qty_precision = get_symbol_info(symbol)[1]
@@Algovibes but I realized that some values are not up to date, binance has a shitty api. Thanks to you, 2 months ago I didn't even know how to code, after coming across one of your videos and I got a taste for it and now I make my trading bot myself, thank you again
Quick question.. if you are using only the last Row to check If buy or sell, why ejecute the conditions function to the entire data frame? Could be better to calculate it directly in the Trade function? I don’t know if I miss something else.
Hello Mr.Algovibes. Thanks so much for your nice information. I have a question about web socket real-time data download from Binance and its calculation. After downloading the web socket data and I calculated them to be 1 minute (or 5 minutes) historical data, but my calculation is not the same with '1m' historical data(REST) from Binance. Can you recommend any good idea to resolve this issue?
@@Algovibes i have problems with the lotsize of BTCUSDT, it returns 1e-05 , its not possible to calculate qty, how to fix that ? on the most pairs it works, i think it means 5 decimals
Lotsize = [i for i in info['filters'] if i['filterType'] == 'LOT_SIZE'][0]['minQty'] Lotsize = Decimal(Lotsize).normalize() this works, removed float conversion, and removing trailing zeros need import decimal from decimal import Decimal
Hi, I'm trying to turn BitMex order book data into a data frame using the same method you used on binance When I run this code: orderbook = client.OrderBook.OrderBook_getL2(symbol='XBTUSD').result() orderbook_dataframe = pd.DataFrame(orderbook) I get this error: object of type RequestsResponseAdapter has no len() Any ideas?
Yea, you need to make sure you can actually convert the orderbook into a dataframe. You need a dict or list datastructure. Now it seems to be a class/method.
Does anyone know why the RSI is calculated at 2 time steps? It seems the standard settings on Trading View would be 14 time steps. Thanks for the help.
Hello, thank you for the great content. I hope that you will do an educational course to create a complete trading bot in Python for the Binas platform and introduce more than one strategy. Thank you
Hey Muayd, maybe somewhen in the future. If you want to support me financially (and also get access to the code) you should consider becoming a channel member: ua-cam.com/users/Algovibesjoin
Order is pending as long as the price level is not triggered. You can add something like a cancelling time horizon (end of day, end of month,...) as an option.
def conditions(df): df['Buy'] = np.where((df.Close < df.Lower) & (df.Close > df.SMA_200), 1,0) df['Sell'] = np.where((df.rsi > 50), 1,0) do you have suggestion for the values that i might can change for buying and selling order
Hi mate, can you please check the other videos in the cryptobot playlist? Should be covered there. If you have any remaining question please feel free to reach out!
I may ask you for a coding strategy. How about a double/bottom top. I have checked it and it works fine with cryptocurrencies. A bot scanning a bunch of crypto when price going near a double top o double bottom. As an idea
This is something I can imagine doing once I have slightly more time. I am currently pretty swamped. Until then there are a lot of free resources on my channel which you are invited to check out!
Hi Algovibes, I am trying to use this script to build an strategy. But I am struggling with my trigger condition. My buy condition should use few conditions. A). EMA cross, B) SlowEMA is increasing , but should be only one buy signal after the EMA Cross. Example: if when the EMACross, the SlowEMA is greater than previos SlowEMA, buy is trigger. Is SlowEMA is not greater, it waits until the first SlowEMA is greater than the previous one. Obviously, is EMACROSS In the other side, the condition is reset. In case buy condition is meet, and aferre that SL or TP is get. I need to wait until next crossEMA again Any clue how to approach it? Thanks in advance
Hi Wal, thanks a lot for your comment. Well, hard to answer that with a comment. I have covered crossovers and stuff like that in previous videos. Maybe try to combine some of them. Or specify where exactly you struggle with, would be way easier to help then.
@@Algovibes Hi, i have found another YT chanel that is using a direrent appoach, and it was usefull for me to solve the issue. if you dont mine, i could mention the UA-cam channel just in case other would like to checkit (even though, he hs mentioned you in one of his videos)
@@Algovibes Because we are using market order , in a situation where the price briefly reaches your sell price, but maybe the bid quantity was less than the amount you are selling, then the price goes down, you find that you have sold a fraction of your sells , maybe out of a quantity of 20 you have sold only 4. Then the print order is printed , and the bot goes on to look for another coin satisfying the condition. It has happened to my bots several times
Hello Algo, thank you for the great content, keep it up :) i tried running the code but i think it doesnt work well with coins that have minqty 1 ... it does leave 1 digit after the decimal point while it shouldnot. great effort man 👍👍
Thanks mate, therefore I used the right_rounding function to cope with that. Can you give me an example coin where it doesn't work for you? Will have a look.
price function is wrong limit=0.98 because there are more floating numbers remove the limit and add the quantity calculation function in it as investment*0.999 it will work For buy limit orders, you should add timeInForce='GTC', inside the function
@@Algovibes I mean how high frequency market makers use order history on NASDAQ to create orders on binance. So, if NASDAQ is going up then they buy bitcoin, and if NASDAQ going down then they sell bitcoin. (Of course they might have additional logic too, but this is the idea.)
Have you actually used any of your bots in real money trading? How much was your principle and how long did you let your bot trade for? What is your ROI and over what timeframe?
These bot tutorials are tutorials and there is a crystal clear disclaimer before every video. I am letting certain bots run and usually post trading results in e.g. the community tab. I am trying my best to answer every comment - yet I cannot answer immediately. The goal of this channel isn't to sell trading strategies but to use different aspects of data related fields to design trading strategies.
Hello your video is very good. I have some problem I am unaware from Paython programming and Software can you help me that I learn to this type of code.
Thanks mate! Sure, you can check out my Python Introduction and Python for Finance stuff afterwards. I got more then 100 videos which are happy to be checked out 😛
Unfortunately not 100% correct. Problem with that is you are ending up with a '0.000010' which string length exceeds the "real" Lotsize decimal length (6 instead of 5). I would just add a BTC condition to get rid of the problem.
I build bots too. But in your video is always something new :)
Awesome. Thanks a lot for watching and your comment!
Empowering content! Much respect
Thank you very much Christopher.
Instead of calculating it yourself, I'm pretty sure you can pull price precision and quantity precision data from the Binance API for every pair you want to trade. On the other hand, that would put more unnecessary weight request on the API, too much weight and the Binance API starts refusing the queries. Also, great video, I've kinda given up trying to trade for profits, but I always learn so much Python from your videos, thanks!
Hey man, that's awesome to read, thanks a lot. Pretty sure you actually can't but happy to be corrected!
I am a metastock algo trader that wants to move into python. Thanks for the content.
Thanks :-) Be invited to check out my stuff then.
Nice!! Yes please run the bot for some time, I'm very interested in the results! :-)
Thanks man! I will do so (with maybe 1-2 amendments).
Always good content here thanks.
for those who wants to round price and qty on futures you can do this:
def get_symbol_info(symbol):
info = client.futures_exchange_info()
for item in info['symbols']:
if(item['symbol'] == symbol):
price_dec = item['pricePrecision']
qty_dec = item['quantityPrecision']
return price_dec, qty_dec
price_precision = get_symbol_info(symbol)[0]
qty_precision = get_symbol_info(symbol)[1]
Thanks mate, didn't verify that yet but thanks for sharing.
@@Algovibes
but I realized that some values are not up to date, binance has a shitty api.
Thanks to you, 2 months ago I didn't even know how to code, after coming across one of your videos and I got a taste for it and now I make my trading bot myself, thank you again
thank you , Great content
Thanks for watching my friend :-)
Thank you algo!! Great like always!
Thanks for watching and your support man!
is that normal: Series([], name: symbol, dtype: object)
and what else if I stop the script and start it again, it also shows what it bought
Yea, just shows that you are currently not in a position.
@@Algovibes i have send a emal
@@sammydk84 did you get your problem fixed? and if yes what was the fault that caused it?
Quick question.. if you are using only the last Row to check If buy or sell, why ejecute the conditions function to the entire data frame?
Could be better to calculate it directly in the Trade function?
I don’t know if I miss something else.
Can you give me some timestamps where you are referring to? Helps me in providing faster and qualitative solutions. Thanks mate
For security, this isn't running in Google colab? Which editor are you using?
Thank you for the content 👍👍👍
Didn't test it in Google collab. Using Jupyter here.
Awesome content - Thank you so much!
Quick question: In which video can I find info about how to set up the client?
Thanks buddy, just the first one in the cryptobot playlist
Where is the video for the long term bot deployment? I'd love to check it out.
I was posting the trading logs in the community tab some days/weeks later
you dont need to work with floats. just use decimal module with quantize function.
Would disagree on that but happy for an elaboration!
Great video! I think you changed time frame from ‘day’ to ’minute’. Did you have any backtest result on this setup?
Thanks man. Yes, I did. No, not yet. Gotta let it run live in the upcoming weeks and either make a vid or a community post on the results.
Excelent Bot ... thank you.
Thanks YOU for watching :-)
awesome and nice explained
Thanks a lot Gerardo!
Hello Mr.Algovibes. Thanks so much for your nice information.
I have a question about web socket real-time data download from Binance and its calculation. After downloading the web socket data and I calculated them to be 1 minute (or 5 minutes) historical data, but my calculation is not the same with '1m' historical data(REST) from Binance. Can you recommend any good idea to resolve this issue?
Hi mate :-)
Do you consider the prices which have a true value for closed candles? The websocket contains "intracandle" data as well.
it somehow doesnt open any trades at all - Series([], Name: symbol, dtype: object)
thats the only message i get back
If no buying conditions are fulfilled the bot won't buy anything. So this is not uncommon.
great stuff !! Vielen Dank 👍
Thx buddy :-)
@@Algovibes i have problems with the lotsize of BTCUSDT, it returns 1e-05 , its not possible to calculate qty, how to fix that ? on the most pairs it works, i think it means 5 decimals
Lotsize = [i for i in info['filters'] if i['filterType'] == 'LOT_SIZE'][0]['minQty']
Lotsize = Decimal(Lotsize).normalize()
this works, removed float conversion, and removing trailing zeros
need import decimal
from decimal import Decimal
very entertaining!!
thanks mate
Thanks a lot for sharing
Thanks a lot for watching :-)
Such a good content 😃
Happy to read that man, thanks for watching! :-)
@@Algovibes i click some adv 😅 is it ohk ?
Hi, I'm trying to turn BitMex order book data into a data frame using the same method you used on binance
When I run this code:
orderbook = client.OrderBook.OrderBook_getL2(symbol='XBTUSD').result()
orderbook_dataframe = pd.DataFrame(orderbook)
I get this error:
object of type RequestsResponseAdapter has no len()
Any ideas?
Yea, you need to make sure you can actually convert the orderbook into a dataframe. You need a dict or list datastructure. Now it seems to be a class/method.
how do the conditions need to look so it creates a buy order based on the RSI?
By taking a similar logic. I think I covered that in one of the previous videos. Be invited to check out the cryptobot playlist.
Does anyone know why the RSI is calculated at 2 time steps? It seems the standard settings on Trading View would be 14 time steps. Thanks for the help.
Hi Alex, i am simply taking the settings from the backtested strategy. I linked the video in the description (was some strategy from Rayner).
Hello, thank you for the great content. I hope that you will do an educational course to create a complete trading bot in Python for the Binas platform and introduce more than one strategy. Thank you
Hey Muayd,
maybe somewhen in the future. If you want to support me financially (and also get access to the code) you should consider becoming a channel member:
ua-cam.com/users/Algovibesjoin
what if the market runs away?
does he cancel the order and place it again or continue with it
sorry for my bad english
Order is pending as long as the price level is not triggered. You can add something like a cancelling time horizon (end of day, end of month,...) as an option.
def conditions(df):
df['Buy'] = np.where((df.Close < df.Lower) &
(df.Close > df.SMA_200), 1,0)
df['Sell'] = np.where((df.rsi > 50), 1,0)
do you have suggestion for the values that i might can change for buying and selling order
or how do i write the code that it buys below a rsi of 30? (df.Close > df.rsi, 1,0) - is that right?
df.rsi < 30 i mean
Hi mate, can you please check the other videos in the cryptobot playlist? Should be covered there. If you have any remaining question please feel free to reach out!
can you make a video on executing trades on DEX exchange instead of binance? are there any libraries who solve DEX trade execution in Python?
Good question and indeed an interesting topic. Didn't have any exposure to APIs on DEX yet.
I may ask you for a coding strategy. How about a double/bottom top. I have checked it and it works fine with cryptocurrencies. A bot scanning a bunch of crypto when price going near a double top o double bottom. As an idea
Thanks a lot for the suggestion juan!
Hi, thanks man for such great content for free, I wanna know if you have any paid course on automated trading from beginner to advanced?
He has videos on how to do everything, your course could just be watching them and making similar ones
This is something I can imagine doing once I have slightly more time. I am currently pretty swamped. Until then there are a lot of free resources on my channel which you are invited to check out!
@@AnotherAnon735 в
Algovibes , any results on the perfomance of this bot?
Didn't deploy it yet. Video was performing quite purely so I concluded no interest in that. But will keep you updated if I do so!
@@Algovibes Please give us an update Algovibes
You should do something with foreign exchange
Thx for the suggestion. Already on my list but have to see when I am covering that.
Hi Algovibes, I am trying to use this script to build an strategy. But I am struggling with my trigger condition.
My buy condition should use few conditions. A). EMA cross, B) SlowEMA is increasing , but should be only one buy signal after the EMA Cross.
Example: if when the EMACross, the SlowEMA is greater than previos SlowEMA, buy is trigger. Is SlowEMA is not greater, it waits until the first SlowEMA is greater than the previous one.
Obviously, is EMACROSS In the other side, the condition is reset.
In case buy condition is meet, and aferre that SL or TP is get. I need to wait until next crossEMA again
Any clue how to approach it?
Thanks in advance
Hi Wal, thanks a lot for your comment.
Well, hard to answer that with a comment. I have covered crossovers and stuff like that in previous videos. Maybe try to combine some of them.
Or specify where exactly you struggle with, would be way easier to help then.
@@Algovibes Hi, i have found another YT chanel that is using a direrent appoach, and it was usefull for me to solve the issue.
if you dont mine, i could mention the UA-cam channel just in case other would like to checkit (even though, he hs mentioned you in one of his videos)
How do I handle incomplete sells by the bot, probably the price went down before the bot completed the limit sell? thanks
Can you provide an example when exactly this would happen?
@@Algovibes Because we are using market order , in a situation where the price briefly reaches your sell price, but maybe the bid quantity was less than the amount you are selling, then the price goes down, you find that you have sold a fraction of your sells , maybe out of a quantity of 20 you have sold only 4. Then the print order is printed , and the bot goes on to look for another coin satisfying the condition. It has happened to my bots several times
Do you know something about sending orders by websocket to Binance ? Is it possible now ?
I am also interested
As far as I know: No.
great video! please run and make a video about the results and backtesting
Thanks mate. Sure! Interested in that as well. I think I am going to do some more amendments tho before in the infrastructure.
First, love your videos btw
Thanks buddy :-)
Hello Algo,
thank you for the great content, keep it up :)
i tried running the code but i think it doesnt work well with coins that have minqty 1 ... it does leave 1 digit after the decimal point while it shouldnot.
great effort man 👍👍
Thanks mate,
therefore I used the right_rounding function to cope with that. Can you give me an example coin where it doesn't work for you? Will have a look.
@@Algovibes BTC
@@Algovibes Thanks so much for sharing..!Really helpful for understanding the logic.Keep up!
price function is wrong limit=0.98 because there are more floating numbers remove the limit and add the quantity calculation function in it as investment*0.999 it will work
For buy limit orders, you should add timeInForce='GTC', inside the function
Can I purchase this bot and pay installation and set-up fees?
Hi Matthew,
no, I don't offer that. Thanks for your understanding!
@@Algovibes thank you for your time, do you happen to know where’s to look to purchase?
Amazing 😍😄😍💕💕.
❤️
How's Xec and vision tokens are..plz explain
What are the backtest results?
For a Backtest please check out the linked video in the description. I didn't test it on Cryptos yet tho!
Thanks very much, you got some really informative videos. Can you please do a video on using NASDAQ and DOW as a leading indicator for Bitcoin market.
Thanks a lot Muhammad,
can you elaborate on your suggestion?
@@Algovibes I mean how high frequency market makers use order history on NASDAQ to create orders on binance. So, if NASDAQ is going up then they buy bitcoin, and if NASDAQ going down then they sell bitcoin. (Of course they might have additional logic too, but this is the idea.)
I have joined as a member with access to code. How is the code obtained.
Hi Eric,
just write me a mail (you can find it in the about section).
@@Algovibes what is email address
@@ericsaare7373 Just check out the About section. You'll find it there.
In the about section there only is a web address and no email. I am seeking code for your latest crypto trading bot
@@ericsaare7373 businessalgovibes@gmail.com
Have you actually used any of your bots in real money trading? How much was your principle and how long did you let your bot trade for? What is your ROI and over what timeframe?
He answered other questions but not yours. Red flags. I got scammed with one of those bots before. DYOR
These bot tutorials are tutorials and there is a crystal clear disclaimer before every video. I am letting certain bots run and usually post trading results in e.g. the community tab.
I am trying my best to answer every comment - yet I cannot answer immediately.
The goal of this channel isn't to sell trading strategies but to use different aspects of data related fields to design trading strategies.
#pitbulltoken🐢🐢🐢
code in google Drive ?
Hi Sammy,
yes. Will add it the upcoming days!
Im running this bot for 2 weeks and it didnt buy nothing yet.. im starting to think that something is wrong... XD
There is an error in the codes
except:
continue
change =>
finally:
pass
you can see the error code
@@kemalselamicimen666 Did you double check that the coins were fulfilling the buying conditions within those two weeks?
I already fixed it, as i modify a bit the code was totally my foult 😅 but thanks!
Hello your video is very good. I have some problem I am unaware from Paython programming and Software can you help me that I learn to this type of code.
Thanks mate!
Sure, you can check out my Python Introduction and Python for Finance stuff afterwards. I got more then 100 videos which are happy to be checked out 😛
DISLIKE
What can I do to turn the thumb around?
traducir al español
Hmm..isn't it possible to activate like Spanish subtitles?
Por que no aprendes tú ingles?
'{:f}'.format(Lotsize) will fix the issue when doing BTCUSDT
Unfortunately not 100% correct. Problem with that is you are ending up with a '0.000010' which string length exceeds the "real" Lotsize decimal length (6 instead of 5). I would just add a BTC condition to get rid of the problem.
Awesome content - Thank you so much!
Quick question: In which video can I find info about how to set up the client?
Thanks mate.
Pls check out the very first video in this playlist:
ua-cam.com/play/PL9ATnizYJ7f8_opOpLnekEZNsNVUVbCZN.html