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

Connection Failure to cTrader Demo Server with ejtraderCT #38

Open
szabiszabiszabi opened this issue Nov 8, 2024 · 0 comments
Open

Comments

@szabiszabiszabi
Copy link

Description:
I am experiencing persistent connection issues when attempting to connect to the cTrader demo server using the ejtraderCT library. Specifically, I encounter the following errors during initialization:

  • [Errno 11001] getaddrinfo failed — This occurs when trying to resolve the hostname.

  • 'FIX' object has no attribute 'logged' — This occurs after initialization, likely due to the FIX object not being fully set up.

Goal:
To successfully connect to the cTrader demo server, subscribe to symbols, and retrieve real-time quotes using the demo account credentials.

Steps to Reproduce:
Installed ejtraderCT using the following command: pip install ejtraderCT

Used the following connection details to initialize Ctrader:

Host: demo2-us.p.ctrader.com
Ports: 5202 (Plain text) and 5212 (SSL)
Account (SenderCompID): demo.fundingpips.5463962
TargetCompID: cServer
SenderSubID: TRADE
Password: [Configured FIX API password for the demo account]

Created a Python script to test basic connectivity:

from ejtraderCT import Ctrader
from time import sleep

Connection details

server = "demo2-us.p.ctrader.com:5212"
account = "demo.fundingpips.5463962"
password = "PASSWORD"

def initialize_api_connection():
try:
print("Attempting to initialize API connection...")
api = Ctrader(server, account, password, debug=True)
sleep(3)
if api and api.isconnected():
print("Connection to cTrader FIX API successful.")
return api
else:
print("Connection to cTrader FIX API failed.")
return None
except Exception as e:
print(f"Exception occurred: {e}")
return None

api = initialize_api_connection()

Observed the following output:

Attempting to initialize API connection...
ERROR:root:[Errno 11001] getaddrinfo failed
Exception occurred: 'FIX' object has no attribute 'logged'

Troubleshooting Steps Taken:

Verified Network Connectivity:
Used nslookup and ping to confirm that the hostname demo2-us.p.ctrader.com resolves correctly.
Confirmed that port 5212 is accessible and the IP resolves to 99.83.130.204.

Simplified the Script:

Removed logging to ensure no interference with Ctrader.py logging.
Set debug=True in Ctrader to activate internal logging, but the issue persisted.

Checked Code for Potential Causes:

Examined Ctrader.py and noted the self.fix.logged attribute is not being set, leading to NoneType errors.
Confirmed that the error arises before reaching symbol subscription or data retrieval.

Observed Behavior:
getaddrinfo failed suggests a hostname resolution issue, although manual network tests confirmed the hostname is accessible.
'FIX' object has no attribute 'logged' implies that the FIX object within Ctrader is not fully initialized.

Environment:
Python Version: 3.8.10
OS: Windows 10
ejtraderCT Version: 1.1.13

Questions:
Are there any known issues with ejtraderCT when connecting to cTrader demo servers?
Could specific configurations or workarounds be required to handle demo server connectivity?
Is there an updated version or patch that addresses these initialization errors?

Additional Information:
If there are any diagnostic logs or internal settings that can help troubleshoot this further, please let me know. I’d be happy to provide additional details or run further tests as needed.

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

1 participant