skewtape 0.0.1 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +182 -0
  3. package/dist/cjs/backtest.d.ts +146 -0
  4. package/dist/cjs/backtest.js +410 -0
  5. package/dist/cjs/client.d.ts +255 -0
  6. package/dist/cjs/client.js +447 -0
  7. package/dist/cjs/download.d.ts +33 -0
  8. package/dist/cjs/download.js +160 -0
  9. package/dist/cjs/errors.d.ts +76 -0
  10. package/dist/cjs/errors.js +159 -0
  11. package/dist/cjs/exact.d.ts +36 -0
  12. package/dist/cjs/exact.js +168 -0
  13. package/dist/cjs/fees.d.ts +68 -0
  14. package/dist/cjs/fees.js +196 -0
  15. package/dist/cjs/geoblock.d.ts +48 -0
  16. package/dist/cjs/geoblock.js +78 -0
  17. package/dist/cjs/index.d.ts +31 -0
  18. package/dist/cjs/index.js +98 -0
  19. package/dist/cjs/kalshi.d.ts +261 -0
  20. package/dist/cjs/kalshi.js +416 -0
  21. package/dist/cjs/keccak.d.ts +10 -0
  22. package/dist/cjs/keccak.js +84 -0
  23. package/dist/cjs/msgpack.d.ts +15 -0
  24. package/dist/cjs/msgpack.js +112 -0
  25. package/dist/cjs/package.json +1 -0
  26. package/dist/cjs/paginated.d.ts +26 -0
  27. package/dist/cjs/paginated.js +51 -0
  28. package/dist/cjs/quote-math.d.ts +146 -0
  29. package/dist/cjs/quote-math.js +446 -0
  30. package/dist/cjs/quote.d.ts +108 -0
  31. package/dist/cjs/quote.js +307 -0
  32. package/dist/cjs/route-hyperliquid.d.ts +228 -0
  33. package/dist/cjs/route-hyperliquid.js +387 -0
  34. package/dist/cjs/route.d.ts +297 -0
  35. package/dist/cjs/route.js +516 -0
  36. package/dist/cjs/stream.d.ts +99 -0
  37. package/dist/cjs/stream.js +529 -0
  38. package/dist/cjs/version.d.ts +6 -0
  39. package/dist/cjs/version.js +9 -0
  40. package/dist/esm/backtest.d.ts +146 -0
  41. package/dist/esm/backtest.js +403 -0
  42. package/dist/esm/client.d.ts +255 -0
  43. package/dist/esm/client.js +441 -0
  44. package/dist/esm/download.d.ts +33 -0
  45. package/dist/esm/download.js +155 -0
  46. package/dist/esm/errors.d.ts +76 -0
  47. package/dist/esm/errors.js +142 -0
  48. package/dist/esm/exact.d.ts +36 -0
  49. package/dist/esm/exact.js +158 -0
  50. package/dist/esm/fees.d.ts +68 -0
  51. package/dist/esm/fees.js +185 -0
  52. package/dist/esm/geoblock.d.ts +48 -0
  53. package/dist/esm/geoblock.js +74 -0
  54. package/dist/esm/index.d.ts +31 -0
  55. package/dist/esm/index.js +30 -0
  56. package/dist/esm/kalshi.d.ts +261 -0
  57. package/dist/esm/kalshi.js +404 -0
  58. package/dist/esm/keccak.d.ts +10 -0
  59. package/dist/esm/keccak.js +80 -0
  60. package/dist/esm/msgpack.d.ts +15 -0
  61. package/dist/esm/msgpack.js +109 -0
  62. package/dist/esm/paginated.d.ts +26 -0
  63. package/dist/esm/paginated.js +47 -0
  64. package/dist/esm/quote-math.d.ts +146 -0
  65. package/dist/esm/quote-math.js +437 -0
  66. package/dist/esm/quote.d.ts +108 -0
  67. package/dist/esm/quote.js +297 -0
  68. package/dist/esm/route-hyperliquid.d.ts +228 -0
  69. package/dist/esm/route-hyperliquid.js +376 -0
  70. package/dist/esm/route.d.ts +297 -0
  71. package/dist/esm/route.js +507 -0
  72. package/dist/esm/stream.d.ts +99 -0
  73. package/dist/esm/stream.js +524 -0
  74. package/dist/esm/version.d.ts +6 -0
  75. package/dist/esm/version.js +6 -0
  76. package/package.json +48 -1
  77. package/src/backtest.ts +490 -0
  78. package/src/client.ts +595 -0
  79. package/src/download.ts +161 -0
  80. package/src/errors.ts +143 -0
  81. package/src/exact.ts +159 -0
  82. package/src/fees.ts +189 -0
  83. package/src/generated/schema.d.ts +2500 -0
  84. package/src/geoblock.ts +90 -0
  85. package/src/index.ts +146 -0
  86. package/src/kalshi.ts +563 -0
  87. package/src/keccak.ts +82 -0
  88. package/src/msgpack.ts +83 -0
  89. package/src/paginated.ts +51 -0
  90. package/src/quote-math.ts +555 -0
  91. package/src/quote.ts +324 -0
  92. package/src/route-hyperliquid.ts +457 -0
  93. package/src/route.ts +631 -0
  94. package/src/stream.ts +539 -0
  95. package/src/version.ts +6 -0
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Keccak-256, the hash Ethereum and Hyperliquid's signing use: the original
3
+ * Keccak padding (0x01), not SHA3-256's (0x06). Written here so the package
4
+ * adds no runtime dependency; the inputs it hashes (one order action) are
5
+ * small, so 64-bit lanes as BigInt are fast enough.
6
+ */
7
+ /** The 32-byte Keccak-256 digest of data. */
8
+ export declare function keccak256(data: Uint8Array): Uint8Array;
9
+ /** Hex with 0x, the shape viem and ethers take. */
10
+ export declare function toHex(bytes: Uint8Array): `0x${string}`;
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ /**
3
+ * Keccak-256, the hash Ethereum and Hyperliquid's signing use: the original
4
+ * Keccak padding (0x01), not SHA3-256's (0x06). Written here so the package
5
+ * adds no runtime dependency; the inputs it hashes (one order action) are
6
+ * small, so 64-bit lanes as BigInt are fast enough.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.keccak256 = keccak256;
10
+ exports.toHex = toHex;
11
+ const MASK = (1n << 64n) - 1n;
12
+ const RATE = 136; // bytes: 1600 - 2 * 256 bits
13
+ const ROUND_CONSTANTS = [
14
+ 0x0000000000000001n, 0x0000000000008082n, 0x800000000000808an, 0x8000000080008000n,
15
+ 0x000000000000808bn, 0x0000000080000001n, 0x8000000080008081n, 0x8000000000008009n,
16
+ 0x000000000000008an, 0x0000000000000088n, 0x0000000080008009n, 0x000000008000000an,
17
+ 0x000000008000808bn, 0x800000000000008bn, 0x8000000000008089n, 0x8000000000008003n,
18
+ 0x8000000000008002n, 0x8000000000000080n, 0x000000000000800an, 0x800000008000000an,
19
+ 0x8000000080008081n, 0x8000000000008080n, 0x0000000080000001n, 0x8000000080008008n,
20
+ ];
21
+ /** ROTATIONS[x][y] is lane (x, y)'s rotation in rho. */
22
+ const ROTATIONS = [
23
+ [0, 36, 3, 41, 18],
24
+ [1, 44, 10, 45, 2],
25
+ [62, 6, 43, 15, 61],
26
+ [28, 55, 25, 21, 56],
27
+ [27, 20, 39, 8, 14],
28
+ ];
29
+ const rotl = (v, n) => (n === 0 ? v : ((v << BigInt(n)) | (v >> BigInt(64 - n))) & MASK);
30
+ /** Keccak-f[1600] on 25 lanes, lane (x, y) at index x + 5y. */
31
+ function permute(a) {
32
+ for (const rc of ROUND_CONSTANTS) {
33
+ const c = [];
34
+ for (let x = 0; x < 5; x++)
35
+ c.push(a[x] ^ a[x + 5] ^ a[x + 10] ^ a[x + 15] ^ a[x + 20]);
36
+ for (let i = 0; i < 25; i++)
37
+ a[i] = a[i] ^ c[(i % 5 + 4) % 5] ^ rotl(c[(i % 5 + 1) % 5], 1);
38
+ const b = new Array(25).fill(0n);
39
+ for (let x = 0; x < 5; x++) {
40
+ for (let y = 0; y < 5; y++)
41
+ b[y + 5 * ((2 * x + 3 * y) % 5)] = rotl(a[x + 5 * y], ROTATIONS[x][y]);
42
+ }
43
+ for (let y = 0; y < 5; y++) {
44
+ for (let x = 0; x < 5; x++) {
45
+ a[x + 5 * y] = b[x + 5 * y] ^ (~b[((x + 1) % 5) + 5 * y] & MASK & b[((x + 2) % 5) + 5 * y]);
46
+ }
47
+ }
48
+ a[0] = a[0] ^ rc;
49
+ }
50
+ }
51
+ /** The 32-byte Keccak-256 digest of data. */
52
+ function keccak256(data) {
53
+ const padLen = RATE - ((data.length + 1) % RATE || RATE) + 1;
54
+ const padded = new Uint8Array(data.length + padLen);
55
+ padded.set(data);
56
+ padded[data.length] = 0x01;
57
+ padded[padded.length - 1] |= 0x80;
58
+ const state = new Array(25).fill(0n);
59
+ for (let off = 0; off < padded.length; off += RATE) {
60
+ for (let i = 0; i < RATE / 8; i++) {
61
+ let lane = 0n;
62
+ for (let j = 7; j >= 0; j--)
63
+ lane = (lane << 8n) | BigInt(padded[off + 8 * i + j]);
64
+ state[i] = state[i] ^ lane;
65
+ }
66
+ permute(state);
67
+ }
68
+ const out = new Uint8Array(32);
69
+ for (let i = 0; i < 4; i++) {
70
+ let lane = state[i];
71
+ for (let j = 0; j < 8; j++) {
72
+ out[8 * i + j] = Number(lane & 0xffn);
73
+ lane >>= 8n;
74
+ }
75
+ }
76
+ return out;
77
+ }
78
+ /** Hex with 0x, the shape viem and ethers take. */
79
+ function toHex(bytes) {
80
+ let s = "0x";
81
+ for (const b of bytes)
82
+ s += b.toString(16).padStart(2, "0");
83
+ return s;
84
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * MessagePack, the subset an exchange action holds.
3
+ *
4
+ * Hyperliquid hashes an action's MessagePack bytes (msgpack.packb in its
5
+ * Python SDK: maps keep their keys' insertion order, strings use the
6
+ * str8/16/32 formats), and a byte off is another hash and a refused
7
+ * signature. This writes what an order action holds: plain objects (their
8
+ * keys in insertion order), arrays, strings, safe integers, booleans and
9
+ * null, each in the smallest format, as msgpack.packb does. Anything else
10
+ * is refused rather than guessed.
11
+ */
12
+ export type Packable = null | boolean | number | string | readonly Packable[] | {
13
+ readonly [key: string]: Packable;
14
+ };
15
+ export declare function packb(value: Packable): Uint8Array;
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ /**
3
+ * MessagePack, the subset an exchange action holds.
4
+ *
5
+ * Hyperliquid hashes an action's MessagePack bytes (msgpack.packb in its
6
+ * Python SDK: maps keep their keys' insertion order, strings use the
7
+ * str8/16/32 formats), and a byte off is another hash and a refused
8
+ * signature. This writes what an order action holds: plain objects (their
9
+ * keys in insertion order), arrays, strings, safe integers, booleans and
10
+ * null, each in the smallest format, as msgpack.packb does. Anything else
11
+ * is refused rather than guessed.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.packb = packb;
15
+ function packb(value) {
16
+ const out = [];
17
+ pack(value, out);
18
+ return Uint8Array.from(out);
19
+ }
20
+ const be = (n, bytes) => {
21
+ const out = [];
22
+ for (let i = bytes - 1; i >= 0; i--)
23
+ out.push(Math.floor(n / 2 ** (8 * i)) % 256);
24
+ return out;
25
+ };
26
+ function pack(v, out) {
27
+ if (v === null) {
28
+ out.push(0xc0);
29
+ }
30
+ else if (v === true) {
31
+ out.push(0xc3);
32
+ }
33
+ else if (v === false) {
34
+ out.push(0xc2);
35
+ }
36
+ else if (typeof v === "number") {
37
+ packInt(v, out);
38
+ }
39
+ else if (typeof v === "string") {
40
+ const b = new TextEncoder().encode(v);
41
+ const n = b.length;
42
+ if (n < 32)
43
+ out.push(0xa0 | n);
44
+ else if (n < 2 ** 8)
45
+ out.push(0xd9, n);
46
+ else if (n < 2 ** 16)
47
+ out.push(0xda, ...be(n, 2));
48
+ else
49
+ out.push(0xdb, ...be(n, 4));
50
+ for (const x of b)
51
+ out.push(x);
52
+ }
53
+ else if (Array.isArray(v)) {
54
+ const n = v.length;
55
+ if (n < 16)
56
+ out.push(0x90 | n);
57
+ else if (n < 2 ** 16)
58
+ out.push(0xdc, ...be(n, 2));
59
+ else
60
+ out.push(0xdd, ...be(n, 4));
61
+ for (const item of v)
62
+ pack(item, out);
63
+ }
64
+ else if (typeof v === "object" && Object.getPrototypeOf(v) === Object.prototype) {
65
+ const entries = Object.entries(v);
66
+ const n = entries.length;
67
+ if (n < 16)
68
+ out.push(0x80 | n);
69
+ else if (n < 2 ** 16)
70
+ out.push(0xde, ...be(n, 2));
71
+ else
72
+ out.push(0xdf, ...be(n, 4));
73
+ for (const [key, item] of entries) {
74
+ pack(key, out);
75
+ pack(item, out);
76
+ }
77
+ }
78
+ else {
79
+ throw new TypeError(`msgpack: ${typeof v} is not written (an action holds objects, arrays, strings, integers, booleans and null)`);
80
+ }
81
+ }
82
+ function packInt(v, out) {
83
+ if (!Number.isSafeInteger(v))
84
+ throw new TypeError(`msgpack: ${v} is not a safe integer`);
85
+ if (v >= 0 && v < 0x80)
86
+ out.push(v);
87
+ else if (v >= -32 && v < 0)
88
+ out.push(v & 0xff);
89
+ else if (v >= 0) {
90
+ if (v < 2 ** 8)
91
+ out.push(0xcc, v);
92
+ else if (v < 2 ** 16)
93
+ out.push(0xcd, ...be(v, 2));
94
+ else if (v < 2 ** 32)
95
+ out.push(0xce, ...be(v, 4));
96
+ else
97
+ out.push(0xcf, ...be(v, 8));
98
+ }
99
+ else if (v >= -(2 ** 7))
100
+ out.push(0xd0, v & 0xff);
101
+ else if (v >= -(2 ** 15))
102
+ out.push(0xd1, ...be(v + 2 ** 16, 2));
103
+ else if (v >= -(2 ** 31))
104
+ out.push(0xd2, ...be(v + 2 ** 32, 4));
105
+ else {
106
+ // int64: two's complement over 8 bytes.
107
+ const big = BigInt.asUintN(64, BigInt(v));
108
+ out.push(0xd3);
109
+ for (let i = 7; i >= 0; i--)
110
+ out.push(Number((big >> BigInt(8 * i)) & 0xffn));
111
+ }
112
+ }
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Paginated lists: the shape every list of the Skewtape client and of the
3
+ * Kalshi client comes back as. for await yields every item, fetching each
4
+ * page as the one before runs out; nothing is fetched until it is iterated.
5
+ */
6
+ /** One page of a list: its items and the cursor of the next page, null on the last. */
7
+ export interface Page<T> {
8
+ items: T[];
9
+ nextCursor: string | null;
10
+ }
11
+ /**
12
+ * A list the API pages: for await yields every item, fetching each page as
13
+ * the one before runs out. Nothing is fetched until it is iterated.
14
+ */
15
+ export declare class Paginated<T> implements AsyncIterable<T> {
16
+ private readonly fetchPage;
17
+ private readonly keep?;
18
+ constructor(fetchPage: (cursor?: string) => Promise<Page<T>>, keep?: ((item: T) => boolean) | undefined);
19
+ /** The pages as the API returns them; a client-side filter (markets resolved, pairs) applies to each. */
20
+ pages(): AsyncGenerator<Page<T>, void, undefined>;
21
+ [Symbol.asyncIterator](): AsyncGenerator<T, void, undefined>;
22
+ /** The first item, or undefined when there is none. */
23
+ first(): Promise<T | undefined>;
24
+ /** Every item, in one array. */
25
+ toArray(): Promise<T[]>;
26
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ /**
3
+ * Paginated lists: the shape every list of the Skewtape client and of the
4
+ * Kalshi client comes back as. for await yields every item, fetching each
5
+ * page as the one before runs out; nothing is fetched until it is iterated.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.Paginated = void 0;
9
+ /**
10
+ * A list the API pages: for await yields every item, fetching each page as
11
+ * the one before runs out. Nothing is fetched until it is iterated.
12
+ */
13
+ class Paginated {
14
+ fetchPage;
15
+ keep;
16
+ constructor(fetchPage, keep) {
17
+ this.fetchPage = fetchPage;
18
+ this.keep = keep;
19
+ }
20
+ /** The pages as the API returns them; a client-side filter (markets resolved, pairs) applies to each. */
21
+ async *pages() {
22
+ let cursor;
23
+ for (;;) {
24
+ let page = await this.fetchPage(cursor);
25
+ if (this.keep)
26
+ page = { items: page.items.filter(this.keep), nextCursor: page.nextCursor };
27
+ yield page;
28
+ if (!page.nextCursor)
29
+ return;
30
+ cursor = page.nextCursor;
31
+ }
32
+ }
33
+ async *[Symbol.asyncIterator]() {
34
+ for await (const page of this.pages())
35
+ yield* page.items;
36
+ }
37
+ /** The first item, or undefined when there is none. */
38
+ async first() {
39
+ for await (const item of this)
40
+ return item;
41
+ return undefined;
42
+ }
43
+ /** Every item, in one array. */
44
+ async toArray() {
45
+ const out = [];
46
+ for await (const item of this)
47
+ out.push(item);
48
+ return out;
49
+ }
50
+ }
51
+ exports.Paginated = Paginated;
@@ -0,0 +1,146 @@
1
+ /**
2
+ * The arithmetic of sk.quote: the port of tape's internal/quote and the taker
3
+ * fee formulas of internal/fees, in integers (BigInt inside, exact
4
+ * rationals for the fees). It reads no book and calls no host; quote.ts
5
+ * assembles its input from the quote context and the books it read.
6
+ * conformance/quote.json (mirrored to testdata/quote_conformance.json) holds
7
+ * the vectors both SDKs pass.
8
+ *
9
+ * Units: prices in micro-dollars per contract (0 to 1,000,000), sizes in
10
+ * micro-contracts (1,000,000 a contract), money in micro-dollars, all safe
11
+ * integers at the boundary. Fees are computed at 6 decimals for every venue.
12
+ */
13
+ import { SkewtapeError } from "./errors.js";
14
+ export declare const MICRO = 1000000;
15
+ export type Side = "buy" | "sell";
16
+ export type FeeStatus = "ok" | "no_row" | "masked" | "blocked";
17
+ export type FeePer = "order" | "level";
18
+ export type Plan = "venue" | "split" | "none";
19
+ export type QuoteErrorCode = "rule_mismatch" | "venue_unreachable" | "invalid_input";
20
+ /** A quote that cannot be given; code is rule_mismatch, venue_unreachable or invalid_input, and detail the rule note, the venues and why, or what is invalid. */
21
+ export declare class QuoteError extends SkewtapeError {
22
+ readonly detail: string;
23
+ constructor(code: QuoteErrorCode, detail: string);
24
+ }
25
+ /** The members do not resolve alike (resolution_equal is false) and the caller did not allow it; detail is the rule note. */
26
+ export declare class RuleMismatchError extends QuoteError {
27
+ constructor(detail: string);
28
+ }
29
+ /** No member's book could be read; detail names each venue and why. */
30
+ export declare class VenueUnreachableError extends QuoteError {
31
+ constructor(detail: string);
32
+ }
33
+ /** A side, size, level or member that breaks the input's rules. */
34
+ export declare class InvalidQuoteInputError extends QuoteError {
35
+ constructor(detail: string);
36
+ }
37
+ export interface Level {
38
+ price_micros: number;
39
+ size_micro: number;
40
+ }
41
+ /** The side of a member's book the order takes (asks for a buy, bids for a sell), in any order, with the venue's minimum order and size step (0 for none). */
42
+ export interface Book {
43
+ /** null reads as no level, as Go writes an empty list. */
44
+ levels: Level[] | null;
45
+ min_size_micro?: number;
46
+ size_step_micro?: number;
47
+ }
48
+ /** The part of a fee row a quote computes with. */
49
+ export interface FeeSchedule {
50
+ formula: string;
51
+ rounding: string;
52
+ taker_params: Record<string, number>;
53
+ min_fee_micros?: number | null;
54
+ }
55
+ /** One member of the quote with the book read for its outcome's token; book null when the venue could not be reached, unreachable saying why. */
56
+ export interface QuoteMember {
57
+ venue: string;
58
+ market_id: string;
59
+ token_id: string;
60
+ fee_status: string;
61
+ fee_per: string;
62
+ fee?: FeeSchedule | null;
63
+ book?: Book | null;
64
+ blocked?: boolean;
65
+ unreachable?: string;
66
+ }
67
+ export interface QuoteInput {
68
+ event_id: string;
69
+ side: string;
70
+ size_micro: number;
71
+ resolution_equal: boolean;
72
+ rule_note: string;
73
+ allow_rule_mismatch?: boolean;
74
+ members: QuoteMember[];
75
+ }
76
+ /** One venue's share of a plan, walked on its book. */
77
+ export interface Leg {
78
+ venue: string;
79
+ market_id: string;
80
+ token_id: string;
81
+ size_micro: number;
82
+ notional_micros: number;
83
+ fee_micros: number;
84
+ net_micros: number;
85
+ avg_price_micros: number;
86
+ net_avg_price_micros: number;
87
+ fee_status: string;
88
+ }
89
+ /** One reachable member alone: its depth on the side and what the size would fill there. */
90
+ export interface VenueQuote extends Leg {
91
+ depth_micro: number;
92
+ }
93
+ export interface Skip {
94
+ venue: string;
95
+ market_id: string;
96
+ reason: "venue_unreachable" | "blocked";
97
+ detail?: string;
98
+ }
99
+ /** The best plan, its totals and legs, every reachable member alone, the members left out and the warnings. A quote places nothing. */
100
+ export interface QuoteResult {
101
+ event_id: string;
102
+ side: string;
103
+ size_micro: number;
104
+ plan: Plan;
105
+ filled_micro: number;
106
+ notional_micros: number;
107
+ fee_micros: number;
108
+ net_micros: number;
109
+ avg_price_micros: number;
110
+ net_avg_price_micros: number;
111
+ legs: Leg[];
112
+ venues: VenueQuote[];
113
+ skipped: Skip[];
114
+ warnings: string[];
115
+ }
116
+ /** The taker fee in micro-dollars for size micro-contracts against notional micro-dollars, as tape's fees.ComputeTakerFee at 6 decimals. */
117
+ export declare function takerFeeMicros(fee: FeeSchedule, size: number, notional: number): number;
118
+ /**
119
+ * The best plan for q, as tape's internal/quote.Quote computes it:
120
+ *
121
+ * 1. A side other than buy or sell, a size of 0 or less, a level priced
122
+ * outside 0 to 1,000,000 or sized 0 or less, or a member with an unknown
123
+ * fee status or basis throws InvalidQuoteInputError.
124
+ * 2. resolution_equal false throws RuleMismatchError with the rule note,
125
+ * unless allow_rule_mismatch; then the result warns.
126
+ * 3. A blocked member is skipped, and so is one with no book
127
+ * (venue_unreachable, with its reason); none left and one unreachable
128
+ * throws VenueUnreachableError naming each.
129
+ * 4. Each leg's notional is the exact sum of size x price rounded once (up
130
+ * for a buy, down for a sell); its fee is the row's on the leg's totals
131
+ * (fee_per order) or on each level's fill (level). A fee status other than
132
+ * ok has no fee to count: unknown, never zero. When a member whose fee is
133
+ * known can fill some of the size alone, a fee-unknown member is left out
134
+ * of the split and the best plan (a price before fees is never compared
135
+ * with one after them), still quoted alone in venues before fees, and
136
+ * warns fee_unknown; otherwise the members are compared before fees and
137
+ * the warning says no fee is counted.
138
+ * 5. Each member alone fills the size or its depth, cut to its size step,
139
+ * nothing under its minimum; every reachable member is in venues.
140
+ * 6. The split ranks every level by price plus the exact fee of one contract
141
+ * (minus it for a sell), takes them in order, cuts each share to its step
142
+ * and leaves out a member under its minimum.
143
+ * 7. The best plan fills the most, then nets the least (buy) or the most
144
+ * (sell), then has the fewer legs; a partial fill warns.
145
+ */
146
+ export declare function computeQuote(q: QuoteInput): QuoteResult;