Subscribe to live ticks in Python - bug in documentation?

WorthyVII
95
WorthyVII  

The example code on this page does not work


https://www.mql5.com/en/docs/integration/python_metatrader5/mt5marketbookget_py


AttributeError: module 'MetaTrader5' has no attribute 'market_book_add'




I was looking to a way to subscribe to live ticks in Python....

Documentation on MQL5: Integration / MetaTrader for Python / market_book_get
Documentation on MQL5: Integration / MetaTrader for Python / market_book_get
  • www.mql5.com
market_book_get - MetaTrader for Python - Integration - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Alexey Petrov
Admin
1376
Alexey Petrov  

Probably you have an outdated MT5 package.

Try from the command line:

pip install metatrader5 --upgrade


WorthyVII
95
WorthyVII  
I did this but it didn't work the first time, guess I"m not great with python.
Uninstalled and reinstalled and it works, thanks,
WorthyVII
95
WorthyVII  

Ok next issue is that nothing seems to be outputting, and it is erroring instantly but the error is Success??



Vladimir Karputov
Moderator
264076
Vladimir Karputov  

I checked on

 2021.07 . 23 07 : 50 : 27.755 Python  MetaTrader5 package version :   5.0 . 34

, trade server

 2021.07 . 23 06 : 25 : 42.574 Terminal        MetaTrader 5 x64 build 3003 started for MetaQuotes Software Corp.


The example ( https://www.mql5.com/en/docs/integration/python_metatrader5/mt5marketbookget_py ) worked without errors.

Documentation on MQL5: Integration / MetaTrader for Python / market_book_get
Documentation on MQL5: Integration / MetaTrader for Python / market_book_get
  • www.mql5.com
market_book_get - MetaTrader for Python - Integration - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Dominik Egert
1933
Dominik Egert  
MT5 build 3003 is beta, right? Try the release version.