MT5 and Python: Can we simply update ticks in a DataFrame without having billions of wasted(?) cycles on MT5 in a couple of minutes?

 

Please, watch the little GIF.

I just want to update the dataframe column 'last' price and do some calculations after the update loop. Why so many cycles? sounds like a waste of resources.


Number of stocks and options: 4900

I'm using MT5, Python, Pandas.


Loop the names of the stocks / options and update their last prices:

df['last'] = 0.0
len(df)
for n in df.name.index:
    df['last'].values[n] = getTick(df.name[n]).last

getTick is using mt5.symbol_info_tick('stockname')

Already tried other panda modes to update the values, like .at,.apply etc.


How to optimize the MT5 > Python > Pandas ticks stream? The update is slow (the first loop takes 5 minutes or more). 

So many cycles and still slow to update.


Please, any advice?

If you have an example of code to show how you do it would be great.

Documentação sobre MQL5: MetaTrader para Python / symbol_info_tick
Documentação sobre MQL5: MetaTrader para Python / symbol_info_tick
  • www.mql5.com
Obtém o último tick do instrumento financeiro especificado. symbol [in]  Nome do instrumento financeiro. Parâmetro sem...
Arquivos anexados: