ejtraderLabs / ejtraderMT

Metatrader 5 API - Trading and history OHLC Dataframe in Nano Seconds
GNU General Public License v3.0
70 stars 28 forks source link

AttributeError: 'Functions' object has no attribute 'streaming_socket' #9

Closed DiMiTriFrog closed 11 months ago

DiMiTriFrog commented 11 months ago

When i run ->

from ejtraderMT import Metatrader

api = Metatrader()

symbols = ["EURUSD","GBPUSD","AUDUSD"]
timeframe = "TICK"

# stream price
while True:
    price = api.price(symbols,timeframe)
    print(price)

I have this output ->


Exception in thread Thread-1 (_price):
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/ejtraderMT/api/mql.py", line 420, in _price
    connect = self.__api.live_socket()
              ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Functions' object has no attribute 'live_socket'. Did you mean: 'sys_socket'?

All other functions are working.
github-actions[bot] commented 11 months ago

We're glad you've opened your first issue. Please provide all the necessary details and any relevant code or screenshots to help us understand the problem better. Our team will review your issue and provide assistance as soon as possible. Thank you for contributing!

DiMiTriFrog commented 11 months ago

PLEASE IT'S IMPORTANT :(

traderpedroso commented 11 months ago

You can use the 'history' function where the last line of data represents the last close and the current bid price. The streaming option is not stable and generates data lag. However, you can use the 'history' option in a normal loop to get the real-time price. For real-time bid and ask prices, I suggest using ejtraderCT, which is much faster and more efficient. I normally use ejtraderMT solely for historical data, and for real-time data, I use ejtraderCT, which undoubtedly provides better and faster data for decision-making in high-frequency bots. However, in the next version of ejtraderMT, which will have its core in Rust with Python binding, this problem will be resolved, providing more speed and stability for the API.

DiMiTriFrog commented 11 months ago

So interesting all you are talking!!

But with ctrader could I get the last candle? or only the last price?

traderpedroso commented 11 months ago

So interesting all you are talking!!

But with ctrader could I get the last candle? or only the last price?

last bid and ask price

DiMiTriFrog commented 11 months ago

Thank you very much Pedro!