If you find this useful or interesting, please consider subscribing and hit the like button. Thanks in advance 🙂 Get the …
46 Comments
Hey algo, I'd love to thank you so much man following along with your videos and such and studying my quant degree Ive recently managed to get a job as a grad quant trader, it means so much to me man
why do we need sql or csv? why cant we have a list of dataframes and keep appending the right price to the right symbol and automaticaly run calculations in pandas ? btw asking out of ignorance
Thanks a lot for the awesome content ….perfectly well done!!
I have a question and I hope you will have an advice or a solution for that: How can we deal with bots that has while loop (while True:)? As I noticed that crontab doesn't work with it , also I tried using @reboot in the crontab and it still doesn't work!
Great content Algovibes, I have been experimenting a lot with your scripts, but about the cronjob in this one, I think a safer way, would be using a bash script that checks if the trading script is running, otherwise you could end up with too many instances. Something like: (runtrading.sh) #!/bin/bash
Thank you very much for this and all your other Python videos. Your projects are very interesting and provide an excellent framework for others to build from. I really enjoyed this one and your clear and concise explanation of it.
hey, wouldn't it better to create the stop loss and take profit orders upfront after the limit order filled? if the price is moving very fast then we can have a quite a big loss.
Hello question here. Im having connection error terminated by peer using binance api after few loops. I encapsulated with while try exception but it still stop with error after few loops.
Thanks for the awesome work. I have a question. The code stops running after the first successful buy and sell in raw python. Is there a way to keep it running?
Ahoi. Erst ein mal danke für die Videos. Extrem interessant. Ich bin totaler Anfänger und hatte mich jetzt etwas in python+sqlite eingearbeitet und nun aber gesehen, dass Du mittlerweile 'ne andere Variante bevorzugst. Wie wäre jetzt der empfohlene Fahrplan um erst mal alle Grundlagen zu bekommen? So nach dem Motto: 1.python und api 2. python und Datenbank……usw. Weil…wenn ich jetzt die Videos der Reihe nach durcharbeite, sind vielleicht einige Sachen nicht mehr aktuell und ich verschwende Zeit. Es wird ja sicher Gundthemen geben, die ich erst mal einzeln lernen kann, um dann Deinen Videos folgen zu können. Wie hast Du Dich eigentlich in das Thema eingearbeteitet? Bücher, Videos, Foren? Habe mir das Buch "Python for Finance" geholt und muss mal schauen, ob das geeignet ist. Die Technik ist ja doch sehr schnelllebig und das Buch ist von 2018.
I'm running into this error: Lotsize = float([i for i in info['filters'] if i['filterType'] == 'LOT_SIZE'][0]['minQty']) TypeError: 'NoneType' object is not subscriptable Did I miss something?
I need some help again 🙄😅 when i am in the linux instance and i am Creating a new py file it says: [1] Error und there are no files stored in my csvs :/ Also when I am trying this code as you showed in the beginning the msg always changes sometimes from 67 outputs to 110…
Very good content! I followed your channel on last Sunday, and I'm running my own bot now! I also found a timelag problem for price qry, so you solved it by transiting to web stream? Timelag keep draining my money even I found good deals… another question~ can you recommend GCP resource size to run trading bot 24/7?
Another suggestion i can give you is to put gcp servers not in your country but in japan that is the closest to Binance servers; this way you can bring your request to binance quickier (0,30sec average for eu against 0,04 japan)
When you converted the symbol into dataframe the index of the goes along with it making a redudant column at the beginning when it is converted into CSV file. A better approach would be to remove that column using this piece of code
def on_message(ws, message):   msg   = json.loads(message)   keys  = ['E','s','c']   symbol = [list(map(x.get, keys)) for x in msg if (x['s'].endswith('USDT') and (not ('UP' in x['s'] or "DOWN"  in x['s'])) )]     frame  = pd.DataFrame(symbol, index=None , columns=['E','s','c'] )   frame.E = pd.to_datetime(frame.E, unit='ms')   frame.c = frame.c.astype(float)     for row in range(len(frame)):     data = frame[row: row+1]     data[['E','c']].to_csv(path+data['s'].values[0]+'.csv',mode='a', header = False, index=False)
Hi i need some help so while i am converting string to float using last_df['free'] =last_df['free'].astype(float) there is a loss of precision after 6 digits from decimal point is there any way to fix this.
Really good video. Thank you for sharing! I am trying to build my trading bot and your video help me a lot. One small question, once I implement the automatic running, do you know how to stop it? For example, if I would like to adjust the buy/sell trigger, I have to stop the bot and modify the code.
Thank you so much for shareing your knowledge! In the new code, you didn´t remove the levarage tokens, and when i try to do it doesnt work. Is there something that im doing wrong or the new method is somehow incompatible?
I'm tired… Youtube keeps removing my comments on your videos. I tired to repost 5 times and it removes everytime. Not the first time happening, and I have no idea why.
While storing the data in the CSV file ".csv" should be added in the File path at the end so that it is actually stored as CSV file. If this is not done the data will be stored as FILE type. This code >> path+data['s'].values[0] should be changed as path+data['s'].values[0]+'.csv'
Hi Algo, off topic Here, how would the Margin trading work with python bot? Should i trade with only UP and Down coins and then just use Margin trading orders or is there another catch? Thank you
Hey algo, I'd love to thank you so much man following along with your videos and such and studying my quant degree Ive recently managed to get a job as a grad quant trader, it means so much to me man
why do we need sql or csv? why cant we have a list of dataframes and keep appending the right price to the right symbol and automaticaly run calculations in pandas ? btw asking out of ignorance
Great video! Just wondering why I would only be getting 10-15 coins showing? I'm not getting all coins that end with 'USDT'.
Congrats on another excellent video. What would be the benefit of sharing the reason why you switched to CSV file storage versus SQLite?
Thanks a lot for the awesome content ….perfectly well done!!
I have a question and I hope you will have an advice or a solution for that:
How can we deal with bots that has while loop (while True:)? As I noticed that crontab doesn't work with it , also I tried using @reboot in the crontab and it still doesn't work!
Thank you in advance!
GitHub link?
How do you change this to different timeframes, like 1m 5m 15m for calculating TA
Great content Algovibes, I have been experimenting a lot with your scripts, but about the cronjob in this one, I think a safer way, would be using a bash script that checks if the trading script is running, otherwise you could end up with too many instances. Something like: (runtrading.sh)
#!/bin/bash
if ! pgrep -x "scriptname.py" > /dev/null
then
# run scriptname.py
fi
Although, I think it's better to change the quit() function with something else, removing the cronjob altogether.
Thank you very much for this and all your other Python videos. Your projects are very interesting and provide an excellent framework for others to build from. I really enjoyed this one and your clear and concise explanation of it.
hey, wouldn't it better to create the stop loss and take profit orders upfront after the limit order filled? if the price is moving very fast then we can have a quite a big loss.
Hi guys, only me getting error "name 'msg' is not defined " at 4.10 ?
Excellent content as always. Thank you!
I really want to thank you for this great video
Thank You! please tell me what could be the reason for writing data to csv files with a delay of about 10 minutes
Hello question here. Im having connection error terminated by peer using binance api after few loops. I encapsulated with while try exception but it still stop with error after few loops.
where is the source code and how to setup?
Thanks for the awesome work. I have a question. The code stops running after the first successful buy and sell in raw python. Is there a way to keep it running?
it doesn't work for me, there are a lot of errors. overcame some. stuck on some
top_coin = symbols[rets.index(max(rets))]
ValueError: max() arg is an empty sequence
Thank you ,where can i get the code
Ahoi.
Erst ein mal danke für die Videos. Extrem interessant. Ich bin totaler Anfänger und hatte mich jetzt etwas in python+sqlite eingearbeitet und nun aber gesehen, dass Du mittlerweile 'ne andere Variante bevorzugst.
Wie wäre jetzt der empfohlene Fahrplan um erst mal alle Grundlagen zu bekommen? So nach dem Motto:
1.python und api
2. python und Datenbank……usw.
Weil…wenn ich jetzt die Videos der Reihe nach durcharbeite, sind vielleicht einige Sachen nicht mehr aktuell und ich verschwende Zeit.
Es wird ja sicher Gundthemen geben, die ich erst mal einzeln lernen kann, um dann Deinen Videos folgen zu können.
Wie hast Du Dich eigentlich in das Thema eingearbeteitet? Bücher, Videos, Foren?
Habe mir das Buch "Python for Finance" geholt und muss mal schauen, ob das geeignet ist. Die Technik ist ja doch sehr schnelllebig und das Buch ist von 2018.
I'm running into this error:
Lotsize = float([i for i in info['filters'] if i['filterType'] == 'LOT_SIZE'][0]['minQty'])
TypeError: 'NoneType' object is not subscriptable
Did I miss something?
And How much cost doing this in GCP?
hey Algo, grate videos here. Im a new follower! Just a question: do you already think about to create a bot to trade using pancake as router?
can it automatically transfer funds to my margin wallet to shortsell coins?
How about talib-library for Python?
I need some help again 🙄😅 when i am in the linux instance and i am Creating a new py file it says: [1] Error und there are no files stored in my csvs :/
Also when I am trying this code as you showed in the beginning the msg always changes sometimes from 67 outputs to 110…
Hei,
You are the best and the video was interesting but a short modification could be: symbol = [x for x in msg if (x['s'].endswith('USDT')
and not (x['s'].__contains__('UP') | x['s'].__contains__('DOWN') | x['s'].__contains__('BULL') | x['s'].__contains__('BEAR')))]
if you agree
Very good content! I followed your channel on last Sunday, and I'm running my own bot now! I also found a timelag problem for price qry, so you solved it by transiting to web stream? Timelag keep draining my money even I found good deals…
another question~ can you recommend GCP resource size to run trading bot 24/7?
Another suggestion i can give you is to put gcp servers not in your country but in japan that is the closest to Binance servers; this way you can bring your request to binance quickier (0,30sec average for eu against 0,04 japan)
bro i am doing the RSI calculation here
def computeRSI (data, time_window):
diff = np.diff(data)
up_chg = 0 * diff
down_chg = 0 * diff
# up change is equal to the positive difference, otherwise equal to zero
up_chg[diff > 0] = diff[ diff>0 ]
# down change is equal to negative deifference, otherwise equal to zero
down_chg[diff < 0] = diff[ diff < 0 ]
up_chg = pd.DataFrame(up_chg)
down_chg = pd.DataFrame(down_chg)
up_chg_avg = up_chg.ewm(com=time_window-1 , min_periods=time_window).mean()
down_chg_avg = down_chg.ewm(com=time_window-1 , min_periods=time_window).mean()
rs = abs(up_chg_avg/down_chg_avg)
rsi = 100 – (100/(1+rs))
rsi = int(rsi[0].iloc[-1])
return rsi
frame = pd.DataFrame(symbol)[['E','s','c']]
When you converted the symbol into dataframe the index of the goes along with it making a redudant column at the beginning when it is converted into CSV file. A better approach would be to remove that column using this piece of code
def on_message(ws, message):
  msg   = json.loads(message)
  keys  = ['E','s','c']
  symbol = [list(map(x.get, keys)) for x in msg if (x['s'].endswith('USDT') and (not ('UP' in x['s'] or "DOWN"  in x['s'])) )]
 Â
  frame  = pd.DataFrame(symbol, index=None , columns=['E','s','c'] )
  frame.E = pd.to_datetime(frame.E, unit='ms')
  frame.c = frame.c.astype(float)
 Â
  for row in range(len(frame)):
    data = frame[row: row+1]
    data[['E','c']].to_csv(path+data['s'].values[0]+'.csv',mode='a', header = False, index=False)
Hi i need some help so while i am converting string to float using last_df['free'] =last_df['free'].astype(float) there is a loss of precision after 6 digits from decimal point is there any way to fix this.
bro, this script is buying high and after the buying falling all the time
Really good video. Thank you for sharing! I am trying to build my trading bot and your video help me a lot. One small question, once I implement the automatic running, do you know how to stop it? For example, if I would like to adjust the buy/sell trigger, I have to stop the bot and modify the code.
Bro waiting for next video
Why not create docker containers for your applications?
Hey I’m new to learning your videos, any you would recommend I try to follow along with first ?
Thank you so much for shareing your knowledge! In the new code, you didn´t remove the levarage tokens, and when i try to do it doesnt work. Is there something that im doing wrong or the new method is somehow incompatible?
I'm tired… Youtube keeps removing my comments on your videos. I tired to repost 5 times and it removes everytime. Not the first time happening, and I have no idea why.
While storing the data in the CSV file ".csv" should be added in the File path at the end so that it is actually stored as CSV file. If this is not done the data will be stored as FILE type. This code >> path+data['s'].values[0] should be changed as path+data['s'].values[0]+'.csv'
data[['E','c']].to_csv(path+data['s'].values[0]+'.csv',mode='a', header = False)
thank you very much
I love Python and I find it difficult to learn because of the language
But with you, you made it easy
keep going forward
Hi Algo, off topic Here, how would the Margin trading work with python bot? Should i trade with only UP and Down coins and then just use Margin trading orders or is there another catch? Thank you
Very good video as usual. I dropped a like. I do not know if it is possible to have a video with futures in your next videos
I want to give bulk orders (abt 125) (direct market buy) with a certain amnt of money per unit, do u think is it possible? Thanks in advance
great work, thanks
can you give an example of How to implement the csv folder to empty it self after some time? im not the most experienced python programmer