Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
DiMiTriFrog opened this issue Jul 17, 2023 · 6 comments
Closed

Comments

@DiMiTriFrog
Copy link

DiMiTriFrog commented Jul 17, 2023

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
Copy link

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
Copy link
Author

PLEASE IT'S IMPORTANT :(

@traderpedroso
Copy link
Member

traderpedroso commented Jul 20, 2023

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
Copy link
Author

So interesting all you are talking!!

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

@traderpedroso
Copy link
Member

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
Copy link
Author

Thank you very much Pedro!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants