chore(trading): clean up triggering ratio (#5604)
This commit is contained in:
parent
6a21862378
commit
bc9d87fe30
@ -44,7 +44,7 @@ context('Proposal page', { tags: '@smoke' }, function () {
|
||||
cy.getByTestId('icon-cross').click();
|
||||
});
|
||||
|
||||
it.skip('Proposal page displayed on mobile', function () {
|
||||
it('Proposal page displayed on mobile', function () {
|
||||
const proposalTitle = 'Add Lorem Ipsum market';
|
||||
|
||||
cy.common_switch_to_mobile_and_click_toggle();
|
||||
@ -55,7 +55,7 @@ context('Proposal page', { tags: '@smoke' }, function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('Able to view new asset proposal', function () {
|
||||
it.skip('Able to view new asset proposal', function () {
|
||||
const proposalTitle = 'Test new asset proposal';
|
||||
const newAssetProposalBody = getNewAssetTxBody();
|
||||
cy.VegaWalletSubmitProposal(newAssetProposalBody);
|
||||
|
@ -196,6 +196,7 @@ export function createNewMarketProposalTxBody(): ProposalSubmissionBody {
|
||||
timeWindow: '3600',
|
||||
scalingFactor: 10,
|
||||
},
|
||||
// FIXME: workaround because of https://github.com/vegaprotocol/vega/issues/10343
|
||||
triggeringRatio: '0.7',
|
||||
auctionExtension: '1',
|
||||
},
|
||||
@ -334,6 +335,7 @@ export function createSuccessorMarketProposalTxBody(
|
||||
timeWindow: '3600',
|
||||
scalingFactor: 10,
|
||||
},
|
||||
// FIXME: workaround because of https://github.com/vegaprotocol/vega/issues/10343
|
||||
triggeringRatio: '0.7',
|
||||
auctionExtension: '1',
|
||||
},
|
||||
|
@ -205,7 +205,6 @@ query Proposal(
|
||||
}
|
||||
}
|
||||
liquidityMonitoringParameters {
|
||||
triggeringRatio
|
||||
targetStakeParameters {
|
||||
timeWindow
|
||||
scalingFactor
|
||||
@ -366,7 +365,6 @@ query Proposal(
|
||||
}
|
||||
}
|
||||
liquidityMonitoringParameters {
|
||||
triggeringRatio
|
||||
targetStakeParameters {
|
||||
timeWindow
|
||||
scalingFactor
|
||||
|
File diff suppressed because one or more lines are too long
@ -42,13 +42,9 @@ export const LiquidityHeader = () => {
|
||||
const assetDecimalPlaces = asset?.decimals || 0;
|
||||
const symbol = asset?.symbol;
|
||||
|
||||
const triggeringRatio =
|
||||
market?.liquidityMonitoringParameters.triggeringRatio || '1';
|
||||
|
||||
const { percentage, status } = useCheckLiquidityStatus({
|
||||
suppliedStake: suppliedStake || 0,
|
||||
targetStake: targetStake || 0,
|
||||
triggeringRatio,
|
||||
});
|
||||
|
||||
const feesObject = feesPaidRes?.paidLiquidityFees?.edges?.find(
|
||||
|
@ -47,9 +47,6 @@ export const MarketLiquiditySupplied = ({
|
||||
]);
|
||||
|
||||
const stakeToCcyVolume = params.market_liquidity_stakeToCcyVolume;
|
||||
const triggeringRatio = Number(
|
||||
params.market_liquidity_targetstake_triggering_ratio
|
||||
);
|
||||
|
||||
const variables = useMemo(
|
||||
() => ({
|
||||
@ -94,7 +91,6 @@ export const MarketLiquiditySupplied = ({
|
||||
const { percentage, status } = useCheckLiquidityStatus({
|
||||
suppliedStake: market?.suppliedStake || 0,
|
||||
targetStake: market?.targetStake || 0,
|
||||
triggeringRatio,
|
||||
});
|
||||
|
||||
const showMessage =
|
||||
|
@ -15,7 +15,6 @@ export async function proposeMarket(publicKey: string) {
|
||||
log('sending proposal tx');
|
||||
const proposalTx = createNewMarketProposal();
|
||||
const result = await sendVegaTx(publicKey, proposalTx);
|
||||
|
||||
return result.result;
|
||||
}
|
||||
|
||||
@ -119,6 +118,7 @@ function createNewMarketProposal(): ProposalSubmissionBody {
|
||||
timeWindow: '3600',
|
||||
scalingFactor: 10,
|
||||
},
|
||||
// FIXME: workaround because of https://github.com/vegaprotocol/vega/issues/10343
|
||||
triggeringRatio: '0.7',
|
||||
auctionExtension: '1',
|
||||
},
|
||||
|
@ -11,9 +11,6 @@ export function generateMarket(override?: PartialDeep<Market>): Market {
|
||||
positionDecimalPlaces: 1,
|
||||
tradingMode: Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS,
|
||||
state: Schema.MarketState.STATE_ACTIVE,
|
||||
liquidityMonitoringParameters: {
|
||||
triggeringRatio: '1',
|
||||
},
|
||||
marketTimestamps: {
|
||||
__typename: 'MarketTimestamps',
|
||||
close: '',
|
||||
@ -75,7 +72,6 @@ export function generateMarket(override?: PartialDeep<Market>): Market {
|
||||
__typename: 'Instrument',
|
||||
},
|
||||
},
|
||||
|
||||
fees: {
|
||||
factors: {
|
||||
makerFee: '0.001',
|
||||
|
@ -54,9 +54,6 @@ export const generateFill = (override?: PartialDeep<Trade>) => {
|
||||
decimalPlaces: 5,
|
||||
state: MarketState.STATE_ACTIVE,
|
||||
tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS,
|
||||
liquidityMonitoringParameters: {
|
||||
triggeringRatio: '1',
|
||||
},
|
||||
fees: {
|
||||
__typename: 'Fees',
|
||||
factors: {
|
||||
|
@ -22,9 +22,7 @@ export const generateFundingPayment = (
|
||||
decimalPlaces: 5,
|
||||
state: MarketState.STATE_ACTIVE,
|
||||
tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS,
|
||||
liquidityMonitoringParameters: {
|
||||
triggeringRatio: '1',
|
||||
},
|
||||
|
||||
fees: {
|
||||
__typename: 'Fees',
|
||||
factors: {
|
||||
|
@ -124,27 +124,11 @@ describe('getChange', () => {
|
||||
});
|
||||
|
||||
describe('useCheckLiquidityStatus', () => {
|
||||
it('should return amber if liquidity is enough', () => {
|
||||
const { result } = renderHook(() =>
|
||||
useCheckLiquidityStatus({
|
||||
suppliedStake: '60',
|
||||
targetStake: '100',
|
||||
triggeringRatio: '0.5',
|
||||
})
|
||||
);
|
||||
|
||||
expect(result.current).toEqual({
|
||||
status: Intent.Warning,
|
||||
percentage: new BigNumber('60'),
|
||||
});
|
||||
});
|
||||
|
||||
it('should return red if liquidity is not enough', () => {
|
||||
const { result } = renderHook(() =>
|
||||
useCheckLiquidityStatus({
|
||||
suppliedStake: '60',
|
||||
targetStake: '100',
|
||||
triggeringRatio: '1',
|
||||
})
|
||||
);
|
||||
|
||||
@ -159,7 +143,6 @@ describe('useCheckLiquidityStatus', () => {
|
||||
useCheckLiquidityStatus({
|
||||
suppliedStake: '101',
|
||||
targetStake: '100',
|
||||
triggeringRatio: '1',
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -121,11 +121,9 @@ export const getTargetStake = (
|
||||
export const useCheckLiquidityStatus = ({
|
||||
suppliedStake,
|
||||
targetStake,
|
||||
triggeringRatio,
|
||||
}: {
|
||||
suppliedStake: string | number;
|
||||
targetStake: string | number;
|
||||
triggeringRatio: string | number;
|
||||
}): {
|
||||
status: Intent;
|
||||
percentage: BigNumber;
|
||||
@ -142,23 +140,12 @@ export const useCheckLiquidityStatus = ({
|
||||
percentage,
|
||||
};
|
||||
}
|
||||
if (new BigNumber(suppliedStake).gte(new BigNumber(targetStake))) {
|
||||
if (new BigNumber(suppliedStake).gte(targetStake)) {
|
||||
// show a green status, e.g. "🟢 $13,666,999 liquidity supplied"
|
||||
return {
|
||||
status: Intent.Success,
|
||||
percentage,
|
||||
};
|
||||
// ELSE IF supplied_stake > NETPARAM[market.liquidity.targetstake.triggering.ratio] * target_stake THEN
|
||||
} else if (
|
||||
new BigNumber(suppliedStake).gte(
|
||||
new BigNumber(targetStake).multipliedBy(triggeringRatio)
|
||||
)
|
||||
) {
|
||||
// show an amber status, e.g. "🟠 $3,456,123 liquidity supplied"
|
||||
return {
|
||||
status: Intent.Warning,
|
||||
percentage,
|
||||
};
|
||||
// ELSE show a red status, e.g. "🔴 $600,002 liquidity supplied"
|
||||
} else {
|
||||
return {
|
||||
|
7
libs/markets/src/lib/__generated__/markets.ts
generated
7
libs/markets/src/lib/__generated__/markets.ts
generated
File diff suppressed because one or more lines are too long
@ -188,7 +188,6 @@ query MarketInfo($marketId: ID!) {
|
||||
long
|
||||
}
|
||||
liquidityMonitoringParameters {
|
||||
triggeringRatio
|
||||
targetStakeParameters {
|
||||
timeWindow
|
||||
scalingFactor
|
||||
|
File diff suppressed because one or more lines are too long
@ -745,7 +745,6 @@ export const LiquidityMonitoringParametersInfoPanel = ({
|
||||
parentMarket,
|
||||
}: MarketInfoProps) => {
|
||||
const marketData = {
|
||||
triggeringRatio: market.liquidityMonitoringParameters.triggeringRatio,
|
||||
timeWindow:
|
||||
market.liquidityMonitoringParameters.targetStakeParameters.timeWindow,
|
||||
scalingFactor:
|
||||
@ -754,8 +753,6 @@ export const LiquidityMonitoringParametersInfoPanel = ({
|
||||
|
||||
const parentMarketData = parentMarket
|
||||
? {
|
||||
triggeringRatio:
|
||||
parentMarket.liquidityMonitoringParameters.triggeringRatio,
|
||||
timeWindow:
|
||||
parentMarket.liquidityMonitoringParameters.targetStakeParameters
|
||||
.timeWindow,
|
||||
|
@ -95,7 +95,6 @@ export const marketInfoQuery = (
|
||||
long: '0.008508132993273576',
|
||||
},
|
||||
liquidityMonitoringParameters: {
|
||||
triggeringRatio: '0.7',
|
||||
targetStakeParameters: {
|
||||
timeWindow: 3600,
|
||||
scalingFactor: 10,
|
||||
|
@ -101,8 +101,6 @@ export const useTooltipMapping: () => Record<string, ReactNode> = () => {
|
||||
auctionExtensionSecs: t(
|
||||
'Auction extension duration in seconds, should the price breach its theoretical level over the specified horizon at the specified probability level.'
|
||||
),
|
||||
|
||||
triggeringRatio: t('The triggering ratio for entering liquidity auction.'),
|
||||
timeWindow: t('The length of time over which open interest is measured.'),
|
||||
scalingFactor: t(
|
||||
'The scaling between the liquidity demand estimate, based on open interest and target stake.'
|
||||
|
@ -35,9 +35,6 @@ fragment MarketFields on Market {
|
||||
open
|
||||
close
|
||||
}
|
||||
liquidityMonitoringParameters {
|
||||
triggeringRatio
|
||||
}
|
||||
}
|
||||
|
||||
query Markets {
|
||||
|
@ -53,9 +53,6 @@ export const createMarketFragment = (
|
||||
liquidityFee: '',
|
||||
},
|
||||
},
|
||||
liquidityMonitoringParameters: {
|
||||
triggeringRatio: '1',
|
||||
},
|
||||
tradableInstrument: {
|
||||
instrument: {
|
||||
id: '',
|
||||
|
@ -20,9 +20,6 @@ export const generateOrder = (partialOrder?: PartialDeep<Order>) => {
|
||||
makerFee: '0.1',
|
||||
},
|
||||
},
|
||||
liquidityMonitoringParameters: {
|
||||
triggeringRatio: '1',
|
||||
},
|
||||
marketTimestamps: {
|
||||
__typename: 'MarketTimestamps',
|
||||
close: '',
|
||||
|
@ -21,9 +21,6 @@ export const generateStopOrder = (
|
||||
__typename: 'Market',
|
||||
id: 'market-id',
|
||||
decimalPlaces: 1,
|
||||
liquidityMonitoringParameters: {
|
||||
triggeringRatio: '0.7',
|
||||
},
|
||||
fees: {
|
||||
__typename: 'Fees',
|
||||
factors: {
|
||||
|
@ -31,9 +31,6 @@ describe('OrderViewDialog', () => {
|
||||
liquidityFee: '0.001',
|
||||
},
|
||||
},
|
||||
liquidityMonitoringParameters: {
|
||||
triggeringRatio: '1',
|
||||
},
|
||||
tradableInstrument: {
|
||||
__typename: 'TradableInstrument',
|
||||
instrument: {
|
||||
|
@ -134,7 +134,6 @@ fragment NewMarketFields on NewMarket {
|
||||
# timeWindow
|
||||
# scalingFactor
|
||||
# }
|
||||
# triggeringRatio
|
||||
# auctionExtensionSecs
|
||||
# }
|
||||
# linearSlippageFactor
|
||||
@ -299,7 +298,6 @@ fragment UpdateMarketFields on UpdateMarket {
|
||||
timeWindow
|
||||
scalingFactor
|
||||
}
|
||||
triggeringRatio
|
||||
# auctionExtensionSecs
|
||||
}
|
||||
riskParameters {
|
||||
|
File diff suppressed because one or more lines are too long
@ -92,7 +92,6 @@ export const marketUpdateProposal: ProposalListFieldsFragment = {
|
||||
triggers: [],
|
||||
},
|
||||
liquidityMonitoringParameters: {
|
||||
triggeringRatio: '0',
|
||||
targetStakeParameters: {
|
||||
scalingFactor: 0,
|
||||
timeWindow: 0,
|
||||
|
@ -162,7 +162,6 @@ const generateUpdateMarketProposal = (
|
||||
__typename: liquidityMonitoring
|
||||
? 'LiquidityMonitoringParameters'
|
||||
: undefined,
|
||||
triggeringRatio: '0',
|
||||
targetStakeParameters: {
|
||||
__typename: undefined,
|
||||
scalingFactor: 0,
|
||||
|
2
libs/types/src/__generated__/types.ts
generated
2
libs/types/src/__generated__/types.ts
generated
@ -5585,6 +5585,8 @@ export enum StopOrderRejectionReason {
|
||||
REJECTION_REASON_MAX_STOP_ORDERS_PER_PARTY_REACHED = 'REJECTION_REASON_MAX_STOP_ORDERS_PER_PARTY_REACHED',
|
||||
/** Stop orders submission must be reduce only */
|
||||
REJECTION_REASON_MUST_BE_REDUCE_ONLY = 'REJECTION_REASON_MUST_BE_REDUCE_ONLY',
|
||||
/** Stop orders are not allowed during the opening auction */
|
||||
REJECTION_REASON_STOP_ORDER_NOT_ALLOWED_DURING_OPENING_AUCTION = 'REJECTION_REASON_STOP_ORDER_NOT_ALLOWED_DURING_OPENING_AUCTION',
|
||||
/** Stop orders are not allowed without a position */
|
||||
REJECTION_REASON_STOP_ORDER_NOT_ALLOWED_WITHOUT_A_POSITION = 'REJECTION_REASON_STOP_ORDER_NOT_ALLOWED_WITHOUT_A_POSITION',
|
||||
/** This stop order does not close the position */
|
||||
|
@ -149,6 +149,7 @@ interface ProposalNewMarketTerms {
|
||||
timeWindow: string;
|
||||
scalingFactor: number;
|
||||
};
|
||||
// FIXME: workaround because of https://github.com/vegaprotocol/vega/issues/10343
|
||||
triggeringRatio: string;
|
||||
auctionExtension: string;
|
||||
};
|
||||
|
@ -149,9 +149,6 @@ describe('WithdrawFormContainer', () => {
|
||||
liquidityFee: '0.001',
|
||||
},
|
||||
},
|
||||
liquidityMonitoringParameters: {
|
||||
triggeringRatio: '0.7',
|
||||
},
|
||||
tradableInstrument: {
|
||||
__typename: 'TradableInstrument',
|
||||
instrument: {
|
||||
|
Loading…
Reference in New Issue
Block a user