Get Comparison Chart Data
Fetch trading data for comparing multiple securities
Last updated
Fetch trading data for comparing multiple securities
Last updated
This PUT endpoint enables you to retrieve and compare historical trading data for a set of securities. The data includes price ranges, candles, and various other non-market data. It can be used to draw comparative trading charts as demonstrated by the following screenshot:
There are four required parameters that must be provided in the request:
Authorization (header). This is the authorization token from the very first token request. The value of this header must have the following format: Bearer BQ898r9fefi
(Bearer
+ 1 space + the token).
API version (path). Unless necessary, leave it at "1.0".
model (body). This is a JSON dictionary that contains information about the enquired securities.
Here's an example of the request body with the information about the enquired securities.
Specific period:
The last n data points:
The last n data points within a specific time period:
where:
Parameter | Description |
---|---|
Securities | This is an array with the enquired securities. |
Symbol | This is the ticker symbol of the security under which it is listed on the exchange. |
Exchange (optional) | This is the exchange on which the enquired security is listed. |
Currency (optional) | This is the currency in which the enquired security is denominated. Possible values: "USD". |
Id | This is the internal ID of the security in AutoShares. You can retrieve this ID with this API endpoint. |
StartDate | This is the beginning of the period for which the data will be retrieved. The value must be provided in UNIX Time Stamps. |
EndDate | This is the end of the period for which the data will be retrieved. The value must be provided in UNIX Time Stamps. |
CandlesCount | This is the number of reference points for the chart. For example, if this parameter is set to 5, that chart will be drawn using five values. |
Period | This is the preferred time frame for the chart. Possible values:
|
Interval | This is the required time period for the specified time period. Possible values:
|
All parameters must be provided in the body JSON; otherwise the chart data will not be retrieved.
Here's the final template for this API request:
In response to this API request, you'll receive the chart data for the list of specified securities. Notice that trading data for the Microsoft stock comes first, and after it comes the second array with the trading data for the Apple stock.
where:
Parameter | Description |
---|---|
Volume | This is the trading volume at the time specified in |
Time | This is the date and time (in UNIX timestamps) at which this chart data point was registered. |
Difference | This is the difference between the price at the |
Price | The price registered at |
Here are some of the common mistakes that developers make when attempting to retrieve trading data for a set of securities.
Another common mistake when attempting to retrieve the chart data for a set of securities is incorrectly structuring the request body. It's critical that you follow the template provided above and specify all of the required parameters. Otherwise you'll receive the 500 status code and the following error message:
The following article covers the syntax for this API request in detail.