Skip to content

Commit

Permalink
Add missing fields to perpetual markets kafka update (#2539)
Browse files Browse the repository at this point in the history
Signed-off-by: Shrenuj Bansal <[email protected]>
  • Loading branch information
shrenujb authored Oct 25, 2024
1 parent 317a74e commit 15aa042
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ export interface TradingPerpetualMarketMessage {
volume24H?: string,
trades24H?: number,
nextFundingRate?: string,

// Derived fields
tickSize?: string,
stepSize?: string,
}

export type OraclePriceMarketMessageContentsMapping = {
Expand Down
10 changes: 10 additions & 0 deletions indexer/services/ender/src/helpers/kafka-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
PerpetualPositionFromDatabase,
PerpetualPositionSubaccountMessageContents,
PositionSide,
protocolTranslations,
SubaccountMessageContents,
SubaccountTable,
TradingMarketMessageContents,
Expand Down Expand Up @@ -328,6 +329,7 @@ export function generatePerpetualMarketMessage(
atomicResolution: perpetualMarket.atomicResolution,
subticksPerTick: perpetualMarket.subticksPerTick,
stepBaseQuantums: perpetualMarket.stepBaseQuantums,
marketType: perpetualMarket.marketType,
initialMarginFraction: helpers.ppmToString(Number(liquidityTier.initialMarginPpm)),
maintenanceMarginFraction: helpers.ppmToString(
helpers.getMaintenanceMarginPpm(
Expand All @@ -337,6 +339,14 @@ export function generatePerpetualMarketMessage(
),
openInterestLowerCap: liquidityTier.openInterestLowerCap,
openInterestUpperCap: liquidityTier.openInterestUpperCap,
tickSize: protocolTranslations.getTickSize(perpetualMarket),
stepSize: protocolTranslations.getStepSize(perpetualMarket),
priceChange24H: perpetualMarket.priceChange24H,
volume24H: perpetualMarket.volume24H,
trades24H: perpetualMarket.trades24H,
nextFundingRate: perpetualMarket.nextFundingRate,
openInterest: perpetualMarket.openInterest,
baseOpenInterest: perpetualMarket.baseOpenInterest,
};
})
.value();
Expand Down

0 comments on commit 15aa042

Please sign in to comment.