Skip to content

Commit 1750d6e

Browse files
committed
feat: expose instruments map data
1 parent d78544f commit 1750d6e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/connection/listeners.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,16 @@ export class OpenFeedListeners {
123123
return this.onMessageWithMetadata(message, uniqueSymbols, def);
124124
};
125125

126+
public getInstrumentByMarketId = (marketId: Long): InstrumentDefinition | undefined => {
127+
const [definition] = this.instrumentByMarketId.get(marketId.toString()) ?? [undefined];
128+
return definition;
129+
};
130+
131+
public getSymbolsByMarketId = (marketId: Long): string[] => {
132+
const [, symbols] = this.instrumentByMarketId.get(marketId.toString()) ?? [undefined, undefined];
133+
return symbols?.map(([symbol]) => symbol) ?? [];
134+
};
135+
126136
/* eslint-disable class-methods-use-this */
127137
public onCleanup: () => void | Promise<void> = () => {};
128138
public onConnected: (connection: IOpenFeedConnection) => void | Promise<void> = () => {};

0 commit comments

Comments
 (0)