only default to all markets if neither env vars are specified
This commit is contained in:
@@ -99,9 +99,22 @@ const getMarketsAndOraclesToLoad = (
|
|||||||
const perpMarketInfos: wsMarketInfo[] = [];
|
const perpMarketInfos: wsMarketInfo[] = [];
|
||||||
const spotMarketInfos: wsMarketInfo[] = [];
|
const spotMarketInfos: wsMarketInfo[] = [];
|
||||||
|
|
||||||
const perpIndexes = PERP_MARKETS_TO_LOAD
|
// only watch all markets if neither env vars are specified
|
||||||
? PERP_MARKETS_TO_LOAD
|
const noMarketsSpecified = !PERP_MARKETS_TO_LOAD && !SPOT_MARKETS_TO_LOAD;
|
||||||
: sdkConfig.PERP_MARKETS.map((m) => m.marketIndex);
|
|
||||||
|
let perpIndexes = PERP_MARKETS_TO_LOAD;
|
||||||
|
if (!perpIndexes && noMarketsSpecified) {
|
||||||
|
perpIndexes = sdkConfig.PERP_MARKETS.map((m) => m.marketIndex);
|
||||||
|
} else {
|
||||||
|
perpIndexes = [];
|
||||||
|
}
|
||||||
|
let spotIndexes = SPOT_MARKETS_TO_LOAD;
|
||||||
|
if (!spotIndexes && noMarketsSpecified) {
|
||||||
|
spotIndexes = sdkConfig.SPOT_MARKETS.map((m) => m.marketIndex);
|
||||||
|
} else {
|
||||||
|
spotIndexes = [];
|
||||||
|
}
|
||||||
|
|
||||||
if (perpIndexes.length > 0) {
|
if (perpIndexes.length > 0) {
|
||||||
for (const idx of perpIndexes) {
|
for (const idx of perpIndexes) {
|
||||||
const perpMarketConfig = sdkConfig.PERP_MARKETS[idx] as PerpMarketConfig;
|
const perpMarketConfig = sdkConfig.PERP_MARKETS[idx] as PerpMarketConfig;
|
||||||
@@ -127,9 +140,6 @@ const getMarketsAndOraclesToLoad = (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const spotIndexes = SPOT_MARKETS_TO_LOAD
|
|
||||||
? SPOT_MARKETS_TO_LOAD
|
|
||||||
: sdkConfig.SPOT_MARKETS.map((m) => m.marketIndex);
|
|
||||||
if (spotIndexes.length > 0) {
|
if (spotIndexes.length > 0) {
|
||||||
for (const idx of spotIndexes) {
|
for (const idx of spotIndexes) {
|
||||||
const spotMarketConfig = sdkConfig.SPOT_MARKETS[idx] as SpotMarketConfig;
|
const spotMarketConfig = sdkConfig.SPOT_MARKETS[idx] as SpotMarketConfig;
|
||||||
|
|||||||
Reference in New Issue
Block a user