@ignex/nova 0.1.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.
Files changed (74) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +313 -0
  3. package/docs/architecture.md +146 -0
  4. package/docs/publishing.md +119 -0
  5. package/docs/wire-format.md +170 -0
  6. package/index.ts +61 -0
  7. package/package.json +89 -0
  8. package/prebuilds/linux-x64/libignex_ffi.so +0 -0
  9. package/public/client.ts +23 -0
  10. package/public/nats.ts +19 -0
  11. package/public/server.ts +35 -0
  12. package/rust/Cargo.toml +19 -0
  13. package/rust/src/ffi.rs +135 -0
  14. package/rust/src/generated/backend.rs +2817 -0
  15. package/rust/src/generated/mod.rs +2 -0
  16. package/rust/src/lib.rs +9 -0
  17. package/rust/src/transcode/generated.rs +1352 -0
  18. package/rust/src/transcode/mod.rs +2 -0
  19. package/src/bridge/nats.ts +269 -0
  20. package/src/bridge/subjects.ts +30 -0
  21. package/src/core/auth.ts +56 -0
  22. package/src/core/backpressure.ts +39 -0
  23. package/src/core/client-heartbeat.ts +27 -0
  24. package/src/core/client-reconnect.ts +35 -0
  25. package/src/core/client-state.ts +76 -0
  26. package/src/core/client-wire.ts +72 -0
  27. package/src/core/client.ts +176 -0
  28. package/src/core/groups.ts +52 -0
  29. package/src/core/int64-guard.ts +44 -0
  30. package/src/core/metrics.ts +105 -0
  31. package/src/core/outbound.ts +76 -0
  32. package/src/core/replay.ts +31 -0
  33. package/src/core/ring.ts +85 -0
  34. package/src/core/rooms.ts +44 -0
  35. package/src/core/routing.ts +94 -0
  36. package/src/core/server.ts +294 -0
  37. package/src/core/state.ts +179 -0
  38. package/src/generated/direct-ser.ts +495 -0
  39. package/src/generated/fbs/backend.fbs +139 -0
  40. package/src/generated/registry.ts +341 -0
  41. package/src/generated/rust/backend_generated.rs +2817 -0
  42. package/src/generated/ts/backend.ts +25 -0
  43. package/src/generated/ts/big-val.ts +106 -0
  44. package/src/generated/ts/complex.ts +303 -0
  45. package/src/generated/ts/customer.ts +137 -0
  46. package/src/generated/ts/hello.ts +123 -0
  47. package/src/generated/ts/join-group.ts +78 -0
  48. package/src/generated/ts/leave-group.ts +78 -0
  49. package/src/generated/ts/order-billing.ts +137 -0
  50. package/src/generated/ts/order-line.ts +144 -0
  51. package/src/generated/ts/order.ts +236 -0
  52. package/src/generated/ts/ping.ts +74 -0
  53. package/src/generated/ts/pong.ts +74 -0
  54. package/src/generated/ts/portfolio-position.ts +120 -0
  55. package/src/generated/ts/portfolio-snapshot.ts +170 -0
  56. package/src/generated/ts/quote.ts +148 -0
  57. package/src/generated/ts/side.ts +8 -0
  58. package/src/generated/ts/snapshot-request.ts +78 -0
  59. package/src/generated/ts/subscribe.ts +78 -0
  60. package/src/generated/ts/tags.ts +9 -0
  61. package/src/generated/ts/trade.ts +135 -0
  62. package/src/generated/ts/unsubscribe.ts +78 -0
  63. package/src/generated/ts/welcome.ts +112 -0
  64. package/src/generated/ts-ser.ts +465 -0
  65. package/src/generated/wire-registry.json +20 -0
  66. package/src/native/codec.ts +35 -0
  67. package/src/native/ffi.ts +214 -0
  68. package/src/native/loader.ts +55 -0
  69. package/src/schema/index.ts +217 -0
  70. package/src/server.ts +87 -0
  71. package/src/transport/byte-buffer-pool.ts +63 -0
  72. package/src/transport/scratch.ts +48 -0
  73. package/src/transport/stats.ts +44 -0
  74. package/src/transport/transport.ts +106 -0
@@ -0,0 +1,74 @@
1
+ // automatically generated by the FlatBuffers compiler, do not modify
2
+
3
+ /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4
+
5
+ import * as flatbuffers from 'flatbuffers';
6
+
7
+
8
+
9
+ export class Ping implements flatbuffers.IUnpackableObject<PingT> {
10
+ bb: flatbuffers.ByteBuffer|null = null;
11
+ bb_pos = 0;
12
+ __init(i:number, bb:flatbuffers.ByteBuffer):Ping {
13
+ this.bb_pos = i;
14
+ this.bb = bb;
15
+ return this;
16
+ }
17
+
18
+ static getRootAsPing(bb:flatbuffers.ByteBuffer, obj?:Ping):Ping {
19
+ return (obj || new Ping()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
20
+ }
21
+
22
+ static getSizePrefixedRootAsPing(bb:flatbuffers.ByteBuffer, obj?:Ping):Ping {
23
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
24
+ return (obj || new Ping()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
25
+ }
26
+
27
+ ts():bigint {
28
+ const offset = this.bb!.__offset(this.bb_pos, 4);
29
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
30
+ }
31
+
32
+ static startPing(builder:flatbuffers.Builder) {
33
+ builder.startObject(1);
34
+ }
35
+
36
+ static addTs(builder:flatbuffers.Builder, ts:bigint) {
37
+ builder.addFieldInt64(0, ts, BigInt('0'));
38
+ }
39
+
40
+ static endPing(builder:flatbuffers.Builder):flatbuffers.Offset {
41
+ const offset = builder.endObject();
42
+ return offset;
43
+ }
44
+
45
+ static createPing(builder:flatbuffers.Builder, ts:bigint):flatbuffers.Offset {
46
+ Ping.startPing(builder);
47
+ Ping.addTs(builder, ts);
48
+ return Ping.endPing(builder);
49
+ }
50
+
51
+ unpack(): PingT {
52
+ return new PingT(
53
+ this.ts()
54
+ );
55
+ }
56
+
57
+
58
+ unpackTo(_o: PingT): void {
59
+ _o.ts = this.ts();
60
+ }
61
+ }
62
+
63
+ export class PingT implements flatbuffers.IGeneratedObject {
64
+ constructor(
65
+ public ts: bigint = BigInt('0')
66
+ ){}
67
+
68
+
69
+ pack(builder:flatbuffers.Builder): flatbuffers.Offset {
70
+ return Ping.createPing(builder,
71
+ this.ts
72
+ );
73
+ }
74
+ }
@@ -0,0 +1,74 @@
1
+ // automatically generated by the FlatBuffers compiler, do not modify
2
+
3
+ /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4
+
5
+ import * as flatbuffers from 'flatbuffers';
6
+
7
+
8
+
9
+ export class Pong implements flatbuffers.IUnpackableObject<PongT> {
10
+ bb: flatbuffers.ByteBuffer|null = null;
11
+ bb_pos = 0;
12
+ __init(i:number, bb:flatbuffers.ByteBuffer):Pong {
13
+ this.bb_pos = i;
14
+ this.bb = bb;
15
+ return this;
16
+ }
17
+
18
+ static getRootAsPong(bb:flatbuffers.ByteBuffer, obj?:Pong):Pong {
19
+ return (obj || new Pong()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
20
+ }
21
+
22
+ static getSizePrefixedRootAsPong(bb:flatbuffers.ByteBuffer, obj?:Pong):Pong {
23
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
24
+ return (obj || new Pong()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
25
+ }
26
+
27
+ ts():bigint {
28
+ const offset = this.bb!.__offset(this.bb_pos, 4);
29
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
30
+ }
31
+
32
+ static startPong(builder:flatbuffers.Builder) {
33
+ builder.startObject(1);
34
+ }
35
+
36
+ static addTs(builder:flatbuffers.Builder, ts:bigint) {
37
+ builder.addFieldInt64(0, ts, BigInt('0'));
38
+ }
39
+
40
+ static endPong(builder:flatbuffers.Builder):flatbuffers.Offset {
41
+ const offset = builder.endObject();
42
+ return offset;
43
+ }
44
+
45
+ static createPong(builder:flatbuffers.Builder, ts:bigint):flatbuffers.Offset {
46
+ Pong.startPong(builder);
47
+ Pong.addTs(builder, ts);
48
+ return Pong.endPong(builder);
49
+ }
50
+
51
+ unpack(): PongT {
52
+ return new PongT(
53
+ this.ts()
54
+ );
55
+ }
56
+
57
+
58
+ unpackTo(_o: PongT): void {
59
+ _o.ts = this.ts();
60
+ }
61
+ }
62
+
63
+ export class PongT implements flatbuffers.IGeneratedObject {
64
+ constructor(
65
+ public ts: bigint = BigInt('0')
66
+ ){}
67
+
68
+
69
+ pack(builder:flatbuffers.Builder): flatbuffers.Offset {
70
+ return Pong.createPong(builder,
71
+ this.ts
72
+ );
73
+ }
74
+ }
@@ -0,0 +1,120 @@
1
+ // automatically generated by the FlatBuffers compiler, do not modify
2
+
3
+ /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4
+
5
+ import * as flatbuffers from 'flatbuffers';
6
+
7
+
8
+
9
+ export class PortfolioPosition implements flatbuffers.IUnpackableObject<PortfolioPositionT> {
10
+ bb: flatbuffers.ByteBuffer|null = null;
11
+ bb_pos = 0;
12
+ __init(i:number, bb:flatbuffers.ByteBuffer):PortfolioPosition {
13
+ this.bb_pos = i;
14
+ this.bb = bb;
15
+ return this;
16
+ }
17
+
18
+ static getRootAsPortfolioPosition(bb:flatbuffers.ByteBuffer, obj?:PortfolioPosition):PortfolioPosition {
19
+ return (obj || new PortfolioPosition()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
20
+ }
21
+
22
+ static getSizePrefixedRootAsPortfolioPosition(bb:flatbuffers.ByteBuffer, obj?:PortfolioPosition):PortfolioPosition {
23
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
24
+ return (obj || new PortfolioPosition()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
25
+ }
26
+
27
+ symbol():string|null
28
+ symbol(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
29
+ symbol(optionalEncoding?:any):string|Uint8Array|null {
30
+ const offset = this.bb!.__offset(this.bb_pos, 4);
31
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
32
+ }
33
+
34
+ quantity():bigint {
35
+ const offset = this.bb!.__offset(this.bb_pos, 6);
36
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
37
+ }
38
+
39
+ avgPrice():number {
40
+ const offset = this.bb!.__offset(this.bb_pos, 8);
41
+ return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
42
+ }
43
+
44
+ pnl():number {
45
+ const offset = this.bb!.__offset(this.bb_pos, 10);
46
+ return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
47
+ }
48
+
49
+ static startPortfolioPosition(builder:flatbuffers.Builder) {
50
+ builder.startObject(4);
51
+ }
52
+
53
+ static addSymbol(builder:flatbuffers.Builder, symbolOffset:flatbuffers.Offset) {
54
+ builder.addFieldOffset(0, symbolOffset, 0);
55
+ }
56
+
57
+ static addQuantity(builder:flatbuffers.Builder, quantity:bigint) {
58
+ builder.addFieldInt64(1, quantity, BigInt('0'));
59
+ }
60
+
61
+ static addAvgPrice(builder:flatbuffers.Builder, avgPrice:number) {
62
+ builder.addFieldFloat64(2, avgPrice, 0.0);
63
+ }
64
+
65
+ static addPnl(builder:flatbuffers.Builder, pnl:number) {
66
+ builder.addFieldFloat64(3, pnl, 0.0);
67
+ }
68
+
69
+ static endPortfolioPosition(builder:flatbuffers.Builder):flatbuffers.Offset {
70
+ const offset = builder.endObject();
71
+ return offset;
72
+ }
73
+
74
+ static createPortfolioPosition(builder:flatbuffers.Builder, symbolOffset:flatbuffers.Offset, quantity:bigint, avgPrice:number, pnl:number):flatbuffers.Offset {
75
+ PortfolioPosition.startPortfolioPosition(builder);
76
+ PortfolioPosition.addSymbol(builder, symbolOffset);
77
+ PortfolioPosition.addQuantity(builder, quantity);
78
+ PortfolioPosition.addAvgPrice(builder, avgPrice);
79
+ PortfolioPosition.addPnl(builder, pnl);
80
+ return PortfolioPosition.endPortfolioPosition(builder);
81
+ }
82
+
83
+ unpack(): PortfolioPositionT {
84
+ return new PortfolioPositionT(
85
+ this.symbol(),
86
+ this.quantity(),
87
+ this.avgPrice(),
88
+ this.pnl()
89
+ );
90
+ }
91
+
92
+
93
+ unpackTo(_o: PortfolioPositionT): void {
94
+ _o.symbol = this.symbol();
95
+ _o.quantity = this.quantity();
96
+ _o.avgPrice = this.avgPrice();
97
+ _o.pnl = this.pnl();
98
+ }
99
+ }
100
+
101
+ export class PortfolioPositionT implements flatbuffers.IGeneratedObject {
102
+ constructor(
103
+ public symbol: string|Uint8Array|null = null,
104
+ public quantity: bigint = BigInt('0'),
105
+ public avgPrice: number = 0.0,
106
+ public pnl: number = 0.0
107
+ ){}
108
+
109
+
110
+ pack(builder:flatbuffers.Builder): flatbuffers.Offset {
111
+ const symbol = (this.symbol !== null ? builder.createString(this.symbol!) : 0);
112
+
113
+ return PortfolioPosition.createPortfolioPosition(builder,
114
+ symbol,
115
+ this.quantity,
116
+ this.avgPrice,
117
+ this.pnl
118
+ );
119
+ }
120
+ }
@@ -0,0 +1,170 @@
1
+ // automatically generated by the FlatBuffers compiler, do not modify
2
+
3
+ /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4
+
5
+ import * as flatbuffers from 'flatbuffers';
6
+
7
+ import { PortfolioPosition, PortfolioPositionT } from './portfolio-position.js';
8
+
9
+
10
+ export class PortfolioSnapshot implements flatbuffers.IUnpackableObject<PortfolioSnapshotT> {
11
+ bb: flatbuffers.ByteBuffer|null = null;
12
+ bb_pos = 0;
13
+ __init(i:number, bb:flatbuffers.ByteBuffer):PortfolioSnapshot {
14
+ this.bb_pos = i;
15
+ this.bb = bb;
16
+ return this;
17
+ }
18
+
19
+ static getRootAsPortfolioSnapshot(bb:flatbuffers.ByteBuffer, obj?:PortfolioSnapshot):PortfolioSnapshot {
20
+ return (obj || new PortfolioSnapshot()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
21
+ }
22
+
23
+ static getSizePrefixedRootAsPortfolioSnapshot(bb:flatbuffers.ByteBuffer, obj?:PortfolioSnapshot):PortfolioSnapshot {
24
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
25
+ return (obj || new PortfolioSnapshot()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
26
+ }
27
+
28
+ accountId():string|null
29
+ accountId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
30
+ accountId(optionalEncoding?:any):string|Uint8Array|null {
31
+ const offset = this.bb!.__offset(this.bb_pos, 4);
32
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
33
+ }
34
+
35
+ positions(index: number, obj?:PortfolioPosition):PortfolioPosition|null {
36
+ const offset = this.bb!.__offset(this.bb_pos, 6);
37
+ return offset ? (obj || new PortfolioPosition()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
38
+ }
39
+
40
+ positionsLength():number {
41
+ const offset = this.bb!.__offset(this.bb_pos, 6);
42
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
43
+ }
44
+
45
+ totalValue():number {
46
+ const offset = this.bb!.__offset(this.bb_pos, 8);
47
+ return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
48
+ }
49
+
50
+ cash():number {
51
+ const offset = this.bb!.__offset(this.bb_pos, 10);
52
+ return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
53
+ }
54
+
55
+ ts():bigint {
56
+ const offset = this.bb!.__offset(this.bb_pos, 12);
57
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
58
+ }
59
+
60
+ updatedBy():string|null
61
+ updatedBy(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
62
+ updatedBy(optionalEncoding?:any):string|Uint8Array|null {
63
+ const offset = this.bb!.__offset(this.bb_pos, 14);
64
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
65
+ }
66
+
67
+ static startPortfolioSnapshot(builder:flatbuffers.Builder) {
68
+ builder.startObject(6);
69
+ }
70
+
71
+ static addAccountId(builder:flatbuffers.Builder, accountIdOffset:flatbuffers.Offset) {
72
+ builder.addFieldOffset(0, accountIdOffset, 0);
73
+ }
74
+
75
+ static addPositions(builder:flatbuffers.Builder, positionsOffset:flatbuffers.Offset) {
76
+ builder.addFieldOffset(1, positionsOffset, 0);
77
+ }
78
+
79
+ static createPositionsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
80
+ builder.startVector(4, data.length, 4);
81
+ for (let i = data.length - 1; i >= 0; i--) {
82
+ builder.addOffset(data[i]!);
83
+ }
84
+ return builder.endVector();
85
+ }
86
+
87
+ static startPositionsVector(builder:flatbuffers.Builder, numElems:number) {
88
+ builder.startVector(4, numElems, 4);
89
+ }
90
+
91
+ static addTotalValue(builder:flatbuffers.Builder, totalValue:number) {
92
+ builder.addFieldFloat64(2, totalValue, 0.0);
93
+ }
94
+
95
+ static addCash(builder:flatbuffers.Builder, cash:number) {
96
+ builder.addFieldFloat64(3, cash, 0.0);
97
+ }
98
+
99
+ static addTs(builder:flatbuffers.Builder, ts:bigint) {
100
+ builder.addFieldInt64(4, ts, BigInt('0'));
101
+ }
102
+
103
+ static addUpdatedBy(builder:flatbuffers.Builder, updatedByOffset:flatbuffers.Offset) {
104
+ builder.addFieldOffset(5, updatedByOffset, 0);
105
+ }
106
+
107
+ static endPortfolioSnapshot(builder:flatbuffers.Builder):flatbuffers.Offset {
108
+ const offset = builder.endObject();
109
+ return offset;
110
+ }
111
+
112
+ static createPortfolioSnapshot(builder:flatbuffers.Builder, accountIdOffset:flatbuffers.Offset, positionsOffset:flatbuffers.Offset, totalValue:number, cash:number, ts:bigint, updatedByOffset:flatbuffers.Offset):flatbuffers.Offset {
113
+ PortfolioSnapshot.startPortfolioSnapshot(builder);
114
+ PortfolioSnapshot.addAccountId(builder, accountIdOffset);
115
+ PortfolioSnapshot.addPositions(builder, positionsOffset);
116
+ PortfolioSnapshot.addTotalValue(builder, totalValue);
117
+ PortfolioSnapshot.addCash(builder, cash);
118
+ PortfolioSnapshot.addTs(builder, ts);
119
+ PortfolioSnapshot.addUpdatedBy(builder, updatedByOffset);
120
+ return PortfolioSnapshot.endPortfolioSnapshot(builder);
121
+ }
122
+
123
+ unpack(): PortfolioSnapshotT {
124
+ return new PortfolioSnapshotT(
125
+ this.accountId(),
126
+ this.bb!.createObjList<PortfolioPosition, PortfolioPositionT>(this.positions.bind(this), this.positionsLength()),
127
+ this.totalValue(),
128
+ this.cash(),
129
+ this.ts(),
130
+ this.updatedBy()
131
+ );
132
+ }
133
+
134
+
135
+ unpackTo(_o: PortfolioSnapshotT): void {
136
+ _o.accountId = this.accountId();
137
+ _o.positions = this.bb!.createObjList<PortfolioPosition, PortfolioPositionT>(this.positions.bind(this), this.positionsLength());
138
+ _o.totalValue = this.totalValue();
139
+ _o.cash = this.cash();
140
+ _o.ts = this.ts();
141
+ _o.updatedBy = this.updatedBy();
142
+ }
143
+ }
144
+
145
+ export class PortfolioSnapshotT implements flatbuffers.IGeneratedObject {
146
+ constructor(
147
+ public accountId: string|Uint8Array|null = null,
148
+ public positions: (PortfolioPositionT)[] = [],
149
+ public totalValue: number = 0.0,
150
+ public cash: number = 0.0,
151
+ public ts: bigint = BigInt('0'),
152
+ public updatedBy: string|Uint8Array|null = null
153
+ ){}
154
+
155
+
156
+ pack(builder:flatbuffers.Builder): flatbuffers.Offset {
157
+ const accountId = (this.accountId !== null ? builder.createString(this.accountId!) : 0);
158
+ const positions = PortfolioSnapshot.createPositionsVector(builder, builder.createObjectOffsetList(this.positions));
159
+ const updatedBy = (this.updatedBy !== null ? builder.createString(this.updatedBy!) : 0);
160
+
161
+ return PortfolioSnapshot.createPortfolioSnapshot(builder,
162
+ accountId,
163
+ positions,
164
+ this.totalValue,
165
+ this.cash,
166
+ this.ts,
167
+ updatedBy
168
+ );
169
+ }
170
+ }
@@ -0,0 +1,148 @@
1
+ // automatically generated by the FlatBuffers compiler, do not modify
2
+
3
+ /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4
+
5
+ import * as flatbuffers from 'flatbuffers';
6
+
7
+
8
+
9
+ export class Quote implements flatbuffers.IUnpackableObject<QuoteT> {
10
+ bb: flatbuffers.ByteBuffer|null = null;
11
+ bb_pos = 0;
12
+ __init(i:number, bb:flatbuffers.ByteBuffer):Quote {
13
+ this.bb_pos = i;
14
+ this.bb = bb;
15
+ return this;
16
+ }
17
+
18
+ static getRootAsQuote(bb:flatbuffers.ByteBuffer, obj?:Quote):Quote {
19
+ return (obj || new Quote()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
20
+ }
21
+
22
+ static getSizePrefixedRootAsQuote(bb:flatbuffers.ByteBuffer, obj?:Quote):Quote {
23
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
24
+ return (obj || new Quote()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
25
+ }
26
+
27
+ symbol():string|null
28
+ symbol(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
29
+ symbol(optionalEncoding?:any):string|Uint8Array|null {
30
+ const offset = this.bb!.__offset(this.bb_pos, 4);
31
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
32
+ }
33
+
34
+ bid():number {
35
+ const offset = this.bb!.__offset(this.bb_pos, 6);
36
+ return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
37
+ }
38
+
39
+ ask():number {
40
+ const offset = this.bb!.__offset(this.bb_pos, 8);
41
+ return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
42
+ }
43
+
44
+ bidSize():bigint {
45
+ const offset = this.bb!.__offset(this.bb_pos, 10);
46
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
47
+ }
48
+
49
+ askSize():bigint {
50
+ const offset = this.bb!.__offset(this.bb_pos, 12);
51
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
52
+ }
53
+
54
+ ts():bigint {
55
+ const offset = this.bb!.__offset(this.bb_pos, 14);
56
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
57
+ }
58
+
59
+ static startQuote(builder:flatbuffers.Builder) {
60
+ builder.startObject(6);
61
+ }
62
+
63
+ static addSymbol(builder:flatbuffers.Builder, symbolOffset:flatbuffers.Offset) {
64
+ builder.addFieldOffset(0, symbolOffset, 0);
65
+ }
66
+
67
+ static addBid(builder:flatbuffers.Builder, bid:number) {
68
+ builder.addFieldFloat64(1, bid, 0.0);
69
+ }
70
+
71
+ static addAsk(builder:flatbuffers.Builder, ask:number) {
72
+ builder.addFieldFloat64(2, ask, 0.0);
73
+ }
74
+
75
+ static addBidSize(builder:flatbuffers.Builder, bidSize:bigint) {
76
+ builder.addFieldInt64(3, bidSize, BigInt('0'));
77
+ }
78
+
79
+ static addAskSize(builder:flatbuffers.Builder, askSize:bigint) {
80
+ builder.addFieldInt64(4, askSize, BigInt('0'));
81
+ }
82
+
83
+ static addTs(builder:flatbuffers.Builder, ts:bigint) {
84
+ builder.addFieldInt64(5, ts, BigInt('0'));
85
+ }
86
+
87
+ static endQuote(builder:flatbuffers.Builder):flatbuffers.Offset {
88
+ const offset = builder.endObject();
89
+ return offset;
90
+ }
91
+
92
+ static createQuote(builder:flatbuffers.Builder, symbolOffset:flatbuffers.Offset, bid:number, ask:number, bidSize:bigint, askSize:bigint, ts:bigint):flatbuffers.Offset {
93
+ Quote.startQuote(builder);
94
+ Quote.addSymbol(builder, symbolOffset);
95
+ Quote.addBid(builder, bid);
96
+ Quote.addAsk(builder, ask);
97
+ Quote.addBidSize(builder, bidSize);
98
+ Quote.addAskSize(builder, askSize);
99
+ Quote.addTs(builder, ts);
100
+ return Quote.endQuote(builder);
101
+ }
102
+
103
+ unpack(): QuoteT {
104
+ return new QuoteT(
105
+ this.symbol(),
106
+ this.bid(),
107
+ this.ask(),
108
+ this.bidSize(),
109
+ this.askSize(),
110
+ this.ts()
111
+ );
112
+ }
113
+
114
+
115
+ unpackTo(_o: QuoteT): void {
116
+ _o.symbol = this.symbol();
117
+ _o.bid = this.bid();
118
+ _o.ask = this.ask();
119
+ _o.bidSize = this.bidSize();
120
+ _o.askSize = this.askSize();
121
+ _o.ts = this.ts();
122
+ }
123
+ }
124
+
125
+ export class QuoteT implements flatbuffers.IGeneratedObject {
126
+ constructor(
127
+ public symbol: string|Uint8Array|null = null,
128
+ public bid: number = 0.0,
129
+ public ask: number = 0.0,
130
+ public bidSize: bigint = BigInt('0'),
131
+ public askSize: bigint = BigInt('0'),
132
+ public ts: bigint = BigInt('0')
133
+ ){}
134
+
135
+
136
+ pack(builder:flatbuffers.Builder): flatbuffers.Offset {
137
+ const symbol = (this.symbol !== null ? builder.createString(this.symbol!) : 0);
138
+
139
+ return Quote.createQuote(builder,
140
+ symbol,
141
+ this.bid,
142
+ this.ask,
143
+ this.bidSize,
144
+ this.askSize,
145
+ this.ts
146
+ );
147
+ }
148
+ }
@@ -0,0 +1,8 @@
1
+ // automatically generated by the FlatBuffers compiler, do not modify
2
+
3
+ /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4
+
5
+ export enum Side {
6
+ BUY = 0,
7
+ SELL = 1
8
+ }
@@ -0,0 +1,78 @@
1
+ // automatically generated by the FlatBuffers compiler, do not modify
2
+
3
+ /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4
+
5
+ import * as flatbuffers from 'flatbuffers';
6
+
7
+
8
+
9
+ export class SnapshotRequest implements flatbuffers.IUnpackableObject<SnapshotRequestT> {
10
+ bb: flatbuffers.ByteBuffer|null = null;
11
+ bb_pos = 0;
12
+ __init(i:number, bb:flatbuffers.ByteBuffer):SnapshotRequest {
13
+ this.bb_pos = i;
14
+ this.bb = bb;
15
+ return this;
16
+ }
17
+
18
+ static getRootAsSnapshotRequest(bb:flatbuffers.ByteBuffer, obj?:SnapshotRequest):SnapshotRequest {
19
+ return (obj || new SnapshotRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
20
+ }
21
+
22
+ static getSizePrefixedRootAsSnapshotRequest(bb:flatbuffers.ByteBuffer, obj?:SnapshotRequest):SnapshotRequest {
23
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
24
+ return (obj || new SnapshotRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
25
+ }
26
+
27
+ topic():string|null
28
+ topic(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
29
+ topic(optionalEncoding?:any):string|Uint8Array|null {
30
+ const offset = this.bb!.__offset(this.bb_pos, 4);
31
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
32
+ }
33
+
34
+ static startSnapshotRequest(builder:flatbuffers.Builder) {
35
+ builder.startObject(1);
36
+ }
37
+
38
+ static addTopic(builder:flatbuffers.Builder, topicOffset:flatbuffers.Offset) {
39
+ builder.addFieldOffset(0, topicOffset, 0);
40
+ }
41
+
42
+ static endSnapshotRequest(builder:flatbuffers.Builder):flatbuffers.Offset {
43
+ const offset = builder.endObject();
44
+ return offset;
45
+ }
46
+
47
+ static createSnapshotRequest(builder:flatbuffers.Builder, topicOffset:flatbuffers.Offset):flatbuffers.Offset {
48
+ SnapshotRequest.startSnapshotRequest(builder);
49
+ SnapshotRequest.addTopic(builder, topicOffset);
50
+ return SnapshotRequest.endSnapshotRequest(builder);
51
+ }
52
+
53
+ unpack(): SnapshotRequestT {
54
+ return new SnapshotRequestT(
55
+ this.topic()
56
+ );
57
+ }
58
+
59
+
60
+ unpackTo(_o: SnapshotRequestT): void {
61
+ _o.topic = this.topic();
62
+ }
63
+ }
64
+
65
+ export class SnapshotRequestT implements flatbuffers.IGeneratedObject {
66
+ constructor(
67
+ public topic: string|Uint8Array|null = null
68
+ ){}
69
+
70
+
71
+ pack(builder:flatbuffers.Builder): flatbuffers.Offset {
72
+ const topic = (this.topic !== null ? builder.createString(this.topic!) : 0);
73
+
74
+ return SnapshotRequest.createSnapshotRequest(builder,
75
+ topic
76
+ );
77
+ }
78
+ }