How To Use Our Query Generator for Forex API?
06 July 2023
Obtaining reliable and accurate Forex data is paramount for analysis and making correct trading decisions. We provide unbiased and aggregated Forex data via our Forex API.
This tutorial aims to help our users understand our API, the API Query URL structure, and what is permitted while obtaining Forex Data via our Forex API.
We have designed an easy Query Generator to help you obtain Forex data for your desired currency pairs and timeframe quickly and efficiently.
Initially, please sign up to get your free API Key. As you log in and go to your Dashboard, you can see the account information on the Documentation page prepopulated with your API Key. This is uniquely engineered for you, so you can only see your API Key.
Let us dive into the steps to use our Query Generator to get Forex data via our Forex API:
Step 1: Go To Our Query Generator
Let us move to the Query Builder now, ensure you are logged in then navigate to our Data Documentation page. Select the Query Generator option in the left-side menu. The page appears similar to this. The Request URL is prepopulated with your unique API Key:
Step 2: Get Forex Data
Example 1: Live Forex Data
Let us discuss how to get live Forex rates using our query generator. You can obtain real-time bid, ask, and mid prices for multiple currency pairs. Select the Live API Endpoint from the dropdown menu, and enter the desired currency pairs in the first parameter for CURRENCIES. You can add multiple currencies to get live prices.
On clicking the RUN QUERY button, you can see the real-time bid, ask, and mid rates for the selected currency pairs.
If you are happy with the data, please copy the Request URL using the COPY button, and use it as you need to run your applications and programs.
Example 2: Tick Historical Sample
Let us understand how to get a tick-historical sample using our query generator.
You can see the Request URL and the box for API Key prepopulated with your unique API Key. Fill in the other fields considering your data requirements.
In the image below, you can see the following parameters selected:
Choose API Endpoint: Tick Historical Sample
Parameter 1 (SYMBOL): EURUSD
Parameter 2 (START DATE): 30-06-2023 14:00
Parameter 3 (END DATE): 30-06-2023 14:30
Parameter 4 (FORMAT): json
After entering these parameters, click on the RUN QUERY button. You can see the desired tick historical data (bid, ask, timestamp).
Before we move forward, let us understand some crucial aspects of the Tick Historical Trial:
Historical Tick provides one month of data for each chunk not exceeding 60 minutes. This feature is only available on the Advanced plan and uses 5 API requests each time. You can request only one currency pair at a time.
You cannot access tick historical data without an advanced plan. But you can request a sample tick, which will get you to tick data going back four working days, not including today. A maximum chunk of tick data in one request is 30 minutes and will take 5 API requests away. You can only request one currency pair per request.
Notably, Tick Historical Rates are updated on every quote. There may be thousands of rates within 30 minutes. Therefore, you can only get tick data for 30 minutes in one request on the free sample endpoint.
Please consider these limitations while obtaining Tick Historical Data through the query generator.
Example 3: Historical Forex Data
Our query generator helps you obtain End-of-Day Open-Low-High-Close (OHLC) prices for multiple currency pairs. Let’s reveal the parameters you should choose for this purpose:
Choose API Endpoint: Historical
Parameter 1 (CURRENCIES): I have selected AUDUSD, EURJPY, and GBPTRY.
Parameter 2 (DATE): 05-07-2023
Please note that the date should not be a future date. Check documentation for the ‘Historical’ API Endpoint to find the available data history.
As you fill in these parameters and click the ‘RUN QUERY’ button, the End-of-Day OHLC prices for the selected currency pairs are displayed in the box below.
Similarly, you can obtain Minute Historical and Hour Historical Rates using our query generator. You will get OHLC prices for the exact date and time you set as your parameters.
Please note that the time should be in GMT. The date format is as YYYY-MM-DD in the Request URL.
Example 4: Historical CFD and Crypto Data
You can get historical rates for CFD and Crypto instruments. Choose the parameters corresponding to your data needs. For this example, you can learn to get historical data for a CFD instrument UKOIL (Brent Crude).
Select the parameters as follows:
Choose API Endpoint: Historical
Parameter 1 (CURRENCIES): UKOIL
Parameter 2 (DATE): 05-07-2023
As you click the RUN QUERY button, you get End-of-Day OHLC prices for UKOIL in the box below, as shown in the above image.
Similarly, get historical cryptocurrency prices against a fiat currency. Choose the desired currency pair correctly. I have chosen US Dollar/ Bitcoin (USDBTC) for this example.
As you enter parameters and click the RUN QUERY button, you can see End-of-Day OHLC prices for USDBTC for the selected date (30-06-2023 for this example).
Please refer to the documentation of corresponding API Endpoints to find the history available.
Example 5: Time-series Data
Our query generator also helps you get time-series data in various timeframes.
You can obtain:
1) Daily history for the past 15 years - You get data for 1 year per call.
2) Hourly history for the last 12 months - You get 1 month data per call.
3) Minute history for the previous 1 month - You get 2-days data per call.
Please refer to the documentation for Timeseries Endpoint for more details.
Let us go through the parameters to choose:
Choose API Endpoint: Timeseries
Parameter 1 (CURRENCY): EURGBP - You can choose the desired currency pair.
Parameter 2 (START DATE): 30-06-2023
Parameter 3 (END DATE): 05-07-2023
Parameter 4 (FORMAT): records
Parameter 5 (INTERVAL): hourly
Parameter 6 (PERIOD): 2
Fill in the parameters per your requirement and click the RUN QUERY button. You will get the hourly rates with the desired interval (2-hour per bar for this example) for the currency pair you choose during the required dates.
In this way, you can get historical and real-time Forex, CFD, and Crypto prices using our query generator. The user-friendly query generator simplifies the process of building an API query as per your data requirements.
If you need further information, contact us via email at email@example.com. You can also reach one of our market data experts via live chat to get your technical queries resolved.