@flexemarkets/fm-sdk 0.14.0 → 0.16.0
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.
- package/dist/client.d.ts +78 -3
- package/dist/client.js +148 -20
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/order-stream.d.ts +127 -0
- package/dist/order-stream.js +246 -0
- package/dist/order-stream.js.map +1 -0
- package/dist/order-utils.js +1 -0
- package/dist/order-utils.js.map +1 -1
- package/dist/stomp.d.ts +50 -5
- package/dist/stomp.js +84 -7
- package/dist/stomp.js.map +1 -1
- package/dist/types.d.ts +58 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -1
- package/package.json +2 -2
package/dist/types.d.ts
CHANGED
|
@@ -211,15 +211,30 @@ export interface Market {
|
|
|
211
211
|
* when the server does not say.
|
|
212
212
|
*/
|
|
213
213
|
unitDecimals: number;
|
|
214
|
+
/**
|
|
215
|
+
* For a call market, what it shows of its book during the call:
|
|
216
|
+
* {@link MARKET_CALL_BOOK_SEALED}, a participant's own orders only, or
|
|
217
|
+
* {@link MARKET_CALL_BOOK_INDICATIVE}, also the price it would clear at now
|
|
218
|
+
* and the volume ({@link CallIndicative}). Sealed when the server does not say.
|
|
219
|
+
*/
|
|
220
|
+
callBook: string;
|
|
214
221
|
}
|
|
215
222
|
export declare const MARKET_MECHANISM_CONTINUOUS = "CONTINUOUS";
|
|
216
223
|
export declare const MARKET_MECHANISM_CALL = "CALL";
|
|
224
|
+
export declare const MARKET_CALL_BOOK_SEALED = "SEALED";
|
|
225
|
+
export declare const MARKET_CALL_BOOK_INDICATIVE = "INDICATIVE";
|
|
217
226
|
/**
|
|
218
227
|
* Whether `market` is a call auction, where a crossing order rests until a
|
|
219
228
|
* call rather than trading, and a participant sees only their own resting
|
|
220
229
|
* orders.
|
|
221
230
|
*/
|
|
222
231
|
export declare function isCall(market: Market): boolean;
|
|
232
|
+
/**
|
|
233
|
+
* Whether `market` is a call market that publishes the price its book would
|
|
234
|
+
* clear at now: `indicative()` reads it, and the stream delivers each change
|
|
235
|
+
* as a {@link CallIndicative}.
|
|
236
|
+
*/
|
|
237
|
+
export declare function showsIndicative(market: Market): boolean;
|
|
223
238
|
/**
|
|
224
239
|
* One call of a call-auction market: when it was made, what made it, and
|
|
225
240
|
* what it cleared.
|
|
@@ -251,6 +266,43 @@ export interface MarketCall {
|
|
|
251
266
|
}
|
|
252
267
|
export declare const MARKET_CALL_TRIGGER_MANUAL = "MANUAL";
|
|
253
268
|
export declare const MARKET_CALL_TRIGGER_INTERVAL = "INTERVAL";
|
|
269
|
+
/**
|
|
270
|
+
* What an indicative call market's book would clear at if it were called
|
|
271
|
+
* now: the price and volume a call would make, and nothing of the orders
|
|
272
|
+
* behind them.
|
|
273
|
+
*
|
|
274
|
+
* The server works it out after each batch of orders that touched the
|
|
275
|
+
* market, and after each call, and publishes it only when it changed. Two
|
|
276
|
+
* values can arrive out of order, so keep the one with the highest `seq` for
|
|
277
|
+
* the session: read it on subscribe, then apply only values with a higher
|
|
278
|
+
* `seq`.
|
|
279
|
+
*/
|
|
280
|
+
/**
|
|
281
|
+
* A marketplace's current session, as `GET /marketplaces/current-sessions`
|
|
282
|
+
* lists it: which session is current and its state, without the rest of the
|
|
283
|
+
* session.
|
|
284
|
+
*/
|
|
285
|
+
export interface CurrentSession {
|
|
286
|
+
marketplaceId: number;
|
|
287
|
+
/** Its current session. */
|
|
288
|
+
sessionId: number;
|
|
289
|
+
/** That session's state: OPEN, PAUSED or CLOSED. */
|
|
290
|
+
state: string;
|
|
291
|
+
}
|
|
292
|
+
export interface CallIndicative {
|
|
293
|
+
marketplaceId: number;
|
|
294
|
+
marketId: number;
|
|
295
|
+
/** The session whose book it is. */
|
|
296
|
+
sessionId: number;
|
|
297
|
+
/** The price the book would clear at, or null when nothing crosses. */
|
|
298
|
+
price: number | null;
|
|
299
|
+
/** Units that would trade there; 0 when nothing crosses. */
|
|
300
|
+
volume: number;
|
|
301
|
+
/** Rises with each change in the market; 0 for a value read before any was published. */
|
|
302
|
+
seq: number;
|
|
303
|
+
/** When it was worked out. */
|
|
304
|
+
at: Date | null;
|
|
305
|
+
}
|
|
254
306
|
/**
|
|
255
307
|
* The legal values for one dimension of a market: a range, and a step.
|
|
256
308
|
*
|
|
@@ -405,6 +457,12 @@ export interface Order {
|
|
|
405
457
|
mine: boolean | null;
|
|
406
458
|
/** The session the order was first placed in, when carried into a later one; null when not said. */
|
|
407
459
|
originalSessionId: number | null;
|
|
460
|
+
/**
|
|
461
|
+
* The id the submitting client named the order with, as fm-server keeps it
|
|
462
|
+
* on the order: what ties an order arriving on the stream to the one a
|
|
463
|
+
* client sent over the socket. Null for an order sent without one.
|
|
464
|
+
*/
|
|
465
|
+
submissionId: string | null;
|
|
408
466
|
}
|
|
409
467
|
/**
|
|
410
468
|
* The best human label a person record carries: the trimmed full name, or the
|
package/dist/types.js
CHANGED
|
@@ -35,6 +35,8 @@ export function holdingUnits(holding) {
|
|
|
35
35
|
}
|
|
36
36
|
export const MARKET_MECHANISM_CONTINUOUS = "CONTINUOUS";
|
|
37
37
|
export const MARKET_MECHANISM_CALL = "CALL";
|
|
38
|
+
export const MARKET_CALL_BOOK_SEALED = "SEALED";
|
|
39
|
+
export const MARKET_CALL_BOOK_INDICATIVE = "INDICATIVE";
|
|
38
40
|
/**
|
|
39
41
|
* Whether `market` is a call auction, where a crossing order rests until a
|
|
40
42
|
* call rather than trading, and a participant sees only their own resting
|
|
@@ -43,6 +45,14 @@ export const MARKET_MECHANISM_CALL = "CALL";
|
|
|
43
45
|
export function isCall(market) {
|
|
44
46
|
return market.mechanism === MARKET_MECHANISM_CALL;
|
|
45
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Whether `market` is a call market that publishes the price its book would
|
|
50
|
+
* clear at now: `indicative()` reads it, and the stream delivers each change
|
|
51
|
+
* as a {@link CallIndicative}.
|
|
52
|
+
*/
|
|
53
|
+
export function showsIndicative(market) {
|
|
54
|
+
return isCall(market) && market.callBook === MARKET_CALL_BOOK_INDICATIVE;
|
|
55
|
+
}
|
|
46
56
|
export const MARKET_CALL_TRIGGER_MANUAL = "MANUAL";
|
|
47
57
|
export const MARKET_CALL_TRIGGER_INTERVAL = "INTERVAL";
|
|
48
58
|
/**
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAoKzC;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,OAAgB,EAAE,QAAgB;IAC5D,OAAO,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,IAAI,IAAI,CAAC;AACzE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAAyC;IACzE,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;AACzE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,OAAgB;IACzC,OAAO,OAAO,CAAC,QAAQ,KAAK,IAAI,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,OAAgB;IAC3C,OAAO,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAChD,CAAC;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAElC,OAAO,EAAE,QA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,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5D,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,WAAW,CAAC,KAAgC;IAC1D,MAAM,KAAK,GAAG,KAAK,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC1C,OAAO,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAChE,CAAC;AA0CD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc;IACxC,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;IAC3F,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC;IACtB,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC1C,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAC9B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flexemarkets/fm-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Flexemarkets TypeScript SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"ticker": "tsx src/ticker.ts",
|
|
20
20
|
"build": "tsc",
|
|
21
21
|
"check": "tsc --noEmit",
|
|
22
|
-
"test": "node --enable-source-maps --import tsx --import ./test/isolated-home.ts --test --experimental-test-coverage --test-coverage-include=src/client.ts --test-coverage-include=src/decimals.ts --test-coverage-include=src/desk.ts --test-coverage-include=src/stomp.ts --test-coverage-include=src/order-utils.ts --test-coverage-include=src/orderbook.ts --test-coverage-include=src/trades.ts --test-coverage-lines=99 test/*.test.ts",
|
|
22
|
+
"test": "node --enable-source-maps --import tsx --import ./test/isolated-home.ts --test --experimental-test-coverage --test-coverage-include=src/client.ts --test-coverage-include=src/decimals.ts --test-coverage-include=src/desk.ts --test-coverage-include=src/stomp.ts --test-coverage-include=src/order-stream.ts --test-coverage-include=src/order-utils.ts --test-coverage-include=src/orderbook.ts --test-coverage-include=src/trades.ts --test-coverage-lines=99 test/*.test.ts",
|
|
23
23
|
"prepublishOnly": "npm run build"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [
|