Search code examples
pythonforex

cannot connect to fxcm server via api


I get error that i cannot connect to FXCM server. I did look at older threads and it appears that i have the right settings with fxcmpy version at 1.2.6. What else needs to be reconfigured?

print(fxcmpy.__version__)
print(socketio.__version__)

1.2.6 
5.0.4 

con = fxcmpy.fxcmpy(access_token='hidden', log_level='error', server='real', log_file='log.txt')
ServerError                               Traceback (most recent call last)
<ipython-input-7-a645a1cf535a> in <module>
----> 1 con = fxcmpy.fxcmpy(access_token='hidden', log_level='error', server='real', log_file='log.txt')

~\anaconda3\lib\site-packages\fxcmpy\fxcmpy.py in __init__(self, access_token, config_file, log_file, log_level, server, proxy_url, proxy_port, proxy_type)
    216             raise ServerError('Can not find FXCM Server.')
    217         elif self.connection_status == 'aborted':
--> 218             raise ServerError('Can not connect to FXCM Server.')
    219 
    220         self.__collect_account_ids__()

ServerError: Can not connect to FXCM Server.

Solution

  • the right packages versions are required.

    >>> import fxcmpy
    

    import socketio

    import engineio

    con = fxcmpy.fxcmpy(access_token='hidden', log_level='error', server='real', log_file='log.txt') print(fxcmpy.version) 1.2.6 print(socketio.version) 4.4.0 print("python-engineio version: " + engineio.version) python-engineio version: 3.9.0