Stock   |   ETF   |   Index   |   Futures   |   Crypto   |   FX   |   Options

FirstRate Data FX API Documentation

The API provides customers with a lightweight method for accessing our datasets which can be integrated into custom workflows such as Python scripts.

Note - the API does not deliver raw data, only zip archives of csv files are served. You will need to uncompress the zip archive and iterate through the files in the archive.

Datasets are updated daily. The 'update' data (for past day, week or month) are available at 1am US Eastern Time for the prior day's trade data, whereas the full archives (containing the entire historical series) are available at 2am US Eastern Time.

All API functions are authenticated using your userid which is XXX.
Therefore all API requests need to be appended with the parameter userid=XXX as shown in the examples.


Details on the fx dataset (file format, timezone etc) are available on the readme file at https://firstratedata.com/_readme/fx.txt

API Functions

The API supports the below capabilities:

Historical Data Requests - (requesting the historical datafiles)

Last Update - (provides the last update date for the data. This is helpful for checking if there is fresh data available to request)

Ticker Listing - (provides the full listing of tickers as well as start and end dates)


Historical Data Requests

This function returns historical data archives (.txt files in csv format which are grouped into zip archives)

Url EndPoint : https://firstratedata.com/api/data_file

Requires Authentication : YES. All requests must include the parameter userid with your userid given to you in your signup email. Also available from your Customer Download Page.

Data Details : Full details on the data format, timezone, as well as available tickers and date ranges can be viewed on the bundle ReadMe Page

Parameters : The below parameters are used with the Url Endpoint to use the Historical Data Requests function:

Parameter : type

Accepted Values : stock , etf, futures , crypto , index , fx , options

Description : Specifies the type of instrument that is being requested.

Example :
https://firstratedata.com/api/data_file?type=fx&period=week&timeframe=1day&userid=XXX

Parameter : period

Accepted Values : full , month , week , day

Description : Specifies the period to request data for. 'full' requests the entire historical archive, 'month' requests the last 30 days, 'week' requests the current trading week (starting on Monday), 'day' requests the last trading day.

Example :
https://firstratedata.com/api/data_file?type=fx&period=full&timeframe=1hour&userid=XXX

Parameter : timeframe

Accepted Values : 1min , 5min , 30min , 1hour , 1day

Description : Specifies the period the timeframe of the data. '1min' will request 1-minute intraday bars, '5min' requests 5-minute bars etc.
Note : bars with zero volumes are not included

Example :
https://firstratedata.com/api/data_file?type=fx&period=week&timeframe=1min&userid=XXX


Last Update

This function returns the last update for an instrument type. This function can be used to check whether there has been an update prior to executing data requests. Unlike data requests, this function returns raw data in the form of a date and not zip files.

Url EndPoint : https://firstratedata.com/api/last_update

Requires Authentication : YES. All requests must include the parameter userid with your userid given to you in your signup email. Also available from your Customer Download Page.

Parameters : The below parameters are used with the Url Endpoint to use the Last Update function:

Parameter : type

Accepted Values : stock , etf, futures , crypto , index , fx

Description : Specifies the type of instrument that is being requested.

Example :
https://firstratedata.com/api/last_update?type=fx&userid=XXX

Parameter : is_full_update (optional)

Accepted Values : false , true (false is the default)

Description : This parameter is used when requesting the last update of the full historical dataset (otherwise the Last Update function will return the date for the update files for the past day, week or month).

Example :
https://firstratedata.com/api/last_update?type=fx&is_full_update=true&userid=XXX


Ticker Listing

This function returns the full listing of tickers as well as start and end dates for a specified instrument type. The data is returned in csv format so it can be copied into a text file and opened from a spreadsheet application if required.

Url EndPoint : https://firstratedata.com/api/ticker_listing

Data Format : {ticker},{name},{startDate},{endDate}

Parameters : The below parameters are used with the Url Endpoint to use the Last Update function:

Parameter : type

Accepted Values : stock , etf

Description : Specifies the type of instrument that is being requested.

Example :
https://firstratedata.com/api/ticker_listing?type=fx&userid=XXX

Parameter : html

Accepted Values : true, false (false is the default value)

Description : Specifies the is the returned data is in HTML format. Set this value to true to view the data in a web browser.

Example :
https://firstratedata.com/api/ticker_listing?type=fx&userid=XXX&html=true