GET
/
marketdata
/
candles
Get candles
curl --request GET \
  --url https://openapi.ainvest.com/open/marketdata/candles \
  --header 'Authorization: Bearer <token>'
{
  "data": {
    "data": [
      {
        "t": 123,
        "o": 123,
        "h": 123,
        "l": 123,
        "c": 123,
        "v": 123,
        "a": 123
      }
    ]
  },
  "status_code": 123,
  "status_msg": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your key. Get the key here

Query Parameters

ticker
string
required

US stock market ticker symbol, e.g. AAPL, TSLA, etc.

interval
enum<string>
required

Aggregation interval for the requested data

Available options:
min,
day,
week,
month,
year
step
integer
required

Aggregation step for each candle. For example, interval=day&step=1 for daily candles, interval=min&step=15 for 15-minute candles.

from
integer
required

Start of the requested period, unix timestamp with milliseconds

to
integer
default:0

End of the requested period, unix timestamp with milliseconds. Default value of 0 represents the latest available data.

session
enum<string>
default:intraday

Trading session, where pre_market is pre-market session, intraday is for regular trading session, and post_market is post-market session. Default value is intraday.

Available options:
pre_market,
intraday,
post_market
adjustment
enum<string>
default:actual

Adjust the historical prices for corporate actions, can be one of the following values:

valuedescription
actualReturn prices as is, no adjustment (default value)
backward_3adjust backward for splits, bonus shares, spin offs, dividends
backward_2adjust backward for splits, bonus shares, spin offs
backward_1adjust backward for splits, bonus shares
backwardadjust backward for splits only
forward_3adjust forward for splits, bonus shares, spin offs, dividends
forward_2adjust forward for splits, bonus shares, spin offs
forward_1adjust forward for splits, bonus shares
forwardadjust forward for splits only
Available options:
actual,
backward_3,
backward_2,
backward_1,
backward,
forward_3,
forward_2,
forward_1,
forward

Response

Successful response in standard envelope.

data
object
status_code
number

Status code, 0 for success

status_msg
string

Status message, success for success