src/experimental/index.ts
v0.1.0 · 1.4 KB
export * from './ledger.js';
/** @experimental Matching order counts cannot prove that two transports target the same subaccount. */
export function checkBinding(
rest: ReadonlyMap<string, number>,
ws: ReadonlyMap<string, number>,
): { kind: 'consistent' | 'mismatch' | 'unproven'; symbols: string[] } {
const mismatches: string[] = [];
for (const symbol of new Set([...rest.keys(), ...ws.keys()]))
if ((rest.get(symbol) ?? 0) !== (ws.get(symbol) ?? 0)) mismatches.push(symbol);
return mismatches.length
? { kind: 'mismatch', symbols: mismatches }
: rest.size || ws.size
? { kind: 'consistent', symbols: [] }
: { kind: 'unproven', symbols: [] };
}
import type { MarketDataOptions } from '../mds/index.js';
import { createMarketDataStreamInternal } from '../mds/stream.js';
import type { TradeSessionOptions } from '../session/index.js';
import { createTradeSessionInternal } from '../session/session.js';
/** @experimental Header-based trade handshake is not established by the published query-auth protocol. */
export function createHeaderAuthTradeSession(options: TradeSessionOptions) {
return createTradeSessionInternal({ ...options, authMode: 'headers' });
}
/** @experimental Extending an old band age from other symbol frames cannot prove that the band is unchanged. */
export function createStreamAgeMarketData(options: MarketDataOptions) {
return createMarketDataStreamInternal({ ...options, bandAgeFrom: 'stream' });
}