Anonymous
Anonymous 's avatar

Info

Username:ctid402288
Name:Anonymous
Member since: 06 Feb 2016

About

None

Signature

None

Last Forum Posts

@Python Open API not working:  25 Jan 2023, 14:37


Check this thread below

The Klein sample does not work properly, use the console sample and adapt it to your code. You also need a broker to authorize your CTrader account to access the OpenAPI platform. If you are in the UK, you would have your work cut out finding such a broker. Having a CTrader account for desktop or Mobile Apps do not automatically grant you access to the OpenAPI service l have found. Contact your broker to negotiate access.

@Malformed client_id parameter:  25 Jan 2023, 14:06


RESOLVED

It turns out that Klein does not initialize properly on Apple Metal M1 machines. I have connected successfully using treq and Twistd. However, l have found my trading account is not currently authorized to access the OpenAPI platform. Defferred message : -  "!Trading account is not authorized". Thank you for your help PanagiotisChar.

Can anyone recommend a broker with OpenAPI support please. All of my brokers do not support CTrader OpenAPI for some reason. I have tried FXPro, Fondex and RoBoForex.

@Malformed client_id parameter:  19 Jan 2023, 19:37


PanagiotisChar said:

Hi there, 

The samples definitely work, probably you are doing something wrong in the process. Try asking in the samples GitHub repository too, maybe you will get some help by Python users.

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

I have retried the Klein sample and it does not work. The basic example on the Python SDK page connects successfuly with my credentials. But it does not carry out a OAuth authentication that

should provide an Authcode. The Console sample successfully conducted a basic OAuth authentication but failed due to redirect URL.

The default redirect URL for the application is as shown below. The authentication process only works when l use the "https://openapi.ctrader.com/apps/4012/playground" redirect URL which fails to provide an Authcode. I have added the second redirect URL which unfortunately produces the error in the image above. Any other permutation of the redirect URL produces the errors that l previously mentioned in my previous posts. I am guessing that this is the case because l do not have a live account yet.

@Malformed client_id parameter:  17 Jan 2023, 12:49


PanagiotisChar said:

Hi there, 

I am not familiar with Python, sorry :(

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

Has anyone ever connected to the CTrader Open Api successfully using Python or the samples offered on the Applications website, l wonder? I am hopeful that those samples has been tested and are fit for purpose. My expectation is that they should be able to establish a connection to the OpenApi platform. 

@Malformed client_id parameter:  16 Jan 2023, 18:32


PanagiotisChar said:

Hi there, 

This is a different message than the one you posted above. At which point do you get this? Maybe you can record a video or share some screenshots.

You are definitely doing something wrong, if there was a problem on the servers, there would have been hundreds of complaints.

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

Hi there,

I am using the python example based on Klein and Twister to verify the connection. The information provided is from the initial stages of the code as shown below:-

I have adapted this code to test the authentication and the result is what l posted previously. My code is based on the same principle but using flask and connextion. The result is the same. It is probable that the server version has moved on and the sample code is no longer valid. If that is the case, please can you advice me on what has changed?

Regards

AO

@Malformed client_id parameter:  16 Jan 2023, 18:32


PanagiotisChar said:

Hi there, 

This is a different message than the one you posted above. At which point do you get this? Maybe you can record a video or share some screenshots.

You are definitely doing something wrong, if there was a problem on the servers, there would have been hundreds of complaints.

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

Hi there,

@Malformed client_id parameter:  16 Jan 2023, 18:32


PanagiotisChar said:

Hi there, 

This is a different message than the one you posted above. At which point do you get this? Maybe you can record a video or share some screenshots.

You are definitely doing something wrong, if there was a problem on the servers, there would have been hundreds of complaints.

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

Hi there,

@Malformed client_id parameter:  16 Jan 2023, 18:32


PanagiotisChar said:

Hi there, 

This is a different message than the one you posted above. At which point do you get this? Maybe you can record a video or share some screenshots.

You are definitely doing something wrong, if there was a problem on the servers, there would have been hundreds of complaints.

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

Hi there,

@Malformed client_id parameter:  14 Jan 2023, 23:02


PanagiotisChar said:

Hi there, 

The client ID you are using does not seem correct to me

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

This is the full URI:-

authUri: https://openapi.ctrader.com/apps/auth?client_id=4012_1kzEubcpMG4qFkGmyWjGxvL94iU5eJVSs9jz1xvGTlAbZuQxo3&redirect_uri=http://demo-eu.ctraderapi.com:5035/redirect&scope=trading

authcode: {'errorCode': 'ACCESS_DENIED', 'description': 'Access denied. Make sure the credentials are valid.'}

The account is active and the credentials is valid, l checked before putting up this post. There appears to be something wrong at the server end.

@Malformed client_id parameter:  09 Jan 2023, 15:58


ctid402288 said:

AuthURI is https://openapi.ctrader.com/apps/auth?client_id=4012_1kzE&redirect_uri=http://demo-eu.ctraderapi.com:5035/redirect&scope=trading

I already tried that and got the following Auth error:- {'errorCode': 'ACCESS_DENIED', 'description': 'Access denied. Make sure the credentials are valid.'} The AUTHURI is as follows https://openapi.ctrader.com/apps/auth?client_id=4012_1kzE&redirect_u

I have ran the code with a manually generated set of tokens from the Applications site but Twisted is unable to establish a connection due to the credential issue. l get the following error mesage:

twisted.internet.error.CannotListenError: Couldn't listen on demo-eu.ctraderapi.com:5035: [Errno 49] Can't assign requested address.

And it perpetually tries to reconnect

2023-01-09 14:05:31+0000 [-] Scheduling retry 2 to connect <twisted.internet.endpoints.SSL4ClientEndpoint object at 0x16f804070> in 2.7144583928643655 seconds.

The issue might be with the credential which incidentally has a status of ACTIVE.

PanagiotisChar said:

Hi there, 

The client ID is taken from your Open API application

Can you provide us with the exact uri you are using for your request?

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.

No uploaded.

Warning! Executing cBots downloaded from this section may result in loss of funds. Use them at your own risk.

No uploaded.