diff --git a/packages/indexer-nibi/src/gql/generated.ts b/packages/indexer-nibi/src/gql/generated.ts index 9394373f..748ccf09 100644 --- a/packages/indexer-nibi/src/gql/generated.ts +++ b/packages/indexer-nibi/src/gql/generated.ts @@ -249,6 +249,7 @@ export type PeriodFilter = { export type PerpLeaderboard = { readonly __typename?: "PerpLeaderboard" readonly avg_pct_pnl: Scalars["Float"]["output"] + readonly avg_pct_pnl_rank: Scalars["Int"]["output"] readonly input_margin: Scalars["Float"]["output"] readonly raw_pnl: Scalars["Float"]["output"] readonly raw_pnl_with_unrealized: Scalars["Float"]["output"] @@ -261,6 +262,7 @@ export type PerpLeaderboardFilter = { export enum PerpLeaderboardOrder { AvgPctPnl = "avg_pct_pnl", + AvgPctPnlRank = "avg_pct_pnl_rank", RawPnl = "raw_pnl", RawPnlWithUnrealized = "raw_pnl_with_unrealized", TraderAddress = "trader_address", @@ -868,9 +870,20 @@ export type StringFilter = { readonly like?: InputMaybe } +export type SubPerpMarketFilter = { + readonly pair: Scalars["String"]["input"] +} + +export type SubPerpPositionFilter = { + readonly pair?: InputMaybe + readonly trader_address: Scalars["String"]["input"] +} + export type Subscription = { readonly __typename?: "Subscription" readonly markPriceCandles: ReadonlyArray + readonly perpMarket: PerpMarket + readonly perpPositions: ReadonlyArray } export type SubscriptionMarkPriceCandlesArgs = { @@ -878,6 +891,14 @@ export type SubscriptionMarkPriceCandlesArgs = { where?: InputMaybe } +export type SubscriptionPerpMarketArgs = { + where: SubPerpMarketFilter +} + +export type SubscriptionPerpPositionsArgs = { + where: SubPerpPositionFilter +} + export type TimeFilter = { readonly eq?: InputMaybe readonly gt?: InputMaybe diff --git a/packages/indexer-nibi/src/gql/schema.graphql b/packages/indexer-nibi/src/gql/schema.graphql index 281c8a52..e3fd2be6 100644 --- a/packages/indexer-nibi/src/gql/schema.graphql +++ b/packages/indexer-nibi/src/gql/schema.graphql @@ -209,6 +209,7 @@ input PeriodFilter { type PerpLeaderboard { avg_pct_pnl: Float! + avg_pct_pnl_rank: Int! input_margin: Float! raw_pnl: Float! raw_pnl_with_unrealized: Float! @@ -221,6 +222,7 @@ input PerpLeaderboardFilter { enum PerpLeaderboardOrder { avg_pct_pnl + avg_pct_pnl_rank raw_pnl raw_pnl_with_unrealized trader_address @@ -752,11 +754,22 @@ input StringFilter { like: String } +input SubPerpMarketFilter { + pair: String! +} + +input SubPerpPositionFilter { + pair: String + trader_address: String! +} + type Subscription { markPriceCandles( limit: Int where: MarkPriceCandlesFilter ): [MarkPriceCandle!]! + perpMarket(where: SubPerpMarketFilter!): PerpMarket! + perpPositions(where: SubPerpPositionFilter!): [PerpPosition!]! } scalar Time diff --git a/packages/indexer-nibi/src/query/perpLeaderboard.ts b/packages/indexer-nibi/src/query/perpLeaderboard.ts index 16f4a6d7..08271f7d 100644 --- a/packages/indexer-nibi/src/query/perpLeaderboard.ts +++ b/packages/indexer-nibi/src/query/perpLeaderboard.ts @@ -6,6 +6,7 @@ import { } from "../gql/generated" export const defaultPerpLeaderboardObject: PerpLeaderboard = { + avg_pct_pnl_rank: 0, avg_pct_pnl: 0, input_margin: 0, raw_pnl: 0, diff --git a/packages/nibijs/docs/classes/StableSwap.md b/packages/nibijs/docs/classes/StableSwap.md index b7560b83..eae7b455 100644 --- a/packages/nibijs/docs/classes/StableSwap.md +++ b/packages/nibijs/docs/classes/StableSwap.md @@ -178,8 +178,8 @@ y() Calculate x[j] if one makes x[i] = x Done by solving quadratic equation iteratively. -x_1**2 + x1 * (sum' - (A*n**n - 1) _ D / (A _ n**n)) = D ** (n+1)/(n ** (2 _ n) _ prod' \* A) -x_1**2 + b\*x_1 = c +x*1**2 + x1 * (sum' - (A*n**n - 1) * D / (A _ n**n)) = D ** (n+1)/(n \*\* (2 _ n) \_ prod' \* A) +x_1\*\*2 + b\*x_1 = c x_1 = (x_1\**2 + c) / (2*x_1 + b)