Skip to content

Commit

Permalink
feat: add max funding rate to perp market objects (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasmatt authored Sep 13, 2023
1 parent 3bb4cb3 commit 9375f67
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
1 change: 1 addition & 0 deletions packages/indexer-nibi/src/defaultObjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const defaultUser = defaultActor
export const defaultPerpMarket = {
base_reserve: 0,
ecosystem_fund_fee_ratio: 0,
max_funding_rate: 0,
enabled: true,
exchange_fee_ratio: 0,
funding_rate_epoch_id: "",
Expand Down
18 changes: 12 additions & 6 deletions packages/indexer-nibi/src/gql/generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ export type MarkPriceCandlesFilter = {

export enum MarkPriceCandlesOrder {
Period = "period",
PeriodStartTs = "periodStartTs",
PeriodStartTs = "period_start_ts",
}

export type PeriodFilter = {
Expand All @@ -246,11 +246,6 @@ export type PeriodFilter = {
readonly periodStartTsLte?: InputMaybe<Scalars["Time"]["input"]>
}

export enum PeriodOrder {
Period = "period",
PeriodStartTs = "period_start_ts",
}

export type PerpLeaderboard = {
readonly __typename?: "PerpLeaderboard"
readonly avg_pct_pnl: Scalars["Float"]["output"]
Expand Down Expand Up @@ -285,6 +280,7 @@ export type PerpMarket = {
readonly maintenance_margin_ratio: Scalars["Float"]["output"]
readonly mark_price: Scalars["Float"]["output"]
readonly mark_price_twap: Scalars["Float"]["output"]
readonly max_funding_rate: Scalars["Float"]["output"]
readonly max_leverage: Scalars["Float"]["output"]
readonly pair: Scalars["String"]["output"]
readonly partial_liquidation_ratio: Scalars["Float"]["output"]
Expand Down Expand Up @@ -872,6 +868,16 @@ export type StringFilter = {
readonly like?: InputMaybe<Scalars["String"]["input"]>
}

export type Subscription = {
readonly __typename?: "Subscription"
readonly markPriceCandles: ReadonlyArray<MarkPriceCandle>
}

export type SubscriptionMarkPriceCandlesArgs = {
limit?: InputMaybe<Scalars["Int"]["input"]>
where?: InputMaybe<MarkPriceCandlesFilter>
}

export type TimeFilter = {
readonly eq?: InputMaybe<Scalars["Time"]["input"]>
readonly gt?: InputMaybe<Scalars["Time"]["input"]>
Expand Down
15 changes: 9 additions & 6 deletions packages/indexer-nibi/src/gql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ input MarkPriceCandlesFilter {

enum MarkPriceCandlesOrder {
period
periodStartTs
period_start_ts
}

input PeriodFilter {
Expand All @@ -207,11 +207,6 @@ input PeriodFilter {
periodStartTsLte: Time
}

enum PeriodOrder {
period
period_start_ts
}

type PerpLeaderboard {
avg_pct_pnl: Float!
input_margin: Float!
Expand Down Expand Up @@ -244,6 +239,7 @@ type PerpMarket {
maintenance_margin_ratio: Float!
mark_price: Float!
mark_price_twap: Float!
max_funding_rate: Float!
max_leverage: Float!
pair: String!
partial_liquidation_ratio: Float!
Expand Down Expand Up @@ -756,6 +752,13 @@ input StringFilter {
like: String
}

type Subscription {
markPriceCandles(
limit: Int
where: MarkPriceCandlesFilter
): [MarkPriceCandle!]!
}

scalar Time

input TimeFilter {
Expand Down
2 changes: 2 additions & 0 deletions packages/indexer-nibi/src/heart-monitor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ test("perpMarket", async () => {
"latest_cumulative_premium_fraction",
"exchange_fee_ratio",
"ecosystem_fund_fee_ratio",
"max_funding_rate",
"liquidation_fee_ratio",
"partial_liquidation_ratio",
"funding_rate_epoch_id",
Expand Down Expand Up @@ -231,6 +232,7 @@ test("perpMarkets", async () => {
"latest_cumulative_premium_fraction",
"exchange_fee_ratio",
"ecosystem_fund_fee_ratio",
"max_funding_rate",
"liquidation_fee_ratio",
"partial_liquidation_ratio",
"funding_rate_epoch_id",
Expand Down

0 comments on commit 9375f67

Please sign in to comment.