Websocket Documentation

Websocket url: wss://quoter.coinquoter.com:9001

Websocket Streams

Our platform provides two methods for obtaining price feeds.

  1. General - the best pricing feeds for token pairs in general.

  2. Specific for a maker - the best token pairs pricing feeds for a specific maker.

General Pricing Data

General pricing data allow us to connect to two different streams.

  1. General stream

  2. Request stream

General stream

The best price stream contains two sides of a token pair.

Parameters

NameTypeMandatoryDescription

action

String

Yes

Always "sub-quoter-pricing"

channel

String

Yes

Structure: tokenName0-tokenName1-pairId

Request example

{ 
    "action": "sub-quoter-pricing",
    "channel": "WONE-1USDT-1"
}

Example response

{
  "message": {
    "content": {
      "type": "",
      "method": "",
      "data": {
        "bid": "0.047650468",
        "ask": "0.047674767",
        "gasFeeToken0": "0.004642591",
        "gasFeeToken1": "0.00022128910001499997",
        "inboundBid": 0.04766,
        "inboundAsk": 0.04767,
        "transactionFee": 1000000000000000000,
        "transactionFeeToken": "0xDcC4DaAD65Dd459505D8af9bfF60aFd2A8c0b2cc",
        "makerAddressBid": "0x98c3cec32166936672a75fd7d85ad92eb5178d84",
        "makerAddressAsk": "0x98c3cec32166936672a75fd7d85ad92eb5178d84",
        "amount0Address": "0xca3e951D17C520B42ED98482b1f8B6478D4531E2",
        "amount1Address": "0xb63b211f1dB545C04829CA0a3E7D8313711E7eA9",
        "amount0Dec": 18,
        "amount1Dec": 6,
        "maxToken0Bid": "4.7650468",
        "maxToken1Bid": "1091.3844948831131",
        "minToken0": "1",
        "minToken1": "0",
        "pairId": 1
      }
    }
  }
}

Request stream

The best price stream includes only one side of a pair and is based on the amount of token you want to sell/buy.

Parameters

NameTypeMandatoryDescription

action

String

Yes

Always "custom-topic-subscribe".

data

Object

Yes

Contains information about a topic.

topic_identifier

String

Yes

Any name that will identify the destination place for websocket data.

topic_name

String

Yes

Name of topic you'd like to connect to.

parameters

Array

Yes

Array of stream parameters (side, pairId, value).

side

Integer

Yes

0-bid, 1-ask

pairId

Integer

Yes

Token pair id. Token pairs available on our API endpoint.

value

Decimal

Yes

Token amount you want to buy or sell.

Request example

{
    "action": "custom-topic-subscribe",
    "data": {
        "topic_identifier": "PRICE_REQUEST",
        "topic_name": "SELECT_REQUEST_PRICING",
        "parameters": [0, 1, 10]  // in order: side, pairId, value
  }
}

Example response

{
  "topic_identifier": "PRICE_REQUEST",
  "topic": "SELECT_REQUEST_PRICING",
  "columns": [
    "rule_id",
    "pair_id",
    "spread_perc",
    "side",
    "outbound_price",
    "maker_address",
    "token0_address",
    "token1_address",
    "token0_dec",
    "token1_dec",
    "gas_fee_token0",
    "gas_fee_token1"
  ],
  "rows": [
    {
      "rule_id": 132,
      "pair_id": 1,
      "spread_perc": 0.0001,
      "side": 1,
      "outbound_price": 0.047774777,
      "maker_address": "0x98c3cec32166936672a75fd7d85ad92eb5178d84",
      "token0_address": "0xca3e951D17C520B42ED98482b1f8B6478D4531E2",
      "token1_address": "0xb63b211f1dB545C04829CA0a3E7D8313711E7eA9",
      "token0_dec": 18,
      "token1_dec": 6,
      "gas_fee_token0": 0.004642591,
      "gas_fee_token1": 0.000221706933205
    }
  ]
}

Your response might be empty. It means that there is no price stream for this particular value.

Pricing data for a specific maker

Pricing data for a specific maker also allows us to connect to two different streams.

  1. General stream

  2. Request stream

General stream

The best price stream provided by a specific maker containing two sides of a token pair.

Parameters

NameTypeMandatoryDescription

action

String

Yes

Always "custom-topic-subscribe".

data

Object

Yes

Contains information about a topic.

topic_identifier

String

Yes

Any name that will identify the destination place for websocket data.

topic_name

String

Yes

Name of topic you'd like to connect to.

parameters

Array

Yes

Array of stream parameters (side, pairId, value).

pairId

Integer

Yes

Token pair id. Token pairs available on our API endpoint.

makerAddress

String

Yes

The wallet address of a maker whom pricing stream you want to receive.

Request example

{
    "action": "custom-topic-subscribe",
    "data": {
        "topic_identifier": "MAKER_PAIR_PRICING",
        "topic_name": "MAKER_PAIR_PRICING",
        "parameters": [
            1, 
            "0xDa0DD31b18C6BABc35e7d59f94fAe7a180594C7b",
            1, 
            "0xDa0DD31b18C6BABc35e7d59f94fAe7a180594C7b"
        ]  // in order: pairId, makerAddress, pairId, makerAddress
  }
}

Example response

{
    "topic_identifier": "MAKER_PAIR_PRICING",
    "topic": "MAKER_PAIR_PRICING",
    "columns": [
        "pair_id",
        "feed_tier",
        "side",
        "spread_perc",
        "spread_perc:1",
        "min_amount",
        "max_slippage_perc",
        "inbound_price",
        "outbound_price",
        "max_buy_amount",
        "symbol_token0",
        "symbol_token1",
        "maker_address",
        "token0_address",
        "token1_address",
        "token0_dec",
        "token1_dec",
        "gas_fee_token0",
        "gas_fee_token1",
        "transaction_fee",
        "transaction_fee_token"
    ],
    "rows": [
        {
            "pair_id": 1,
            "feed_tier": 0,
            "side": 1,
            "spread_perc": 0.0001,
            "spread_perc:1": 0.0001,
            "min_amount": 0,
            "max_slippage_perc": 10,
            "inbound_price": 0.04718,
            "outbound_price": 0.047184718,
            "max_buy_amount": 1112,
            "symbol_token0": "WONE",
            "symbol_token1": "1USDT",
            "maker_address": "0x98c3cec32166936672a75fd7d85ad92eb5178d84",
            "token0_address": "0xca3e951D17C520B42ED98482b1f8B6478D4531E2",
            "token1_address": "0xb63b211f1dB545C04829CA0a3E7D8313711E7eA9",
            "token0_dec": 18,
            "token1_dec": 6,
            "gas_fee_token0": 0.0052416350000000006,
            "gas_fee_token1": 0.000247274131125,
            "transaction_fee": 1000000000000000000,
            "transaction_fee_token": "0xDcC4DaAD65Dd459505D8af9bfF60aFd2A8c0b2cc"
        }
    ]
}

Request stream

The best price stream provided by a specific maker including only one side of a pair and is based on the amount of token you want to sell/buy.

Parameters

NameTypeMandatoryDescription

action

String

Yes

Always "custom-topic-subscribe".

data

Object

Yes

Contains information about a topic.

topic_identifier

String

Yes

Any name that will identify the destination place for websocket data.

topic_name

String

Yes

Name of topic you'd like to connect to.

parameters

Array

Yes

Array of stream parameters (side, pairId, value).

side

Integer

Yes

0-bid, 1-ask

pairId

Integer

Yes

Token pair id. Token pairs available on our API endpoint.

value

Decimal

Yes

Token amount you want to buy or sell.

makerAddress

String

Yes

The wallet address of a maker whom pricing stream you want to receive.

Request example

{
    "action": "custom-topic-subscribe",
    "data": {
        "topic_identifier": "MAKER_PRICE_REQUEST",
        "topic_name": "SELECT_REQUEST_MAKER_PRICING",
        "parameters": [0, 1, 10, "0x98C3CEC32166936672A75FD7D85ad92eb5178D84"]  
        // in order: side, pairId, value, makerAddress
  }
}

Example response

{
    "topic_identifier": "MAKER_PRICE_REQUEST",
    "topic": "SELECT_REQUEST_MAKER_PRICING",
    "columns": [
        "rule_id",
        "pair_id",
        "spread_perc",
        "side",
        "outbound_price",
        "maker_address",
        "token0_address",
        "token1_address",
        "token0_dec",
        "token1_dec",
        "gas_fee_token0",
        "gas_fee_token1"
    ],
    "rows": [
        {
            "rule_id": 131,
            "pair_id": 1,
            "spread_perc": 0.0002,
            "side": 0,
            "outbound_price": 0.047200558000000004,
            "maker_address": "0x98c3cec32166936672a75fd7d85ad92eb5178d84",
            "token0_address": "0xca3e951D17C520B42ED98482b1f8B6478D4531E2",
            "token1_address": "0xb63b211f1dB545C04829CA0a3E7D8313711E7eA9",
            "token0_dec": 18,
            "token1_dec": 6,
            "gas_fee_token0": 0.0052416350000000006,
            "gas_fee_token1": 0.00024753621287500004
        }
    ]
}

Order Execution

To execute an order, send a message to the quote-executions-[UUID] channel with the following information.

Description

type

Number

0 - bid, 1 - ask

takerAmount

String

Has to be number with no decimals.

makerAmount

String

Has to be number with no decimals.

limitOrder

RFQOrder

Object created with "buildRFQOrder" method from limit order protocol library.

sessionKey

String

Session public key.

resultEIP712

EIP712TypedData

Object created with "buildRFQOrderTypedData" method from limit order protocol library.

limitOrderSignature

String

String created with "buildOrderSignature" method from limit order protocol library.

ruleId

Number

Rule id received from pricing stream.

orderGas

Object

Gas Fee information received from the pricing stream.

Example request

{ 
    "action": "execute-order"
    ​"channel": "quote-executions-6f47c643-cfa6-48ae-ae5b-f8fed519ef65"
​    "data": 
        { 
               "limitOrder": RFQOrder,
               "limitOrderSignature": "0x30dcd76f11d3b0a1f75757eb442b73c056a19df80209107d4b7ef4135f4699086f0e090ab9d96bd74f439124381d52be13d19abd440dd4bd9793b69a86a0d3e81b",
               "takerAmount": "10000", 
               "makerAmount": "75023679387584720",
               "type": 1,
               ​​"ruleId": 114,
​               "sessionKey": "0xD9594fa3BAd626Eed13d0F2b5BFDC2dd7a7576e9",
               "orderGas": 
                  {
                       "gasFee":0.00464478,
                       "gasFeeToken0":"0.00464478",
                       "gasFeeToken1":"0.0005829431139",
                       "gasFeeOperation":4
                  },
               "resultEIP712": EIP712TypedData
       }
​​​}

Order Status

In order to receive your transaction status, subscribe to a channel that is the id you used to create RFQOrder.

Subscription example

{ 
    "action": "sub-response-client-execution",
    "channel": "3203138488"  // that is the same id you had used to create RFQOrder
}

Example responses

{ 
    "type": "pending" 
}
{
    "action": "quote-execution-response",
    "channel": "3203138488",
    "content": {
            "type": "transaction_posted",
            "hash: "0x499e6a5c76920118987055b19b5d8d0217e4c9559e8023d61e284bb606b2677d"
    }
}
{ 
    "type": "send_to_blockchain",
    "hash": "0x499e6a5c76920118987055b19b5d8d0217e4c9559e8023d61e284bb606b2677d" 
}
{ 
    "type": "filled",
    "hash": "0x499e6a5c76920118987055b19b5d8d0217e4c9559e8023d61e284bb606b2677d" 
}

Advanced Panel Streams

There are two additional streams for advanced mode.

  1. General advanced stream

  2. Advanced stream for a specific maker

Parameters

NameTypeMandatoryDescription

pairId

Integer

Yes

Token pair id. Token pairs available on our API endpoint.

valueBid

Decimal

Yes

Token amount on bid side.

valueAsk

Decimal

Yes

Token amount on ask side.

makerAddress

String

Yes

The wallet address of a maker whom pricing stream you want to receive.

General advanced stream

The best price stream includes two sides of a pair and is based on the amount of token you want to sell/buy.

Example request

{
    "action": "custom-topic-subscribe",
    "data": {
        "topic_identifier": "6", // pairId (string)
        "topic_name": "SELECT_ADVANCED_REQUEST_PRICING",
        "parameters": [6, 0.1, 6, 0.1]  
        // in order: pairId, valueBid, pairId, valueAsk
  }
}

Example response

{
    "topic_identifier": "6",
    "topic": "SELECT_ADVANCED_REQUEST_PRICING",
    "columns": [
        "rule_id",
        "pair_id"
        "side",
        "outbound_price",
        "maker_address",
        "token0_address",
        "token1_address",
        "token0_dec",
        "token1_dec",
        "gas_fee_token0",
        "gas_fee_token1",
        "transaction_fee",
        "transaction_fee_token"
    ],
    "rows": [
        {
        "gas_fee_token0": 0.018512530089152
        ​​​"gas_fee_token1": 0.015949470298308906
        ​​​"maker_address": "0xda0dd31b18c6babc35e7d59f94fae7a180594c7b"
        ​​​"outbound_price": 0.86149991385
        ​​​"pair_id": 6
        ​​​"rule_id": 234
        ​​​"side": 0
        ​​​"token0_address": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270"
        ​​​"token0_dec": 18
        ​​​"token1_address": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F"
        ​​​"token1_dec": 6
        ​​"transaction_fee": 0
        "​transaction_fee_token": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F"
        },
        
        {
        "gas_fee_token0": 0.018512530089152
        ​​​"gas_fee_token1": 0.015949470298308906
        ​​​"maker_address": "0xda0dd31b18c6babc35e7d59f94fae7a180594c7b"
        ​​​"outbound_price": 0.86149991385
        ​​​"pair_id": 6
        ​​​"rule_id": 235
        ​​​"side": 1
        ​​​"token0_address": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270"
        ​​​"token0_dec": 18
        ​​​"token1_address": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F"
        ​​​"token1_dec": 6
        ​​"transaction_fee": 0
        "​transaction_fee_token": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F"
        }
    ]
}

Advanced stream for a specific maker

The best price stream includes two sides of a pair and is based on the amount of token you want to sell/buy. Stream is provided by a specific maker.

Request example

{
    "action": "custom-topic-subscribe",
    "data": {
        "topic_identifier": "6", // pairId (string)
        "topic_name": "SELECT_ADVANCED_REQUEST_PRICING",
        "parameters": [6, 0.1, "0x98C3CEC32166936672A75FD7D85ad92eb5178D84",
         6, 0.1,"0x98C3CEC32166936672A75FD7D85ad92eb5178D84"]  
        // in order: pairId, valueBid, makerAddress, pairId, valueAsk, makerAddress
  }
}

Response Example

{
    "topic_identifier": "6",
    "topic": "SELECT_ADVANCED_MAKER_REQUEST_PRICING",
    "columns": [
        "rule_id",
        "pair_id"
        "side",
        "outbound_price",
        "maker_address",
        "token0_address",
        "token1_address",
        "token0_dec",
        "token1_dec",
        "gas_fee_token0",
        "gas_fee_token1",
        "transaction_fee",
        "transaction_fee_token"
    ],
    "rows": [
        {
        "gas_fee_token0": 0.018512530089152
        ​​​"gas_fee_token1": 0.015949470298308906
        ​​​"maker_address": "0xda0dd31b18c6babc35e7d59f94fae7a180594c7b"
        ​​​"outbound_price": 0.86149991385
        ​​​"pair_id": 6
        ​​​"rule_id": 234
        ​​​"side": 0
        ​​​"token0_address": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270"
        ​​​"token0_dec": 18
        ​​​"token1_address": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F"
        ​​​"token1_dec": 6
        ​​"transaction_fee": 0
        "​transaction_fee_token": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F"
        },
        
        {
        "gas_fee_token0": 0.018512530089152
        ​​​"gas_fee_token1": 0.015949470298308906
        ​​​"maker_address": "0xda0dd31b18c6babc35e7d59f94fae7a180594c7b"
        ​​​"outbound_price": 0.86149991385
        ​​​"pair_id": 6
        ​​​"rule_id": 235
        ​​​"side": 1
        ​​​"token0_address": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270"
        ​​​"token0_dec": 18
        ​​​"token1_address": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F"
        ​​​"token1_dec": 6
        ​​"transaction_fee": 0
        "​transaction_fee_token": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F"
        }
    ]
}

Last updated