Tick

class metatrader5EasyT.tick.Tick(symbol: str)[source]

Tick class is the responsible to retrieve every tick information.

__init__(symbol: str)[source]
Parameters

symbol – It is the symbol you want information about. You can have information about time, bid, ask, last, volume.

change_symbol(new_symbol: str) None[source]

This function changes the symbol.

Parameters

new_symbol – It receives the new symbol

Returns

It updates the self._symbol to the new symbol.

get_new_tick() None[source]

Everytime this function is called it update the last tick information, it is important to have update information know the most recent information.

Returns

It updates the attributes in the constructor.

Examples

>>> # All the code you need to execute the function:
>>> from metatrader5EasyT.initialization import Initialize
>>> from metatrader5EasyT.tick import Tick
>>> initialize = Initialize()
>>> initialize.initialize_platform()
>>> initialize.initialize_symbol('EURUSD')
>>> # It will return the most recent information, but it will return None at the first time.
>>> # The tick need the information to be updated everytime.
>>> eurusd_tick = Tick(symbol='EURUSD')
>>> eurusd_tick.ask
None
>>> # When you update the tick:
>>> eurusd_tick.get_new_tick()
>>> eurusd_tick.ask
1.09975
>>> eurusd_tick.bid
1.09975
>>> # You must have notice that I used bid and ask, some exchanges do not return the last value
>>> # You can find only the information for bid and ask. If you try to return last it will print 0.0.
>>> # But remember, not all the exchanges do that, you must check it.
>>> eurusd_tick.last
0.0

You can ask for this information: time, bid, ask, last, volume.