# Candle Detection

## Candle Detection

<mark style="color:green;">`GET`</mark> `/charts/candle-info`

This API provides the latest 30 candlesticks of a token to analyze and identify candlestick patterns. It supports data retrieval for three specific time intervals: 1-hour, 4-hour, and 1-day.

Example on DeFi Lens: <https://defilens.ai/tokens/bitcoin/candle-detection>

### **Headers**

<table><thead><tr><th>Name</th><th width="178">Typy</th><th>Description</th></tr></thead><tbody><tr><td><code>x-partner-key</code></td><td>string</td><td><p>Your API Key </p><p>Ex: <code>xxxx</code></p></td></tr></tbody></table>

### **Body**

| Name         | Type   | Description                           |
| ------------ | ------ | ------------------------------------- |
| ohlcDataList | string | Latest 30 candles of the source token |

### Example request

{% code overflow="wrap" %}

```
curl-X'GET'\'https://api.defilens.ai/charts/candle-info?ohlcDataList=[{"timestamp":1722898800000,"open":54695.87,"high":55082,"low":53876.47,"close":54018.81,"volume":93123605.0730397,"turnover":5067627113901.133,"date":"2024-08-05T23:00:00.000Z"},{"timestamp":1722902400000,"open":54018.82,"high":56064.21,"low":53950,"close":56038,"volume":222477592.8350171,"turnover":12240218251780.709,"date":"2024-08-06T00:00:00.000Z"},{"timestamp":1722906000000,"open":56037.99,"high":56276,"low":55436,"close":55723.98,"volume":164161545.5045277,"turnover":9171458073808.113,"date":"2024-08-06T01:00:00.000Z"}]'\-H'accept:*/*'
```

{% endcode %}

### **Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "data": [
        {
            "1722837600000": {
                "type": "BH",
                "pattern_slug": "bullish_hammer",
                "name": "Bullish Hammer candlestick"
            }
        },
        {
            "1722855600000": {
                "type": "BD",
                "pattern_slug": "basic_doji",
                "name": "Doji candlestick"
            }
        },
        {
            "1722891600000": {
                "type": "BD",
                "pattern_slug": "basic_doji",
                "name": "Doji candlestick"
            }
        }
    ],
    "draftData": {
        "1722801600000": {},
        "1722805200000": {},
        "1722808800000": {},
        "1722812400000": {},
        "1722816000000": {},
        "1722819600000": {},
        "1722823200000": {},
        "1722826800000": {},
        "1722830400000": {},
        "1722834000000": {},
        "1722837600000": {
            "bullish_hammer": {
                "type": "bullish_hammer",
                "metadata": {
                    "description": [
                        "hint the start of potential reversal",
                        "hint the start of bullish pattern"
                    ]
                },
                "name": "Bullish Hammer candlestick"
            }
        },
        "1722841200000": {},
        "1722844800000": {},
        "1722848400000": {},
        "1722852000000": {},
        "1722855600000": {
            "basic_doji": {
                "type": "basic_doji",
                "metadata": {
                    "description": [
                        "hint the start of potential reversal"
                    ]
                },
                "name": "Doji candlestick"
            }
        },
        "1722859200000": {},
        "1722862800000": {},
        "1722866400000": {},
        "1722870000000": {},
        "1722873600000": {},
        "1722877200000": {},
        "1722880800000": {},
        "1722884400000": {},
        "1722888000000": {},
        "1722891600000": {
            "basic_doji": {
                "type": "basic_doji",
                "metadata": {
                    "description": [
                        "hint the start of potential reversal"
                    ]
                },
                "name": "Doji candlestick"
            }
        },
        "1722895200000": {},
        "1722898800000": {},
        "1722902400000": {},
        "1722906000000": {}
    }
}
```

{% endtab %}
{% endtabs %}

### Data return

<table><thead><tr><th width="244">Name</th><th width="84">Type</th><th>Description</th></tr></thead><tbody><tr><td><pre><code><strong>pattern_slug
</strong></code></pre></td><td>string</td><td>A string identifier or "slug" that is unique to the type of candlestick pattern.</td></tr><tr><td><pre><code>name
</code></pre></td><td>string</td><td>Name of the candlestick pattern</td></tr><tr><td><pre><code>timestamp
(e.g., 1722837600000)
</code></pre></td><td>object</td><td>This represents the time at which the candlestick pattern was detected</td></tr><tr><td><pre><code>type
</code></pre></td><td>string</td><td>Represents the shorthand code for the candlestick pattern detected<br>Example: <code>"BH"</code> for Bullish Hammer</td></tr></tbody></table>
