Skip to content

Commit a1cafd5

Browse files
authored
Merge pull request #126 from stoqey/fix-md-only
fix(instrument.utils): enhance getSymbolKey to include exchange for crypto
2 parents edaa377 + b496bc3 commit a1cafd5

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/utils/instrument.utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ export const getSymbolKey = (contract: Contract | Instrument): string => {
55
if (!contract) {
66
return "";
77
}
8+
const isCrypto = contract?.secType === 'CRYPTO';
9+
const exchange = isCrypto && contract?.exchange ? `-${contract.exchange}` : "";
810
const lastTradeDate = contract?.lastTradeDate || contract?.lastTradeDateOrContractMonth;
9-
return `${contract.symbol}${!!contract?.secType? `-${contract.secType}` : ""}${!!lastTradeDate? `-${lastTradeDate}`: ''}`;
11+
return `${contract.symbol}${!!contract?.secType ? `-${contract.secType}` : ""}${!!lastTradeDate ? `-${lastTradeDate}` : ''}${exchange}`;
1012
};
1113

1214
export interface GetHistoricalData {

0 commit comments

Comments
 (0)