API Details

Identifying Markets

We use a proprietary code to identify all markets and trading venues in our system. This code is called a Financial Identifier, or "FinID".

To obtain a list of all FinIDs, use the list markets endpoint to enumerate all markets you have access to as part of your subscription. You can then use the market details endpoint to see specifics about which securities are included in each FinID.

The FinID is more specific than the standard Market Identifier Code, or MIC. However, you can use the MIC in place of the FinID. If you use MIC, the API will return results for the best matching FinID. If you need help mapping specific securities or MICs to FinIDs, our team is available to help.

Use the query string parameter fin_id to specify a market or markets. Some endpoints support multiple FinIDs in a single request. To specify multiple FinIDs, separate them with commas. Whenever possible, we recommend making bulk requests with multiple FinIDs to avoid exceeding rate limit restrictions.

Examples

Remember to use your authentication token for all requests.

https://api.tradinghours.com/v3/markets/details?fin_id=us.nyse
https://api.tradinghours.com/v3/markets/status?fin_id=us.nyse,jp.jpx

Rate Limits

The API has rate limits to ensure system resources are available to all customers and to prevent excessive API usage. If you exceed the rate limit, you will receive an error message 419: Too many requests.

The rate limit is not intended to restrict access. Rate limits can be increased for Enterprise licensees. Contact supportopen in new window to increase your rate limit.

Tip

You can always check the X-RateLimit-Limit and X-RateLimit-Remaining response headers to see how many requests you have left.

There are several techniques to avoid exceeding the rate limit listed below:

  • Caching:

  • Delays Between Requests:

    • By adding a small 1 second delay between requests you can avoid exceeding the rate limit in most cases.
  • Data Download:

  • Bulk Requests:

    • Use bulk API requests whenever possible. To send bulk API requests, specify multiple FinIDs in a single request. See the example below:
https://api.tradinghours.com/v3/markets/status?fin_id=us.nyse,jp.jpx,gb.lse

CORS Policy

The TradingHours.com API does not support Cross Origin Request Sharing (CORS). This means you cannot send a request to our API from the front-end Javascript of a website. We do not allow this because it would expose your API key to everyone using your website.

If you see an error saying your request "has been blocked by CORS policy" or there is "no 'Access-Control-Allow-Origin' header is present" then this is the problem.

Instead of sending the request from your website's Javascript, you should send the API request from your back-end server.

Learn more about Cross Origin Request Sharing.

Last Updated: