MarketMakingClient
The MarketMakingClient handles quote submission and management for market makers and liquidity providers.
note
This client requires API keys with the MARKET_MAKING scope.
Submitting Quotes
const quote = await client.marketMaking.createQuote({
asset: 'BTC',
bidPrice: 49900,
askPrice: 50100,
bidSize: 1.0,
askSize: 1.0,
validForSeconds: 30, // Quote expiry
clientQuoteId: 'my-quote', // Optional custom ID
});
console.log(quote);
// {
// id: 'quote_abc123',
// clientQuoteId: 'my-quote',
// asset: 'BTC',
// bidPrice: '49900',
// askPrice: '50100',
// bidSize: '1.0',
// askSize: '1.0',
// status: 'active',
// expiresAt: '2024-01-15T10:30:30Z',
// createdAt: '2024-01-15T10:30:00Z'
// }
Listing Quotes
// List all active quotes
const quotes = await client.marketMaking.listQuotes({
status: 'active',
});
// Filter by asset
const btcQuotes = await client.marketMaking.listQuotes({
asset: 'BTC',
status: 'active',
limit: 50,
offset: 0,
});
Updating Quotes
Single Quote
const updated = await client.marketMaking.updateQuote('quote_abc123', {
bidPrice: 49950,
askPrice: 50050,
bidSize: 2.0,
askSize: 2.0,
validForSeconds: 60, // Extend expiry
});
Bulk Update
Efficiently update multiple quotes in a single request:
const result = await client.marketMaking.bulkUpdateQuotes([
{ quoteId: 'quote_001', bidPrice: 49900, askPrice: 50100 },
{ quoteId: 'quote_002', bidSize: 2.0, askSize: 2.0 },
{ quoteId: 'quote_003', bidPrice: 29900, askPrice: 30100 },
]);
console.log(`Updated: ${result.updated}, Failed: ${result.failed}`);
Cancelling Quotes
Single Quote
await client.marketMaking.cancelQuote('quote_abc123');
Cancel All Quotes
// Cancel all quotes
await client.marketMaking.cancelAllQuotes();
// Cancel all BTC quotes
await client.marketMaking.cancelAllQuotes('BTC');
Types
import type {
Quote,
CreateQuoteParams,
UpdateQuoteParams,
ListQuotesParams,
BulkUpdateQuote,
QuoteStatus,
} from 'zenotc';
CreateQuoteParams
| Field | Type | Required | Description |
|---|---|---|---|
asset | string | Yes | Asset symbol |
bidPrice | number | Yes | Bid price |
askPrice | number | Yes | Ask price |
bidSize | number | Yes | Bid size |
askSize | number | Yes | Ask size |
validForSeconds | number | No | Quote TTL (default: 30) |
clientQuoteId | string | No | Custom quote ID |
Quote Status
| Status | Description |
|---|---|
active | Quote is live and tradeable |
expired | Quote has expired |
filled | Quote was filled |
cancelled | Quote was cancelled |
Best Practices
Quote Refresh Strategy
// Refresh quotes every 10 seconds
setInterval(async () => {
const prices = await client.marketData.getPrice('BTC');
const mid = parseFloat(prices.mid);
const spread = 0.001; // 0.1% spread
await client.marketMaking.bulkUpdateQuotes([
{
quoteId: 'btc_quote',
bidPrice: mid * (1 - spread),
askPrice: mid * (1 + spread),
}
]);
}, 10000);
Graceful Shutdown
process.on('SIGINT', async () => {
console.log('Cancelling all quotes...');
await client.marketMaking.cancelAllQuotes();
process.exit(0);
});