Candles New
Get historical price candles for a mutual fund.
This endpoint will be live on May 1, 2024. Before May 1, use the stocks/candles endpoint to query mutual fund candles.
Endpoint
https://api.marketdata.app/v1/funds/candles/{resolution}/{symbol}/
Method
GET
Request Example
- HTTP
- NodeJS
- Python
- Go
fetch(
"https://api.marketdata.app/v1/funds/candles/D/VFINX?from=2020-01-01&to=2020-01-10"
)
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
});
import requests
url = "https://api.marketdata.app/v1/funds/candles/D/VFINX?from=2020-01-01&to=2020-01-10"
response = requests.request("GET", url)
print(response.text)
import (
"fmt"
api "github.com/MarketDataApp/sdk-go"
)
func ExampleFundCandlesRequest() {
fcr, err := FundCandles().Resolution("D").Symbol("VFINX").From("2023-01-01").To("2023-01-06").Get()
if err != nil {
fmt.Print(err)
return
}
for _, candle := range fcr {
fmt.Println(candle)
}
}
Response Example
{
"s":"ok",
"t":[1577941200,1578027600,1578286800,1578373200,1578459600,1578546000,1578632400],
"o":[300.69,298.6,299.65,298.84,300.32,302.39,301.53],
"h":[300.69,298.6,299.65,298.84,300.32,302.39,301.53],
"l":[300.69,298.6,299.65,298.84,300.32,302.39,301.53],
"c":[300.69,298.6,299.65,298.84,300.32,302.39,301.53]
}
Request Parameters
- Required
-
resolution
string
The duration of each candle.
- Daily Resolutions: (
daily
,D
,1D
,2D
, ...) - Weekly Resolutions: (
weekly
,W
,1W
,2W
, ...) - Monthly Resolutions: (
monthly
,M
,1M
,2M
, ...) - Yearly Resolutions:(
yearly
,Y
,1Y
,2Y
, ...)
- Daily Resolutions: (
-
symbol
string
The mutual fund's ticker symbol.
-
from
date
The leftmost candle on a chart (inclusive). If you use
countback
,to
is not required. Accepted timestamp inputs: ISO 8601, unix, spreadsheet. -
to
date
The rightmost candle on a chart (inclusive). Accepted timestamp inputs: ISO 8601, unix, spreadsheet.
-
countback
number
Will fetch a number of candles before (to the left of)
to
. If you usefrom
,countback
is not required.
Response Attributes
- Success
- No Data
- Error
-
s
string
ll always be
ok
when there is data for the candles requested. -
o
array[number]
Open price.
-
h
array[number]
High price.
-
l
array[number]
Low price.
-
c
array[number]
Close price.
-
t
array[number]
Candle time (Unix timestamp, Eastern Time Zone). Daily, weekly, monthly, yearly candles are returned without times.
-
s
string
Status will be
no_data
if no candles are found for the request. -
nextTime
number
optionalUnix time of the next quote if there is no data in the requested period, but there is data in a subsequent period.
-
s
string
Status will be
error
if the request produces an error response. -
errmsg
string
An error message.