bybit-api 3.8.0 → 3.8.1
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.
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
import { CategoryV5, OCOTriggerTypeV5, OrderRejectReasonV5, OrderSMPTypeV5, OrderSideV5, OrderStatusV5, OrderTimeInForceV5, OrderTriggerByV5, OrderTypeV5, StopOrderTypeV5, TPSLModeV5 } from './v5-shared';
|
|
2
2
|
import { WsKey } from './websockets';
|
|
3
|
+
export interface WSOrderbookEventV5 {
|
|
4
|
+
topic: string;
|
|
5
|
+
/** Event timestamp */
|
|
6
|
+
ts: number;
|
|
7
|
+
type: 'delta' | 'snapshot';
|
|
8
|
+
data: {
|
|
9
|
+
/** Symbol */
|
|
10
|
+
s: string;
|
|
11
|
+
/** [price, qty][] */
|
|
12
|
+
b: [string, string][];
|
|
13
|
+
/** [price, qty][] */
|
|
14
|
+
a: [string, string][];
|
|
15
|
+
/** Update ID */
|
|
16
|
+
u: number;
|
|
17
|
+
/**
|
|
18
|
+
* Cross sequence
|
|
19
|
+
*/
|
|
20
|
+
seq: number;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* matching engine timestamp (correlated with T from public trade channel)
|
|
24
|
+
*/
|
|
25
|
+
cts: number;
|
|
26
|
+
/**
|
|
27
|
+
* Internal reference, can be used to determine if this is spot/linear/inverse/etc
|
|
28
|
+
*/
|
|
29
|
+
wsKey: WsKey;
|
|
30
|
+
}
|
|
3
31
|
export interface WSAccountOrderV5 {
|
|
4
32
|
qty: string;
|
|
5
33
|
price: string;
|
package/lib/util/index.d.ts
CHANGED
package/lib/util/index.js
CHANGED
|
@@ -11,8 +11,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./BaseRestClient"), exports);
|
|
14
|
-
__exportStar(require("./requestUtils"), exports);
|
|
15
|
-
__exportStar(require("./WsStore"), exports);
|
|
16
14
|
__exportStar(require("./logger"), exports);
|
|
15
|
+
__exportStar(require("./requestUtils"), exports);
|
|
16
|
+
__exportStar(require("./typeGuards"), exports);
|
|
17
17
|
__exportStar(require("./websocket-util"), exports);
|
|
18
|
+
__exportStar(require("./WsStore"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
package/lib/util/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAAiC;AACjC,iDAA+B;AAC/B
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAAiC;AACjC,2CAAyB;AACzB,iDAA+B;AAC/B,+CAA6B;AAC7B,mDAAiC;AACjC,4CAA0B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Use type guards to narrow down types with minimal efforts.
|
|
3
|
+
*/
|
|
4
|
+
import { WSOrderbookEventV5 } from '../types/websocket.events';
|
|
5
|
+
/**
|
|
6
|
+
* Type guard to detect a V5 orderbook event (delta & snapshots)
|
|
7
|
+
*
|
|
8
|
+
* @param event
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
export declare function isWsOrderbookEventV5(event: unknown): event is WSOrderbookEventV5;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Use type guards to narrow down types with minimal efforts.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isWsOrderbookEventV5 = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Type guard to detect a V5 orderbook event (delta & snapshots)
|
|
9
|
+
*
|
|
10
|
+
* @param event
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
function isWsOrderbookEventV5(event) {
|
|
14
|
+
if (typeof event !== 'object' ||
|
|
15
|
+
!event ||
|
|
16
|
+
typeof event['topic'] !== 'string' ||
|
|
17
|
+
typeof event['type'] !== 'string') {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
return (['delta', 'snapshot'].includes(event['type']) &&
|
|
21
|
+
event['topic'].startsWith('orderbook'));
|
|
22
|
+
}
|
|
23
|
+
exports.isWsOrderbookEventV5 = isWsOrderbookEventV5;
|
|
24
|
+
//# sourceMappingURL=typeGuards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeGuards.js","sourceRoot":"","sources":["../../src/util/typeGuards.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAIH;;;;;GAKG;AACH,SAAgB,oBAAoB,CAClC,KAAc;IAEd,IACE,OAAO,KAAK,KAAK,QAAQ;QACzB,CAAC,KAAK;QACN,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,QAAQ;QAClC,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,QAAQ,EACjC;QACA,OAAO,KAAK,CAAC;KACd;IAED,OAAO,CACL,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC7C,KAAK,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,CACvC,CAAC;AACJ,CAAC;AAhBD,oDAgBC"}
|
package/package.json
CHANGED