# Websocket API

{% hint style="info" %}
**Here is the specification for websocket subscriptions**
{% endhint %}

* request

  ```javascript
  {
      "op": "subscribe", // subscribe | unsubscribe
      "args": [
        // request args
      ]
  }
  ```
* response - success

  ```javascript
  {
      "arg": {
        // request arg
      },
      "code": 0,
      "event": "subscribe",
      "msg": "success"
  }
  ```
* response - error

  ```javascript
  {
      "arg": {
          // request arg
      },
      "code": 1002, // error code
      "event": "subscribe",
      "msg": "channel does not exist" // error msg
  }
  ```

## **1. Token**

* url : `wss://meme-api.openocean.finance/ws/public`
* request

```javascript
{
    "op": "subscribe", 
    "args": [
        {
            "channel": "token"
        }
    ]
}
```

* response

```javascript
{
    "arg": {
        "channel": "token"
    },
    "data": [
        {
            "address": "6kjM53nPqMRzBza3Mi5sm78E7JF59u8oaynQwWp3pump",
            "blockNumber": 304060665,
            "bondingCurveProgress": 55.975222,
            "buyCount24h": 533,
            "buyVolume24h": 13912.29369771923,
            "creator": "BQeKNovUvDGctxkGPXa1B8EoUozzEAzenjt4b52aG4U9",
            "decimals": 6,
            "description": "",
            "hash": "33hrMGQoTEAbiShhAFnZoNQowgDyJVsAYwWqP6NtfDR7qsKeoT6vedZQPqoAuPS14E3oEtNERMeZ4Z8jZ5Nx3cPy",
            "liquidity": 21.171547783,
            "logo": "https://ipfs.io/ipfs/QmfVya7QdtFr1qezFnD91yzAGd8vksawMGag3j18rUXXHi",
            "marketCap": 19597.972197917000000000,
            "name": "Chippy",
            "sellCount24h": 468,
            "sellVolume24h": 8818.72932484522,
            "showName": true,
            "source": "pump",
            "status": "NEW",
            "symbol": "Chippy",
            "telegram": "",
            "timestamp": 1732766916000,
            "top10Holder": 0.264266,
            "totalSupply": 1000000000,
            "tradeCount": 1001,
            "tradeCount24h": 1001,
            "tradeVolume": 22731.02302256445,
            "tradeVolume24h": 22731.02302256445,
            "twitter": "",
            "website": ""
        }
    ]
}
```

## **2. Transaction**

* url: `wss://meme-api.openocean.finance/ws/public`
* request

```javascript
{
    "op": "subscribe",
    "args": [
        {
            "channel": "trade",
            "address": "AbQPqDquAKq87wMYXmNFCe92TAQPetGn8y77b1DApump"
        }
    ]
}
```

* response

```javascript
{
    "arg": {
        "address": "AbQPqDquAKq87wMYXmNFCe92TAQPetGn8y77b1DApump",
        "channel": "trade"
    },
    "data": {
        "account": "DXtHuafXqxzfn2kxTq63YUBGXhHKmF3xUCTdtUMjdqbq",
        "address": "AbQPqDquAKq87wMYXmNFCe92TAQPetGn8y77b1DApump",
        "amount": 174821.088116,
        "hash": "JdJbV5dsRreXoRGbFVuRtCauSrkNiDnEq478DWenbfwrvjcH2TipBJMSA2ME3VM3XVqfDQ7y5mrDJTGtddVkxpp",
        "price": 0.000137889543302721,
        "side": "BUY",
        "source": "raydium",
        "tradeTime": 1732769454000,
        "volume": 24.106
    }
}
```

## **3. Kline**

* url: `wss://meme-api.openocean.finance/ws/kline`
* request

  ```javascript
  {
      "op": "subscribe",
      "args": [
          {
              "channel": "kline",
              "period": "1m",
              "address": "AbQPqDquAKq87wMYXmNFCe92TAQPetGn8y77b1DApump"
          }
      ]
  }
  ```
* response

  ```
  {
      "arg": {
          "address": "AbQPqDquAKq87wMYXmNFCe92TAQPetGn8y77b1DApump",
          "channel": "kline",
          "period": "1m"
      },
      "data": {
          "beginTime": 1732769700,
          "closePrice": 0.000120182648,
          "count": 74,
          "endTime": 1732769760,
          "highPrice": 0.000140944111,
          "lowPrice": 0.000113413696,
          "openPrice": 0.000140944111,
          "period": "1m",
          "quoteVolume": 6254.57153223519,
          "tokenId": 10037,
          "volume": 51074974.333289
      }
  }
  ```

<br>
