Market making

API documentation for private market makers

Getting Started

1. Connecting to the Maker API*

*WebSocket API endpoint is available upon request

Provide following headers in the WebSocket request

  • maker - name of the Market Maker

  • authorization - authorization token

WebSocket server sends Ping message every 30 seconds.

2. Receiving RFQ

Whenever trader requests quote, Liquorice system forwards it to the chosen Market Makers using following message

{
  "messageType": "rfq";
  "message": {
    /// Chain ID, e.g for ArbitrumOne chainId = 42161
    chainId: number;
    /// UUID of the RFQ
    rfqId: string;
    /// Replay protection
    nonce: number;
    /// Address of the Liquorice market contract
    market: string;
    /// Base token address
    baseToken: string;
    /// Quote token address
    quoteToken: string;
    /// Address of the account receiving quoteToken   
    trader: string;
    /// Address of the account performing trade
    effectiveTrader: string;
    // (Exactly one of the following two fields will be present.)
    /// Rational number with up to 18 decimal places, i.e. "1000.55" or "1000.000000000000000001"
    baseTokenAmount?: string;
    /// Rational number with up to 18 decimal places, i.e. "1000.55" or "1000.000000000000000001"
    quoteTokenAmount?: string;
    /// Fees that will be charged, in basis points, up to 2 decimal places.
    feesBps: number;
  };
}

Exactly one of the baseTokenAmount/quoteTokenAmount fields will be present. Having baseTokenAmount present equals to asking "How much ETH would I get if I pay 1000 USDC?" and having quoteTokenAmount equals to asking "How much USDC do I need to pay to get 1 ETH?"

3. Providing signed Quote

Quote message should be sent within the same WebSocket connection that received the RFQ using following format:

{
  "messageType": "rfqQuote",
  "message": {
    /// UUID of the RFQ
    rfqId: string;
    /// Quote expiry UNIX timestamp (seconds)
    quoteExpiry: number;
    /// Address of the Liquorice market 
    market: string,
    /// HEX encoded calldata of the function within Liquorice `market` Contract
    settlementCalldata: string;
    /// Base token address
    baseToken: string;
    /// Quote token address
    quoteToken: string;
    /// Rational number with up to 18 decimal places, i.e. "1000.55" or "1000.000000000000000001"
    baseTokenAmount: string;
    /// Rational number with up to 18 decimal places, i.e. "1000.55" or "1000.000000000000000001"
    quoteTokenAmount: string;
    /// HEX encoded quote signature
    signature: string;
  }
}

3.1 Quote message signature schema

// TBD

4. Subscribe to trades

// TBD

Last updated