StreamDataResponse
Each message in the stream is a StreamDataResponse. It contains the trade data plus
the pair and source identifiers.
Proto definition
proto
// A trade message
message Trade {
// Price of the trade. Positive decimal string (e.g. "42000.50").
string price = 1;
// Quantity of the trade. Positive decimal string (e.g. "0.00123").
string quantity = 2;
// Timestamp of the trade in Unix nanoseconds.
int64 timestamp = 3;
}
// A data message
message StreamDataResponse {
// The trade data.
arcfeed.dataservice.v1.Trade trade = 1;
// The trading pair. Always populated. Format: BASE-QUOTE (e.g. "BTC-USDT").
string pair = 2;
// The exchange source. Always populated (e.g. "binance").
string source = 3;
}Fields
trade — Trade (optional)
The trade data from the exchange. Contains three fields:
| Field | Type | Description |
|---|---|---|
price | string | Trade price as a decimal string (e.g. "42000.50") |
quantity | string | Trade quantity as a decimal string (e.g. "0.00123") |
timestamp | int64 | Trade timestamp in Unix nanoseconds |
Why strings for price and quantity? Floating-point types cannot
represent all decimal values exactly. For financial data, precision is non-negotiable. Arcfeed uses
decimal strings to preserve the full precision of the original exchange data.
pair — string (always populated)
The trading pair in BASE-QUOTE format (e.g. BTC-USDT). Always present
and non-empty.
source — string (always populated)
The exchange identifier (e.g. binance). Always present and non-empty. See Supported Exchanges for all possible values.
Example usage
typescript
for await (const response of stream) {
const { trade, pair, source } = response;
// trade is optional — always guard before accessing
if (trade) {
// Access trade fields
console.log('price:', trade.price); // e.g. "42000.50"
console.log('quantity:', trade.quantity); // e.g. "0.00123"
// timestamp is a BigInt in TypeScript (int64)
const ms = Number(trade.timestamp) / 1_000_000;
console.log('time:', new Date(ms).toISOString());
// Top-level pair and source
console.log(`[${source}] ${pair}: ${trade.price} x ${trade.quantity}`);
}
}