Python mt5.symbols_get() method

 

Hi,

When I run this method at Python shell, I get a tuple with all symbol info for all symbols.


Example of one symbol:

SymbolInfo(custom=False, chart_mode=0, select=False, visible=False, session_deals=0, session_buy_orders=0, session_sell_orders=0, volume=0, volumehigh=0, volumelow=0, time=0, digits=5, spread=0, spread_float=True, ticks_bookdepth=0, trade_calc_mode=0, trade_mode=4, start_time=0,...


This is a tuple with many standardized classes (for each symbol), with standardized arguments (custom, chart_mode,...).


Does anybody know how can I iterate though those arguments and make a list [] of them?

 

giving a tuple in a good visual format

import MetaTrader5 as mt5

# connect to MT5
if not mt5.initialize():
    print("initialize() failed")
    mt5.shutdown()

symbol = "EURUSD"

#Getting Symbol info
symbol_info=mt5.symbol_info(symbol)._asdict()

# print the result
for key, value in symbol_info.items():
    print(key + ": " + str(value))

# shut down MT5
mt5.shutdown() 
 
@Ismail Sufian Komesha #: giving a turple in a good visual format

I have edited your post. Next time, please use the CODE button when you insert code.

Code button in editor