Get Account Balance - Azure Function

Created at 19 Jul 2021, 15:00
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
PE

perjohan.alzen

Joined 08.07.2021

Get Account Balance - Azure Function
19 Jul 2021, 15:00


Hi,

Have anyone tried to use Open API in an Azure Function to get Balance information from your account?

Is it possible?

BR

Per-Johan


@perjohan.alzen
Replies

amusleh
20 Jul 2021, 08:56

Hi,

Its possible but Open API is not the rioght solution for what you are after, Open API is for building trading apps and it uses OAuth authentication.

You have to first get an access token and then you will be able to use the API, and the access token has an expiry which you have to monitor and refresh it by using the refresh token.

What you can do is to get an acess token for your API application, then use that access token on your Azure Functions to access API, you also have to refresh the token once is expired or before its expiry.

I recommend you to read the Open API documentation and check our samples for Open API.NET.


@amusleh

perjohan.alzen
20 Jul 2021, 09:58

RE:

amusleh said:

Hi,

Its possible but Open API is not the rioght solution for what you are after, Open API is for building trading apps and it uses OAuth authentication.

You have to first get an access token and then you will be able to use the API, and the access token has an expiry which you have to monitor and refresh it by using the refresh token.

What you can do is to get an acess token for your API application, then use that access token on your Azure Functions to access API, you also have to refresh the token once is expired or before its expiry.

I recommend you to read the Open API documentation and check our samples for Open API.NET.

 

I think I see what you mean. I still need a local API application? And access that app from my Azure Function?

Is there a way to read the account balance, not using Open API (or FIX)?


@perjohan.alzen

amusleh
20 Jul 2021, 10:08

Hi,

You can directly access Open API from Azure functions by writing code to interact with API.

You can get an account balance from Open API and cTrader Automate API, not sure about FIX I have to check.

If you don't want to use Open API, you can send your account balance to Azure via a cBot and then use it on your functions.


@amusleh