# Spot - Market - Get Candle Data — Bitget

> Retrieve candlestick data for a specified symbol and time period. See the documentation

- Key: `bitget-spot-market-get-candle-data`
- Type: Action (Read-only)
- Version: 0.0.3
- App: Bitget (`bitget`) — https://pipedream.com/apps/bitget.md
- This page (HTML): https://pipedream.com/apps/bitget/actions/spot-market-get-candle-data
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/bitget/actions/spot-market-get-candle-data/spot-market-get-candle-data.mjs

## Description

Retrieve candlestick data for a specified symbol and time period. [See the documentation](https://www.bitget.com/api-doc/spot/market/Get-Candle-Data)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `symbol` | `string` | Yes | Trading pair symbol Options are loaded from the connected account. |
| `granularity` | `string` | Yes | Time interval of charts. For the corresponding relationship between granularity and value, refer to the list below. minute: 1min, 3min, 5min, 15min, 30min hour: 1h, 4h, 6h, 12h day: 1day, 3day week: 1week month: 1M hour in UTC: 6Hutc, 12Hutc day in UTC: 1Dutc, 3Dutc week in UTC: 1Wutc month in UTC: 1Mutc 1m, 3m, 5m can query for one month, 15m can query for 52 days, 30m can query for 62 days, 1H can query for 83 days, 2H can query for 120 days, 4H can query for 240 days, 6H can query for 360 days. |
| `startTime` | `string` | No | The time start point of the chart data, i.e., to get the chart data after this timestamp Unix millisecond timestamp, e.g. 1690196141868 |
| `endTime` | `string` | No | The time end point of the chart data, i.e., get the chart data before this timestamp Unix millisecond timestamp, e.g. 1690196141868 |
| `limit` | `integer` | No | Default: 100, maximum: 1000. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "bitget",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "bitget-spot-market-get-candle-data",
  arguments: {
    symbol: "Symbol",
    granularity: "Granularity",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "bitget-spot-market-get-candle-data",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    bitget: { authProvisionId: "apn_xxxxxxx" },
    symbol: "Symbol",
    granularity: "Granularity",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "bitget-spot-market-get-candle-data",
    "configured_props": {
      "bitget": { "authProvisionId": "apn_xxxxxxx" },
      "symbol": "Symbol",
      "granularity": "Granularity"
    }
  }'
```

---

- App: https://pipedream.com/apps/bitget.md · All apps: https://pipedream.com/apps
