---
title: Candles tg n
sidebar_position: 1
---

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";

Get historical price candles for a mutual fund.

:::warning
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

<Tabs>
<TabItem value="HTTP" label="HTTP" default>

**GET** [https://api.marketdata.app/v1/funds/candles/D/VFINX?from=2020-01-01&to=2020-01-10](https://api.marketdata.app/v1/funds/candles/D/VFINX?from=2020-01-01&to=2020-01-10)

</TabItem>
<TabItem value="NodeJS" label="NodeJS">

```js title="fundCandles.js"
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);
  });

```

</TabItem>
<TabItem value="Python" label="Python">

```python title="fundCandles.py"
from marketdata import MarketDataClient

client = MarketDataClient()
candles = client.funds.candles("VFINX", resolution="D", from_date="2020-01-01", to_date="2020-01-10")
print(candles)
```
</TabItem>
<TabItem value="Go" label="Go">

```go title="fundCandles.go"

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)
  }
}

```
</TabItem>
<TabItem value="PHP" label="PHP">

```php title="fundCandles.php"
use MarketDataApp\Client;

$client = new Client();
$candles = $client->mutual_funds->candles(
    symbol: "VFINX",
    from: "2020-01-01",
    to: "2020-01-10",
    resolution: "D"
);

// Display formatted candles summary
echo $candles;
```
</TabItem>
</Tabs>

## Response Example

```json
{
  "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

<Tabs>
<TabItem value="required" label="Required" default>

- **resolution** `string`

  The duration of each candle. Intraday resolutions are not supported for funds. *Case-insensitive*.

  - Daily Resolutions: (`daily`, `D`, `1D`, `2D`, ...)
  - Weekly Resolutions: (`weekly`, `W`, `1W`, `2W`, ...)
  - Monthly Resolutions: (`monthly`, `M`, `1M`, `2M`, ...)
  - Yearly Resolutions: (`yearly`, `Y`, `1Y`, `2Y`, ...)

- **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 use `from`, `countback` is not required.

</TabItem>
</Tabs>

## Response Attributes

<Tabs>
<TabItem value="Success" label="Success" default>

- **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.

</TabItem>
<TabItem value="NoData" label="No Data">

- **s** `string`

  Status will be `no_data` if no candles are found for the request.

- **nextTime** `number` optional

  Unix time of the next quote if there is no data in the requested period, but there is data in a subsequent period.

</TabItem>
<TabItem value="Error" label="Error">

- **s** `string`

  Status will be `error` if the request produces an error response.

- **errmsg** `string`
  An error message.

</TabItem>
</Tabs>

