CandleSticks

Get List of CandleSticks

  • Method: GET

  • Endpoint: /api/v1/crypto/candle-sticks

  • Headers:

    • Cookie: The session cookie value.

    • csrf_token: The CSRF token obtained after login.

  • Query:

    • offset: (integer) Pagination offset.

    • limit: (integer) Number of records to return.

    • rangeDateStart: (string) Start date of the range.

    • rangeDateEnd: (string) End date of the range.

    • exchangeNames[]: (array) List of exchange names (e.g. Binance).

    • symbol: (string) Trading pair symbol (e.g. BTC/USDT).

Description:

The /api/v1/crypto/candle-sticks endpoint is designed to fetch historical candlestick data for a given cryptocurrency trading pair across specified exchanges. This data is crucial for technical analysis, allowing users to view price movements within a defined date range. The endpoint accommodates various query parameters to tailor the data request, including pagination controls (offset, limit), a date range for the data (rangeDateStart, rangeDateEnd), exchange names (exchangeNames[]), and the specific trading pair symbol (symbol).

Example with curl:

curl -X GET "http://example.com/api/v1/crypto/candle-sticks?offset=0&limit=4&rangeDateStart=2023-12-07T23:58:00.000Z&rangeDateEnd=2023-12-07T23:59:00.000Z&exchangeNames[]=Binance&symbol=BTC/USDT" \
     -H "Cookie: session_cookie_value"  \
     -H "csrf_token: your_csrf_token_here"

Example Response Payload:

{
    "data": [
        {
            "id": 138448,
            "marketId": 69,
            "charts": [
                [
                    1701993480000, 43273.99, 43281.02, 43260.68, 43281.01,
                    27.53241
                ]
            ],
            "createdAt": "2023-12-08T00:53:06.399Z",
            "exchangeName": "Binance",
            "symbol": "BTC/USDT",
            "intervalStart": "2023-12-07T23:58:00.000Z",
            "intervalEnd": "2023-12-07T23:59:00.000Z"
        },
        {
            "id": 138410,
            "marketId": 69,
            "charts": [
                [1701993420000, 43266.3, 43274, 43252.42, 43274, 24.13456]
            ],
            "createdAt": "2023-12-08T00:52:06.760Z",
            "exchangeName": "Binance",
            "symbol": "BTC/USDT",
            "intervalStart": "2023-12-07T23:57:00.000Z",
            "intervalEnd": "2023-12-07T23:58:00.000Z"
        },
        {
            "id": 138371,
            "marketId": 69,
            "charts": [
                [1701993360000, 43279.99, 43280, 43266.3, 43266.3, 17.43755]
            ],
            "createdAt": "2023-12-08T00:51:06.730Z",
            "exchangeName": "Binance",
            "symbol": "BTC/USDT",
            "intervalStart": "2023-12-07T23:56:00.000Z",
            "intervalEnd": "2023-12-07T23:57:00.000Z"
        },
        {
            "id": 138333,
            "marketId": 69,
            "charts": [
                [1701993300000, 43254.79, 43280, 43253.65, 43279.99, 13.02447]
            ],
            "createdAt": "2023-12-08T00:50:06.688Z",
            "exchangeName": "Binance",
            "symbol": "BTC/USDT",
            "intervalStart": "2023-12-07T23:55:00.000Z",
            "intervalEnd": "2023-12-07T23:56:00.000Z"
        },
        {
            "id": 138294,
            "marketId": 69,
            "charts": [
                [1701993240000, 43266.3, 43266.31, 43240.83, 43254.79, 15.64374]
            ],
            "createdAt": "2023-12-08T00:49:06.271Z",
            "exchangeName": "Binance",
            "symbol": "BTC/USDT",
            "intervalStart": "2023-12-07T23:54:00.000Z",
            "intervalEnd": "2023-12-07T23:55:00.000Z"
        }
    ],
    "meta": {
        "fetchCount": 5
    },
    "status": 1
}

Request Complete Candle Sticks Aggregation

  • Method: POST

  • Endpoint: /api/v1/crypto/candle-sticks/aggregate-complete

  • Headers:

    • Cookie: The session cookie value.

    • csrf_token: The CSRF token obtained after login.

  • Body:

    • rangeDateStart: (string) The start date and time of the requested data range.

    • rangeDateEnd: (string) The end date and time of the requested data range.

    • symbols: (array of strings) The list of cryptocurrency pair symbols (e.g. "BTC/USDT").

    • exchangeNames: (array of strings) The list of exchange names from which the data is to be aggregated (e.g. "Binance", "Bybit", "OKX").

Description:

This endpoint queues an asynchronous job to aggregate complete candlestick data for specified cryptocurrency pairs from multiple exchanges within a given date and time range. The task is offloaded to a worker for processing. Clients can poll the task status using the /api/v1/crypto/aggregation-tasks/:id endpoint and retrieve the results upon completion with the /api/v1/crypto/candle-sticks/aggregate-complete/results/:id endpoint.

Example with curl:

curl -X POST "http://example.com/api/v1/crypto/candle-sticks/aggregate-complete" \
     -H "Cookie: session_cookie_value"  \
     -H "Content-Type: application/json" \
     -H "csrf_token: your_csrf_token_here" \
     -d '{
        "rangeDateStart": "2024-04-01 08:38:37",
        "rangeDateEnd": "2024-04-01 23:38:34",
        "symbol": "BTC/USDT",
        "exchangeNames": ["Binance", "Bybit", "OKX"],
    }'

Example Response Payload:

{
    "data": {
        "id": "135",
        "type": "CANDLES_COMPLETE_AGGREGATION",
        "status": "PENDING",
        "progress": null,
        "context": {
            "limit": 1000,
            "offset": 0,
            "symbol": "ETH/USDT",
            "rangeDateEnd": "2024-11-30 23:59:59.000Z",
            "exchangeNames": [
                "Bitfinex",
                "Binance"
            ],
            "rangeDateStart": "2023-11-03 00:00:00.000Z"
        },
        "error": null,
        "createdAt": "2024-08-21T04:04:37.405Z",
        "updatedAt": "2024-08-21T04:04:37.405Z"
    },
    "status": 1
}

Note: To check the status of the aggregation task, replace :id with the actual task ID in the /api/v1/crypto/aggregation-tasks/:id endpoint. Once the task is complete, the results can be retrieved in a similar manner using the /api/v1/crypto/candle-sticks/aggregate-discrete/results/:id endpoint, again replacing :id with the task ID.

Get Complete Aggregation Task Results

  • Method: GET

  • Endpoint: /api/v1/crypto/candle-sticks/aggregate-complete/results/:id

  • Headers:

    • Cookie: The session cookie value.

    • csrf_token: The CSRF token obtained after login.

  • Parameters:

    • id: (string) The identifier of the discrete aggregation task.

Description:

The /api/v1/crypto/candle-sticks/aggregate-complete/results/:id endpoint is used to retrieve the results of a discrete candle sticks aggregation task. The task is identified using the id path variable, which corresponds to the unique ID returned when the aggregation task was initially requested and processed.

Example with curl:

curl -X GET "http://example.com/api/v1/crypto/candle-sticks/aggregate-complete/results/2" \
     -H "Cookie: session_cookie_value"  \
     -H "csrf_token: your_csrf_token_here"

Example Response Payload:

{
    "data": {
        "task": {
            "id": "112",
            "type": "CANDLES_COMPLETE_AGGREGATION",
            "status": "COMPLETED",
            "progress": "100.00",
            "context": {
                "limit": 1000,
                "offset": 0,
                "symbol": "ETH/USDT",
                "rangeDateEnd": "2024-11-30 23:59:59.000Z",
                "exchangeNames": [
                    "Bitfinex",
                    "Binance"
                ],
                "rangeDateStart": "2023-11-03 00:00:00.000Z"
            },
            "error": null,
            "createdAt": "2024-08-16T10:21:57.776Z",
            "updatedAt": "2024-08-16T10:21:58.096Z"
        },
        "results": [
            {
                "id": "15",
                "symbol": "ETH/USDT",
                "rangeDateStart": "2023-11-03T00:00:00.000Z",
                "rangeDateEnd": "2024-11-30T23:59:59.000Z",
                "processedCount": 46,
                "taskId": "112",
                "open": "2624.50500000000000000000000000000000",
                "high": "2667.95000000000000000000000000000000",
                "low": "2623.85000000000040000000000000000000",
                "close": "2659.74500000000000000000000000000000",
                "volume": "40239.64114340002000000000000000000000",
                "aggregatedAveragePrice": "2645.90000000000000000000000000000000",
                "createdAt": "2024-08-16T10:21:58.071Z"
            }
        ]
    },
    "status": 1
}

List Complete Aggregation Task Results

  • Method: GET

  • Endpoint: /api/v1/crypto/candle-sticks/aggregate-complete/results

  • Headers:

    • Cookie: The session cookie value.

    • csrf_token: The CSRF token obtained after login.

  • Query:

    • limit: (integer) The maximum number of results to retrieve.

    • offset: (integer) The number of results to skip (typically for pagination).

    • rangeDateStart: (string) The start date and time for filtering the results.

    • rangeDateEnd: (string) The end date and time for filtering the results.

    • symbols[]: (array) Filter for the list of cryptocurrency pair symbols (e.g., BTC/USDT).

    • exchangeNames[]: (array) Filter for the list of exchange names from which the data is to be retrieved.

Description:

The /api/v1/crypto/candle-sticks/aggregate-complete/results endpoint is designed to list aggregated candlestick data results based on specified query parameters. Clients can filter results by date range, symbols, exchange names, and candlestick time frames.

Example with curl:

curl -X GET "http://example.com/api/v1/crypto/candle-sticks/aggregate-discrete/results?limit=1&offset=0&rangeDateStart=2024-04-01T08:38:37&rangeDateEnd=2024-04-01T23:38:34&symbols[]=BTC/USDT&exchangeNames[]=Binance&exchangeNames[]=Bybit&exchangeNames[]=OKX" \
     -H "Cookie: session_cookie_value"  \
     -H "csrf_token: your_csrf_token_here"

Example Response Payload:

{
    "data": [
        {
            "id": "15",
            "symbol": "ETH/USDT",
            "rangeDateStart": "2023-11-03T00:00:00.000Z",
            "rangeDateEnd": "2024-11-30T23:59:59.000Z",
            "processedCount": 46,
            "taskId": "112",
            "open": "2624.50500000000000000000000000000000",
            "high": "2667.95000000000000000000000000000000",
            "low": "2623.85000000000040000000000000000000",
            "close": "2659.74500000000000000000000000000000",
            "volume": "40239.64114340002000000000000000000000",
            "aggregatedAveragePrice": "2645.90000000000000000000000000000000",
            "exchanges": [
                {
                    "id": 1,
                    "externalExchangeId": "binance",
                    "dataSource": "binance",
                    "type": "CEX",
                    "name": "Binance",
                    "description": null,
                    "imageUrl": null,
                    "createdAt": "2024-08-15T08:10:01.290Z",
                    "updatedAt": "2024-08-15T08:10:01.290Z"
                },
                {
                    "id": 2,
                    "externalExchangeId": "bitfinex",
                    "dataSource": "bitfinex",
                    "type": "CEX",
                    "name": "Bitfinex",
                    "description": null,
                    "imageUrl": null,
                    "createdAt": "2024-08-15T08:10:06.691Z",
                    "updatedAt": "2024-08-15T08:10:06.691Z"
                }
            ],
            "createdAt": "2024-08-16T10:21:58.071Z"
        },
         // Additional results here...
    ],
    "status": 1
}

Request Discrete Candle Sticks Aggregation

  • Method: POST

  • Endpoint: /api/v1/crypto/candle-sticks/aggregate-discrete

  • Headers:

    • Cookie: The session cookie value.

    • csrf_token: The CSRF token obtained after login.

  • Body:

    • rangeDateStart: (string) The start date and time of the requested data range.

    • rangeDateEnd: (string) The end date and time of the requested data range.

    • symbols: (array of strings) The list of cryptocurrency pair symbols (e.g. "BTC/USDT").

    • exchangeNames: (array of strings) The list of exchange names from which the data is to be aggregated (e.g. "Binance", "Bybit", "OKX").

    • timeframeMinutes: (integer) The time frame in minutes for each candlestick data point.

Description:

This endpoint queues an asynchronous job to aggregate discrete candlestick data for specified cryptocurrency pairs from multiple exchanges within a given date and time range. The task is offloaded to a worker for processing. Clients can poll the task status using the /api/v1/crypto/aggregation-tasks/:id endpoint and retrieve the results upon completion with the /api/v1/crypto/candle-sticks/aggregate-discrete/results/:id endpoint.

Example with curl:

curl -X POST "http://example.com/api/v1/crypto/candle-sticks/aggregate-discrete" \
     -H "Cookie: session_cookie_value"  \
     -H "Content-Type: application/json" \
     -H "csrf_token: your_csrf_token_here" \
     -d '{
        "rangeDateStart": "2024-04-01 08:38:37",
        "rangeDateEnd": "2024-04-01 23:38:34",
        "symbol": "BTC/USDT",
        "exchangeNames": ["Binance", "Bybit", "OKX"],
        "timeframeMinutes": 60
    }'

Example Response Payload:

{
    "data": {
        "id": "2",
        "type": "CANDLES_DISCRETE_AGGREGATION",
        "status": "PENDING",
        "context": {
            "symbol": "BTC/USDT",
            "exchangeNames": ["Binance", "Bybit", "OKX"],
            "rangeDateStart": "2024-04-01 08:38:37",
            "rangeDateEnd": "2024-04-01 23:38:34",
            "timeframeMinutes": 60
        },
        "error": null,
        "createdAt": "2024-04-05T08:44:45.804Z",
        "updatedAt": "2024-04-05T08:44:45.804Z"
    },
    "status": 1
}

Note: To check the status of the aggregation task, replace :id with the actual task ID in the /api/v1/crypto/aggregation-tasks/:id endpoint. Once the task is complete, the results can be retrieved in a similar manner using the /api/v1/crypto/candle-sticks/aggregate-discrete/results/:id endpoint, again replacing :id with the task ID.

Get Discrete Aggregation Task Results

  • Method: GET

  • Endpoint: /api/v1/crypto/candle-sticks/aggregate-discrete/results/:id

  • Headers:

    • Cookie: The session cookie value.

    • csrf_token: The CSRF token obtained after login.

  • Parameters:

    • id: (string) The identifier of the discrete aggregation task.

Description:

The /api/v1/crypto/candle-sticks/aggregate-discrete/results/:id endpoint is used to retrieve the results of a discrete candle sticks aggregation task. The task is identified using the id path variable, which corresponds to the unique ID returned when the aggregation task was initially requested and processed.

Example with curl:

curl -X GET "http://example.com/api/v1/crypto/candle-sticks/aggregate-discrete/results/2" \
     -H "Cookie: session_cookie_value"  \
     -H "csrf_token: your_csrf_token_here"

Example Response Payload:

{
    "data": {
        "task": {
            "id": "15",
            "type": "CANDLES_DISCRETE_AGGREGATION",
            "status": "COMPLETED",
            "progress": "100.00",
            "context": {
                "symbol": "BTC/USDT",
                "rangeDateEnd": "2024-08-15 23:59:59.000Z",
                "exchangeNames": [
                    "Bitfinex"
                ],
                "rangeDateStart": "2024-08-15 00:00:00.000Z",
                "timeframeMinutes": 60
            },
            "error": null,
            "createdAt": "2024-08-15T12:15:06.102Z",
            "updatedAt": "2024-08-15T12:15:06.500Z"
        },
        "results": [
            {
                "id": "4",
                "symbol": "BTC/USDT",
                "rangeDateStart": "2024-08-15T00:00:00.000Z",
                "rangeDateEnd": "2024-08-15T23:59:59.000Z",
                "timeframeMinutes": 60,
                "processedCount": 6,
                "resultCount": 1,
                "taskId": "15",
                "createdAt": "2024-08-15T12:15:06.317Z"
            }
        ]
    },
    "status": 1
}

List Discrete Aggregation Task Results

  • Method: GET

  • Endpoint: /api/v1/crypto/candle-sticks/aggregate-discrete/results

  • Headers:

    • Cookie: The session cookie value.

    • csrf_token: The CSRF token obtained after login.

  • Query:

    • limit: (integer) The maximum number of results to retrieve.

    • offset: (integer) The number of results to skip (typically for pagination).

    • rangeDateStart: (string) The start date and time for filtering the results.

    • rangeDateEnd: (string) The end date and time for filtering the results.

    • symbols[]: (array) Filter for the list of cryptocurrency pair symbols (e.g., BTC/USDT).

    • exchangeNames[]: (array) Filter for the list of exchange names from which the data is to be retrieved.

    • timeframeMinutes[]: (array) The time frames in minutes to filter the candlestick data.

Description:

The /api/v1/crypto/candle-sticks/aggregate-discrete/results endpoint is designed to list aggregated candlestick data results based on specified query parameters. Clients can filter results by date range, symbols, exchange names, and candlestick time frames.

Example with curl:

curl -X GET "http://example.com/api/v1/crypto/candle-sticks/aggregate-discrete/results?limit=1&offset=0&rangeDateStart=2024-04-01T08:38:37&rangeDateEnd=2024-04-01T23:38:34&symbols[]=BTC/USDT&exchangeNames[]=Binance&exchangeNames[]=Bybit&exchangeNames[]=OKX&timeframeMinutes[]=60" \
     -H "Cookie: session_cookie_value"  \
     -H "csrf_token: your_csrf_token_here"

Example Response Payload:

{
    "data": [
        {
            "id": "1",
            "symbol": "BTC/USDT",
            "rangeDateStart": "2024-08-01T09:00:00.000Z",
            "rangeDateEnd": "2024-08-01T10:59:59.000Z",
            "timeframeMinutes": 60,
            "processedCount": null,
            "resultCount": null,
            "taskId": "12",
            "exchanges": [
                {
                    "id": 1,
                    "externalExchangeId": "binance",
                    "dataSource": "binance",
                    "type": "CEX",
                    "name": "Binance",
                    "description": null,
                    "imageUrl": null,
                    "createdAt": "2024-08-15T08:10:01.290Z",
                    "updatedAt": "2024-08-15T08:10:01.290Z"
                },
                {
                    "id": 5,
                    "externalExchangeId": "bybit",
                    "dataSource": "bybit",
                    "type": "CEX",
                    "name": "Bybit",
                    "description": null,
                    "imageUrl": null,
                    "createdAt": "2024-08-15T08:10:26.310Z",
                    "updatedAt": "2024-08-15T08:10:26.310Z"
                },
                {
                    "id": 10,
                    "externalExchangeId": "okx",
                    "dataSource": "okx",
                    "type": "CEX",
                    "name": "OKX",
                    "description": null,
                    "imageUrl": null,
                    "createdAt": "2024-08-15T08:10:47.366Z",
                    "updatedAt": "2024-08-15T08:10:47.366Z"
                }
            ],
            "createdAt": "2024-08-15T12:12:01.193Z"
        },
    ],
    "status": 1
}

Get Discrete Aggregation

  • Method: GET

  • Endpoint: /api/v1/crypto/candle-sticks/aggregate-discrete/items/:id

  • Headers:

    • Cookie: The session cookie value.

    • csrf_token: The CSRF token obtained after login.

  • Parameters:

    • id: (string) The identifier of the discrete aggregation task.

Description:

This /api/v1/crypto/candle-sticks/aggregate-discrete/items/:id endpoint returns pre-aggregated candlestick data with deterministic timestamps. The endpoint retrieves stored record by id from the database that have already been aggregated according to specified intervals, such as 1 minute, 5 minutes, 10 minutes, etc. Each candlestick includes the open, high, low, close prices, volume, and an average price for the specified interval. The deterministic timestamps ensure that the candlesticks are aligned to the exact start of the intervals (e.g., 00:00, 00:05, 00:10 for 5-minute intervals), providing consistency across different use cases and allowing for storage and aggregation optimization.

Example with curl:

curl -X GET "http://example.com/api/v1/crypto/candle-sticks/aggregate-discrete/items/2" \
     -H "Cookie: session_cookie_value"  \
     -H "csrf_token: your_csrf_token_here"

Example Response Payload:

{
    "data": {
        "id": "1",
        "timestamp": "2024-06-14T10:00:00.000Z",
        "open": "66900.00000000000000000000000000000000",
        "high": "66900.00000000000000000000000000000000",
        "low": "66890.00000000000000000000000000000000",
        "close": "66890.01000000000000000000000000000000",
        "volume": "0.00890000000000000000000000000000",
        "aggregatedAveragePrice": "66895.00000000000000000000000000000000",
        "resultId": "1",
        "result": {
            "id": "1",
            "symbol": "BTC/USDT",
            "rangeDateStart": "2024-06-14T09:54:46.000Z",
            "rangeDateEnd": "2024-06-14T13:47:00.000Z",
            "timeframeMinutes": 60,
            "processedCount": 22,
            "resultCount": 3,
            "taskId": "31",
            "exchanges": [
                {
                    "id": 1,
                    "externalExchangeId": "binance",
                    "dataSource": "binance",
                    "type": "CEX",
                    "name": "Binance",
                    "description": null,
                    "imageUrl": null,
                    "createdAt": "2024-05-23T13:26:38.980Z",
                    "updatedAt": "2024-05-23T13:26:38.980Z"
                }
            ],
            "createdAt": "2024-07-01T15:01:41.893Z"
        },
        "createdAt": "2024-07-01T15:01:41.953Z"
    },
    "status": 1
}

List Discrete Aggregations

  • Method: GET

  • Endpoint: /api/v1/crypto/candle-sticks/aggregate-discrete/items

  • Headers:

    • Cookie: The session cookie value.

    • csrf_token: The CSRF token obtained after login.

  • Query:

    • limit: (integer) The maximum number of results to retrieve.

    • offset: (integer) The number of results to skip (typically for pagination).

    • rangeDateStart: (string) The start date and time for filtering the results.

    • rangeDateEnd: (string) The end date and time for filtering the results.

    • symbols[]: (array) Filter for the list of cryptocurrency pair symbols (e.g., BTC/USDT).

    • exchangeNames[]: (array) Filter for the list of exchange names from which the data is to be retrieved.

    • timeframeMinutes[]: (array) The time frames in minutes to filter the candlestick data.

Description:

This /api/v1/crypto/candle-sticks/aggregate-discrete/items endpoint returns pre-aggregated candlestick data with deterministic timestamps. The endpoint retrieves stored records from the database that have already been aggregated according to specified intervals, such as 1 minute, 5 minutes, 10 minutes, etc. Each candlestick includes the open, high, low, close prices, volume, and an average price for the specified interval. The deterministic timestamps ensure that the candlesticks are aligned to the exact start of the intervals (e.g., 00:00, 00:05, 00:10 for 5-minute intervals), providing consistency across different use cases and allowing for storage and aggregation optimization.

Example with curl:

curl -X GET "http://example.com/api/v1/crypto/candle-sticks/aggregate-discrete/items?limit=1&offset=0&rangeDateStart=2024-04-01T08:38:37&rangeDateEnd=2024-04-01T23:38:34&symbols[]=BTC/USDT&exchangeNames[]=Binance&exchangeNames[]=Bybit&exchangeNames[]=OKX&timeframeMinutes[]=60" \
     -H "Cookie: session_cookie_value"  \
     -H "csrf_token: your_csrf_token_here"

Example Response Payload:

{
    "data": [
        {
            "id": "1",
            "timestamp": "2024-06-14T10:00:00.000Z",
            "open": "66900.00000000000000000000000000000000",
            "high": "66900.00000000000000000000000000000000",
            "low": "66890.00000000000000000000000000000000",
            "close": "66890.01000000000000000000000000000000",
            "volume": "0.00890000000000000000000000000000",
            "aggregatedAveragePrice": "66895.00000000000000000000000000000000",
            "resultId": "1",
            "result": {
                "id": "1",
                "symbol": "BTC/USDT",
                "rangeDateStart": "2024-06-14T09:54:46.000Z",
                "rangeDateEnd": "2024-06-14T13:47:00.000Z",
                "timeframeMinutes": 60,
                "processedCount": 22,
                "resultCount": 3,
                "taskId": "31",
                "exchanges": [
                    {
                        "id": 1,
                        "externalExchangeId": "binance",
                        "dataSource": "binance",
                        "type": "CEX",
                        "name": "Binance",
                        "description": null,
                        "imageUrl": null,
                        "createdAt": "2024-05-23T13:26:38.980Z",
                        "updatedAt": "2024-05-23T13:26:38.980Z"
                    }
                ],
                "createdAt": "2024-07-01T15:01:41.893Z"
            },
            "createdAt": "2024-07-01T15:01:41.953Z"
        },
        // Additional results here...
    ],
    "status": 1
}

Last updated