Compare commits

...

2 Commits

Author SHA1 Message Date
Matthew Russell
ba12c441b8
fix: upper bound, minor layout improvements, remove fees from funding 2024-02-20 10:19:24 -08:00
Bartłomiej Głownia
077735fe91
feat(markets): add funding payment calc info 2024-02-20 10:19:24 -08:00
9 changed files with 70 additions and 24 deletions

View File

@ -21,6 +21,7 @@
"Ethereum Oracle": "Ethereum Oracle",
"every {{duration}}": "every {{duration}}",
"every {{duration}} from {{initialTime}}": "every {{duration}} from {{initialTime}}",
"Factor applied to funding-rates. This scales the impact that spot price deviations have on funding payments.": "Factor applied to funding-rates. This scales the impact that spot price deviations have on funding payments.",
"Fees paid to validators as a reward for running the infrastructure of the network.": "Fees paid to validators as a reward for running the infrastructure of the network.",
"Filters": "Filters",
"For liquidity orders to count towards a commitment, they must be within the liquidity monitoring bounds.": "For liquidity orders to count towards a commitment, they must be within the liquidity monitoring bounds.",
@ -44,6 +45,7 @@
"Liquidity portion of the fee is paid to liquidity providers, and is transferred to the liquidity fee pool for the market.": "Liquidity portion of the fee is paid to liquidity providers, and is transferred to the liquidity fee pool for the market.",
"Liquidity price range": "Liquidity price range",
"Liquidity SLA protocol": "Liquidity SLA protocol",
"Lower bound for the funding-rate such that the funding-rate will never be lower than this value.": "Lower bound for the funding-rate such that the funding-rate will never be lower than this value.",
"Maker portion of the fee is transferred to the non-aggressive, or passive party in the trade (the maker, as opposed to the taker).": "Maker portion of the fee is transferred to the non-aggressive, or passive party in the trade (the maker, as opposed to the taker).",
"Margin scaling factors": "Margin scaling factors",
"Market": "Market",
@ -138,6 +140,7 @@
"This public key's proofs have not been verified yet, or no proofs have been provided yet.": "This public key's proofs have not been verified yet, or no proofs have been provided yet.",
"Time horizon of the price projection in seconds.": "Time horizon of the price projection in seconds.",
"Updated": "Updated",
"Upper bound for the funding-rate such that the funding-rate will never be higher than this value.": "Upper bound for the funding-rate such that the funding-rate will never be higher than this value.",
"Used to calculate the penalty to liquidity providers when they cannot support their open position with the assets in their margin and general accounts. This is a network parameter.": "Used to calculate the penalty to liquidity providers when they cannot support their open position with the assets in their margin and general accounts. This is a network parameter.",
"Verified since {{lastVerified}}": "Verified since {{lastVerified}}",
"verifyProofs_one": "Verify {{count}} proof of ownership",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -112,6 +112,9 @@ fragment Future on Future {
fragment Perpetual on Perpetual {
quoteName
fundingRateScalingFactor
fundingRateLowerBound
fundingRateUpperBound
settlementAsset {
id
symbol

File diff suppressed because one or more lines are too long

View File

@ -181,7 +181,10 @@ export const MarketInfoAccordion = ({
itemId="funding"
title={t('Funding')}
content={
<FundingInfoPanel dataSource={settlementScheduleDataSource} />
<FundingInfoPanel
dataSource={settlementScheduleDataSource}
market={market}
/>
}
/>
)}

View File

@ -84,6 +84,7 @@ import type { DataSourceFragment } from './__generated__/MarketInfo';
import { formatDuration } from 'date-fns';
import * as AccordionPrimitive from '@radix-ui/react-accordion';
import { useT } from '../../use-t';
import { isPerpetual } from '../../product';
type MarketInfoProps = {
market: MarketInfo;
@ -920,8 +921,8 @@ export const EthOraclePanel = ({ sourceType }: { sourceType: EthCallSpec }) => {
<>
<MarketInfoTable key={i} data={filter.key} />
<h3 className={header}>{t('Conditions')}</h3>
{filter.conditions?.map((condition) => (
<span>
{filter.conditions?.map((condition, i) => (
<span key={i}>
{ConditionOperatorMapping[condition.operator]} {condition.value}
</span>
))}
@ -1149,8 +1150,10 @@ export const LiquidityInfoPanel = ({ market, children }: MarketInfoProps) => {
export const FundingInfoPanel = ({
dataSource,
market,
}: {
dataSource: DataSourceFragment;
market: MarketInfo;
}) => {
const t = useT();
const sourceType = dataSource.data.sourceType.sourceType;
@ -1167,12 +1170,30 @@ export const FundingInfoPanel = ({
hours,
minutes,
});
return initial
? t('every {{duration}} from {{initialTime}}', {
duration,
initialTime: getDateTimeFormat().format(new Date(initial * 1000)),
})
: t('every {{duration}}', { duration });
const { product } = market.tradableInstrument.instrument;
return (
<>
<p
className="first-letter:uppercase text-x;w
"
>
{initial
? t('every {{duration}} from {{initialTime}}', {
duration,
initialTime: getDateTimeFormat().format(new Date(initial * 1000)),
})
: t('every {{duration}}', { duration })}
</p>
<MarketInfoTable
data={{
rateScalingFactor:
isPerpetual(product) && product.fundingRateScalingFactor,
rateLowerBound: isPerpetual(product) && product.fundingRateLowerBound,
rateUpperBound: isPerpetual(product) && product.fundingRateUpperBound,
}}
/>
</>
);
};
export const OracleInfoPanel = ({

View File

@ -157,5 +157,14 @@ export const useTooltipMapping: () => Record<string, ReactNode> = () => {
feeConstant: t(
'The constant liquidity fee used when using the constant fee method .'
),
rateScalingFactor: t(
'Factor applied to funding-rates. This scales the impact that spot price deviations have on funding payments.'
),
rateLowerBound: t(
'Lower bound for the funding-rate such that the funding-rate will never be lower than this value.'
),
rateUpperBound: t(
'Upper bound for the funding-rate such that the funding-rate will never be higher than this value.'
),
};
};

View File

@ -3831,6 +3831,7 @@ export type PartytradesConnectionArgs = {
export type PartytransfersConnectionArgs = {
direction?: InputMaybe<TransferDirection>;
fromEpoch?: InputMaybe<Scalars['Int']>;
gameId?: InputMaybe<Scalars['ID']>;
isReward?: InputMaybe<Scalars['Boolean']>;
pagination?: InputMaybe<Pagination>;
scope?: InputMaybe<TransferScope>;
@ -4047,11 +4048,11 @@ export type Perpetual = {
/** Data source specification describing the data source for settlement schedule */
dataSourceSpecForSettlementSchedule: DataSourceSpec;
/** Lower bound for the funding-rate such that the funding-rate will never be lower than this value */
fundingRateLowerBound: Scalars['String'];
fundingRateLowerBound?: Maybe<Scalars['String']>;
/** Factor applied to funding-rates. This scales the impact that spot price deviations have on funding payments */
fundingRateScalingFactor: Scalars['String'];
fundingRateScalingFactor?: Maybe<Scalars['String']>;
/** Upper bound for the funding-rate such that the funding-rate will never be higher than this value */
fundingRateUpperBound: Scalars['String'];
fundingRateUpperBound?: Maybe<Scalars['String']>;
/** Continuously compounded interest rate used in funding rate calculation, in the range [-1, 1] */
interestRate: Scalars['String'];
/** Optional configuration driving the internal composite price calculation for perpetual product */
@ -4104,11 +4105,11 @@ export type PerpetualProduct = {
/** Data source specification describing the data source for settlement schedule */
dataSourceSpecForSettlementSchedule: DataSourceDefinition;
/** Lower bound for the funding-rate such that the funding-rate will never be lower than this value */
fundingRateLowerBound: Scalars['String'];
fundingRateLowerBound?: Maybe<Scalars['String']>;
/** Factor applied to funding-rates. This scales the impact that spot price deviations have on funding payments. */
fundingRateScalingFactor: Scalars['String'];
fundingRateScalingFactor?: Maybe<Scalars['String']>;
/** Upper bound for the funding-rate such that the funding-rate will never be higher than this value */
fundingRateUpperBound: Scalars['String'];
fundingRateUpperBound?: Maybe<Scalars['String']>;
/** Continuously compounded interest rate used in funding rate calculation, in the range [-1, 1] */
interestRate: Scalars['String'];
/** Controls how much the upcoming funding payment liability contributes to party's margin, in the range [0, 1] */
@ -5159,6 +5160,8 @@ export type QuerygamesArgs = {
epochTo?: InputMaybe<Scalars['Int']>;
gameId?: InputMaybe<Scalars['ID']>;
pagination?: InputMaybe<Pagination>;
partyId?: InputMaybe<Scalars['ID']>;
teamId?: InputMaybe<Scalars['ID']>;
};
@ -5464,6 +5467,7 @@ export type QuerytransferArgs = {
export type QuerytransfersConnectionArgs = {
direction?: InputMaybe<TransferDirection>;
fromEpoch?: InputMaybe<Scalars['Int']>;
gameId?: InputMaybe<Scalars['ID']>;
isReward?: InputMaybe<Scalars['Boolean']>;
pagination?: InputMaybe<Pagination>;
partyId?: InputMaybe<Scalars['ID']>;
@ -7099,11 +7103,11 @@ export type UpdatePerpetualProduct = {
/** Data source specification describing the data source for settlement schedule */
dataSourceSpecForSettlementSchedule: DataSourceDefinition;
/** Lower bound for the funding-rate such that the funding-rate will never be lower than this value */
fundingRateLowerBound: Scalars['String'];
fundingRateLowerBound?: Maybe<Scalars['String']>;
/** Factor applied to funding-rates. This scales the impact that spot price deviations have on funding payments. */
fundingRateScalingFactor: Scalars['String'];
fundingRateScalingFactor?: Maybe<Scalars['String']>;
/** Upper bound for the funding-rate such that the funding-rate will never be higher than this value */
fundingRateUpperBound: Scalars['String'];
fundingRateUpperBound?: Maybe<Scalars['String']>;
/** Continuously compounded interest rate used in funding rate calculation, in the range [-1, 1] */
interestRate: Scalars['String'];
/** Controls how much the upcoming funding payment liability contributes to party's margin, in the range [0, 1] */