Open/High/Low/Close (OHLC) Price Endpoint
Metals-API open-high-low-close/YYYY-MM-DD
endpoint allows you to query the API to get the open, high, low, and close price.
This endpoint has a limitation of one symbol per request.
API Request:
https://metals-api.com/api/open-high-low-close/YYYY-MM-DD ? access_key = API_KEY & base = XAU & symbols = USD
Request Parameters:
Parameter | Description |
---|---|
YYYY-MM-DD |
[required] A date in the past or the current date. |
access_key |
[required] Your API Key. |
base |
[required] Enter a metal symbol or currency. |
symbols |
[required] Enter one symbol metal or currency to limit the output. |
API Response:
{ "success": true, "timestamp": 1653931700, "date": "2022-05-20", "base": "XAU", "symbol": "USD", "rates": { "open": 1841.1889341969709, "high": 1851.6666851833336, "low": 1816.419890887657, "close": 1844.828964194302, }, "unit": "per ounce" }
Response Objects:
Response Object | Description |
---|---|
success |
Returns true or false depending on whether or not your API request has succeeded. |
date |
Returns the date for the open, high, low, and close price. |
base |
Returns the symbol as base used for this request. |
symbol |
Returns the symbol used for this request. |
rates |
Returns the open, high, low, and close price for the requested symbol. |
Example request in Postman:
In the case of using USD as the base, you will need to perform 1/value. For example:
1/0.00050428199599603 = 1983.0174544