Skip to content

Commit

Permalink
update parameterized selector, remove toFixed
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredvu committed Jan 6, 2025
1 parent 2b5cd8e commit 5f4e02c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/abacus-ts/calculators/markets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ function calculateDerivedMarketDisplayItems(market: IndexerPerpetualMarketRespon
function calculateDerivedMarketCore(market: IndexerPerpetualMarketResponseObject) {
return {
effectiveInitialMarginFraction: getMarketEffectiveInitialMarginForMarket(market),
openInterestUSDC: MustBigNumber(market.openInterest)
.times(market.oraclePrice)
.toFixed(USD_DECIMALS),
openInterestUSDC: MustBigNumber(market.openInterest).times(market.oraclePrice).toNumber(),
percentChange24h: MustBigNumber(market.oraclePrice).isZero()
? null
: MustBigNumber(market.priceChange24H).div(market.oraclePrice).toNumber(),
Expand Down
7 changes: 5 additions & 2 deletions src/abacus-ts/selectors/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ export const selectAllAssetsInfo = createAppSelector([selectRawAssetsData], (ass
transformAssetsInfo(assets)
);

export const selectAssetInfo = (assetId: string) =>
createAppSelector([selectAllAssetsInfo], (assets) => assets?.[assetId]);
export const selectAssetInfo = () =>
createAppSelector(
[selectAllAssetsInfo, (_s, assetId: string) => assetId],
(assets, assetId) => assets?.[assetId]
);

export const selectCurrentMarketAssetInfo = createAppSelector(
[selectCurrentMarketInfo, selectAllAssetsInfo],
Expand Down
2 changes: 1 addition & 1 deletion src/abacus-ts/summaryTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type MarketInfo = IndexerPerpetualMarketResponseObject & {
displayableAsset: string;
displayableTicker: string;
effectiveInitialMarginFraction: BigNumber | null;
openInterestUSDC: string;
openInterestUSDC: number;
percentChange24h: number | null;
stepSizeDecimals: number;
tickSizeDecimals: number;
Expand Down

0 comments on commit 5f4e02c

Please sign in to comment.