Compare commits

...
Author SHA1 Message Date
Madalina Raicu b4e655ffec fix: typename reset 2023-07-17 15:43:38 +02:00
Madalina Raicu f616597fd7 Merge branch 'develop' of github.com:vegaprotocol/frontend-monorepo into feat/submit-iceberg 2023-07-17 15:15:03 +02:00
Madalina Raicu 649857a88a Merge branch 'feat/view-iceberg-orders' of github.com:vegaprotocol/frontend-monorepo into feat/submit-iceberg 2023-07-17 14:36:37 +02:00
Madalina Raicu ad2dbe2684 fix: skip flaky test 2023-07-17 14:35:36 +02:00
Madalina Raicu 1062db9b1a Merge branch 'develop' of github.com:vegaprotocol/frontend-monorepo into feat/submit-iceberg 2023-07-17 14:26:05 +02:00
Madalina Raicu 6b3c807dec Merge branch 'develop' of github.com:vegaprotocol/frontend-monorepo into feat/submit-iceberg 2023-07-14 12:47:46 +01:00
Madalina Raicu 11dff1fcab Merge branch 'develop' of github.com:vegaprotocol/frontend-monorepo into feat/view-iceberg-orders 2023-07-14 12:47:05 +01:00
Madalina Raicu c33b8e12ba Merge branch 'develop' of github.com:vegaprotocol/frontend-monorepo into feat/view-iceberg-orders 2023-07-14 09:30:24 +01:00
Madalina Raicu 2d0e8e0a14 Merge branch 'develop' of github.com:vegaprotocol/frontend-monorepo into feat/submit-iceberg 2023-07-14 09:29:23 +01:00
Madalina Raicu cc7fde6bbe Merge branch 'fix/add-internal-data-source-termination-oracle' of github.com:vegaprotocol/frontend-monorepo into feat/submit-iceberg 2023-07-13 09:19:37 +01:00
Madalina Raicu a96843fef7 Merge branch 'develop' of github.com:vegaprotocol/frontend-monorepo into feat/submit-iceberg 2023-07-12 20:33:54 +01:00
Madalina Raicu c1ed810d0e Merge branch 'develop' of github.com:vegaprotocol/frontend-monorepo into feat/view-iceberg-orders 2023-07-12 20:26:00 +01:00
Madalina Raicu ee38cea4f2 fix: update market info 2023-07-12 20:24:30 +01:00
Madalina Raicu 93869b178c Merge branch 'develop' of github.com:vegaprotocol/frontend-monorepo into fix/add-internal-data-source-termination-oracle 2023-07-12 20:23:58 +01:00
Madalina Raicu 66d3f91069 Merge branch 'develop' of github.com:vegaprotocol/frontend-monorepo into feat/submit-iceberg 2023-07-12 11:57:13 +01:00
Madalina Raicu 2185c52084 chore: update test trading-portfolio 2023-07-12 11:03:34 +01:00
Madalina Raicu 46c18ddfe0 Merge branch 'develop' of github.com:vegaprotocol/frontend-monorepo into feat/submit-iceberg 2023-07-12 09:44:30 +01:00
Madalina Raicu 03aac931fd Merge branch 'develop' of github.com:vegaprotocol/frontend-monorepo into feat/submit-iceberg 2023-07-11 23:56:05 +01:00
Madalina Raicu 694c9765d3 Merge branch 'develop' of github.com:vegaprotocol/frontend-monorepo into fix/add-internal-data-source-termination-oracle 2023-07-11 13:02:42 +01:00
Madalina Raicu ac11eea37b Merge branch 'develop' of github.com:vegaprotocol/frontend-monorepo into fix/add-internal-data-source-termination-oracle 2023-07-11 09:27:23 +01:00
Madalina Raicu 9a8e4b2526 fix: order type cast removed 2023-07-10 14:39:57 +01:00
Madalina Raicu 70ca29c9ee chore: add extra tests for iceberg orders 2023-07-10 08:56:25 +01:00
Madalina Raicu 07403bdc81 Merge branch 'develop' of github.com:vegaprotocol/frontend-monorepo into feat/submit-iceberg 2023-07-09 16:08:08 +03:00
Madalina Raicu e07fa70bb7 Merge branch 'feat/view-iceberg-orders' of github.com:vegaprotocol/frontend-monorepo into feat/submit-iceberg 2023-07-07 22:54:13 +03:00
Madalina Raicu 96db36fa67 fix: add extra field 2023-07-07 22:35:31 +03:00
Madalina Raicu abc278aab5 fix: mappings 2023-07-07 22:15:43 +03:00
Madalina Raicu 331c492408 fix: update iceberg opts 2023-07-07 19:14:47 +03:00
Madalina Raicu 52b5274f47 fix: order conflict 2023-07-07 18:59:52 +03:00
Madalina Raicu 24fc4721e7 Merge branch 'feat/view-iceberg-orders' of github.com:vegaprotocol/frontend-monorepo into feat/submit-iceberg 2023-07-07 18:56:59 +03:00
Madalina Raicu 381c1d34c8 fix: order fields update 2023-07-07 18:49:39 +03:00
Madalina Raicu cb797e5b3f fix: add typename 2023-07-07 18:19:07 +03:00
Madalina Raicu 6366f5d7de chore: remove remaining from tx res 2023-07-07 13:04:26 +03:00
Madalina Raicu 7fe867756c Merge branch 'develop' of github.com:vegaprotocol/frontend-monorepo into feat/view-iceberg-orders 2023-07-06 15:16:27 +03:00
Madalina Raicu dc4a7e63b5 Merge branch 'develop' of github.com:vegaprotocol/frontend-monorepo into feat/view-iceberg-orders 2023-07-06 11:17:50 +03:00
Madalina Raicu 5ef0969dcb fix: update types 2023-07-06 00:32:28 +03:00
Madalina Raicu 4c9f2ae84b fix: update order update on iceberg subscriptions 2023-07-05 18:08:50 +03:00
Madalina Raicu cacc7e1304 fix: update types 2023-07-05 18:04:40 +03:00
Madalina Raicu 77f49e3520 Merge branch 'feat/view-iceberg-orders' of github.com:vegaprotocol/frontend-monorepo into feat/submit-iceberg 2023-07-05 12:06:06 +03:00
Madalina Raicu 13d13bd930 Merge branch 'develop' of github.com:vegaprotocol/frontend-monorepo into feat/view-iceberg-orders 2023-07-05 00:18:48 +03:00
Madalina Raicu c3b95357dc fix: transfer type mappings 2023-07-04 17:59:59 +03:00
Madalina Raicu 1d74fd8311 Merge branch 'feat/view-iceberg-orders' of github.com:vegaprotocol/frontend-monorepo into feat/view-iceberg-orders 2023-07-04 17:58:21 +03:00
Madalina Raicu 981212bd64 fix: proposal type mappings 2023-07-04 17:58:07 +03:00
Madalina Raicu 54e6aadfa3 fix: account type holding 2023-07-04 17:49:20 +03:00
Madalina Raicu be86d91249 fix: remove log 2023-07-04 17:48:17 +03:00
Madalina Raicu 93340db681 fix(trading): update order submission type wrapper 2023-07-03 14:54:59 +03:00
Madalina Raicu 869a739ea4 fix: remove log update copy 2023-07-03 11:51:09 +03:00
Madalina Raicu 6efbd514be Merge branch 'develop' of github.com:vegaprotocol/frontend-monorepo into feat/submit-iceberg 2023-06-29 14:51:43 +03:00
Madalina Raicu 39b24be40f feat(trading): submit iceberg order using cli wallet 2023-06-29 00:47:02 +03:00
Madalina Raicu 3d26147be3 Merge branch 'feat/view-iceberg-orders' of github.com:vegaprotocol/frontend-monorepo into feat/submit-iceberg 2023-06-28 16:47:06 +03:00
Madalina Raicu 800b884ad9 fix: revert orders data provider changes 2023-06-28 16:41:12 +03:00
Madalina Raicu 44c00f808b fix: add internal data source termination oracle 2023-06-28 16:34:01 +03:00
Madalina Raicu 32c8a926a5 feat(trading): view iceberg orders 2023-06-28 15:47:51 +03:00
Madalina Raicu a1fec2c63f feat(trading): submit iceberg orders deal ticket 2023-06-28 13:24:27 +03:00
22 changed files with 427 additions and 27 deletions
File diff suppressed because one or more lines are too long
@@ -50,7 +50,7 @@ describe('Portfolio page', { tags: '@smoke' }, () => {
cy.get('fieldset.ag-simple-filter-body-wrapper')
.should('be.visible')
.within((fields) => {
cy.wrap(fields).find('label').should('have.length', 17);
cy.wrap(fields).find('label').should('have.length', 18);
});
cy.getByTestId('"Ledger entries"').click();
cy.get('fieldset.ag-simple-filter-body-wrapper').should('not.exist');
@@ -0,0 +1,195 @@
import { Controller, type Control } from 'react-hook-form';
import type { Market } from '@vegaprotocol/markets';
import type { OrderObj } from '@vegaprotocol/orders';
import type { OrderFormFields } from '../../hooks/use-order-form';
import { toDecimal, validateAmount } from '@vegaprotocol/utils';
import { t } from '@vegaprotocol/i18n';
import {
FormGroup,
Input,
InputError,
Tooltip,
} from '@vegaprotocol/ui-toolkit';
export interface DealTicketSizeIcebergProps {
control: Control<OrderFormFields>;
market: Market;
peakSizeError?: string;
minimumVisibleSizeError?: string;
update: (obj: Partial<OrderObj>) => void;
peakSize: string;
minimumVisibleSize: string;
size: string;
}
export const DealTicketSizeIceberg = ({
control,
market,
update,
peakSizeError,
minimumVisibleSizeError,
peakSize,
minimumVisibleSize,
size,
}: DealTicketSizeIcebergProps) => {
const sizeStep = toDecimal(market?.positionDecimalPlaces);
const renderPeakSizeError = () => {
if (peakSizeError) {
return (
<InputError testId="deal-ticket-peak-error-message-size-limit">
{peakSizeError}
</InputError>
);
}
return null;
};
const renderMinimumSizeError = () => {
if (minimumVisibleSizeError) {
return (
<InputError testId="deal-ticket-minimum-error-message-size-limit">
{minimumVisibleSizeError}
</InputError>
);
}
return null;
};
return (
<div className="mb-2">
<div className="flex items-center gap-4">
<div className="flex-1">
<FormGroup
label={
<Tooltip
description={
<div>
{t(
'The maximum volume that can be traded at once. Must be less than the total size of the order.'
)}
</div>
}
>
<span className="text-xs">{t('Peak size')}</span>
</Tooltip>
}
labelFor="input-order-peak-size"
className="!mb-1"
>
<Controller
name="icebergOpts.peakSize"
control={control}
rules={{
required: t('You need to provide a peak size'),
min: {
value: sizeStep,
message: t('Peak size cannot be lower than ' + sizeStep),
},
max: {
value: size,
message: t(
'Peak size cannot be greater than the size (%s) ',
[size]
),
},
validate: validateAmount(sizeStep, 'peakSize'),
}}
render={() => (
<Input
id="input-order-peak-size"
className="w-full"
type="number"
value={peakSize}
onChange={(e) =>
update({
icebergOpts: {
peakSize: e.target.value,
minimumVisibleSize,
},
})
}
step={sizeStep}
min={sizeStep}
max={size}
data-testid="order-peak-size"
onWheel={(e) => e.currentTarget.blur()}
/>
)}
/>
</FormGroup>
</div>
<div className="flex-0 items-center">
<div className="flex"></div>
<div className="flex"></div>
</div>
<div className="flex-1">
<FormGroup
label={
<Tooltip
description={
<div>
{t(
'When the order trades and its size falls below this threshold, it will be reset to the peak size and moved to the back of the priority order. Must be less than or equal to peak size, and greater than 0.'
)}
</div>
}
>
<span className="text-xs">{t('Minimum size')}</span>
</Tooltip>
}
labelFor="input-order-minimum-size"
className="!mb-1"
>
<Controller
name="icebergOpts.minimumVisibleSize"
control={control}
rules={{
required: t('You need to provide a minimum visible size'),
min: {
value: sizeStep,
message: t(
'Minimum visible size cannot be lower than ' + sizeStep
),
},
max: {
value: peakSize,
message: t(
'Minimum visible size cannot be greater than the peak size (%s)',
[peakSize]
),
},
validate: validateAmount(sizeStep, 'minimumVisibleSize'),
}}
render={() => (
<Input
id="input-order-minimum-size"
className="w-full"
type="number"
value={minimumVisibleSize}
onChange={(e) =>
update({
icebergOpts: {
peakSize,
minimumVisibleSize: e.target.value,
},
})
}
step={sizeStep}
min={sizeStep}
max={peakSize}
data-testid="order-minimum-size"
onWheel={(e) => e.currentTarget.blur()}
/>
)}
/>
</FormGroup>
</div>
</div>
{renderPeakSizeError()}
{renderMinimumSizeError()}
</div>
);
};
@@ -224,6 +224,109 @@ describe('DealTicket', () => {
expect(screen.getByTestId('reduce-only')).not.toBeChecked();
});
it('should set values for a persistent post only iceberg order and disable reduce only checkbox', () => {
const expectedOrder = {
marketId: market.id,
type: Schema.OrderType.TYPE_LIMIT,
side: Schema.Side.SIDE_SELL,
size: '10',
price: '300.22',
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
persist: true,
reduceOnly: false,
postOnly: true,
iceberg: true,
icebergOpts: {
peakSize: '5',
minimumVisibleSize: '7',
},
};
useOrderStore.setState({
orders: {
[expectedOrder.marketId]: expectedOrder,
},
});
render(generateJsx());
// Assert correct defaults are used from store
expect(
screen
.getByTestId(`order-type-${Schema.OrderType.TYPE_LIMIT}`)
.querySelector('input')
).toBeChecked();
expect(
screen.queryByTestId('order-side-SIDE_SELL')?.querySelector('input')
).toBeChecked();
expect(
screen.queryByTestId('order-side-SIDE_BUY')?.querySelector('input')
).not.toBeChecked();
expect(screen.getByTestId('order-size')).toHaveDisplayValue(
expectedOrder.size
);
expect(screen.getByTestId('order-tif')).toHaveValue(
expectedOrder.timeInForce
);
expect(screen.getByTestId('order-price')).toHaveDisplayValue(
expectedOrder.price
);
expect(screen.getByTestId('post-only')).toBeEnabled();
expect(screen.getByTestId('reduce-only')).toBeDisabled();
expect(screen.getByTestId('post-only')).toBeChecked();
expect(screen.getByTestId('reduce-only')).not.toBeChecked();
expect(screen.getByTestId('iceberg')).toBeEnabled();
expect(screen.getByTestId('iceberg')).toBeChecked();
});
it('should set values for a non-persistent iceberg order and disable post only checkbox', () => {
const expectedOrder = {
marketId: market.id,
type: Schema.OrderType.TYPE_LIMIT,
side: Schema.Side.SIDE_SELL,
size: '0.1',
price: '300.22',
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_IOC,
persist: false,
reduceOnly: false,
postOnly: false,
};
useOrderStore.setState({
orders: {
[expectedOrder.marketId]: expectedOrder,
},
});
render(generateJsx());
// Assert correct defaults are used from store
expect(
screen
.getByTestId(`order-type-${Schema.OrderType.TYPE_LIMIT}`)
.querySelector('input')
).toBeChecked();
expect(
screen.queryByTestId('order-side-SIDE_SELL')?.querySelector('input')
).toBeChecked();
expect(
screen.queryByTestId('order-side-SIDE_BUY')?.querySelector('input')
).not.toBeChecked();
expect(screen.getByTestId('order-size')).toHaveDisplayValue(
expectedOrder.size
);
expect(screen.getByTestId('order-tif')).toHaveValue(
expectedOrder.timeInForce
);
expect(screen.getByTestId('order-price')).toHaveDisplayValue(
expectedOrder.price
);
expect(screen.getByTestId('post-only')).toBeDisabled();
expect(screen.getByTestId('reduce-only')).toBeEnabled();
expect(screen.getByTestId('reduce-only')).not.toBeChecked();
expect(screen.getByTestId('post-only')).not.toBeChecked();
expect(screen.getByTestId('iceberg')).not.toBeChecked();
});
it('handles TIF select box dependent on order type', async () => {
render(generateJsx());
@@ -54,6 +54,7 @@ import {
import { OrderTimeInForce, OrderType } from '@vegaprotocol/types';
import { useOrderForm } from '../../hooks/use-order-form';
import { useDataProvider } from '@vegaprotocol/data-provider';
import { DealTicketSizeIceberg } from './deal-ticket-size-iceberg';
export interface DealTicketProps {
market: Market;
@@ -292,6 +293,22 @@ export const DealTicket = ({
timeInForce: lastTIF[type] || order.timeInForce,
postOnly:
type === OrderType.TYPE_MARKET ? false : order.postOnly,
iceberg:
type === OrderType.TYPE_MARKET ||
[
OrderTimeInForce.TIME_IN_FORCE_FOK,
OrderTimeInForce.TIME_IN_FORCE_IOC,
].includes(lastTIF[type] || order.timeInForce)
? false
: order.iceberg,
icebergOpts:
type === OrderType.TYPE_MARKET ||
[
OrderTimeInForce.TIME_IN_FORCE_FOK,
OrderTimeInForce.TIME_IN_FORCE_IOC,
].includes(lastTIF[type] || order.timeInForce)
? undefined
: order.icebergOpts,
reduceOnly:
type === OrderType.TYPE_LIMIT &&
![
@@ -463,6 +480,51 @@ export const DealTicket = ({
)}
/>
</div>
<div className="flex gap-2 pb-2 justify-between">
{order.type === Schema.OrderType.TYPE_LIMIT && (
<Controller
name="iceberg"
control={control}
render={() => (
<Checkbox
name="iceberg"
checked={order.iceberg}
onCheckedChange={() => {
update({ iceberg: !order.iceberg, icebergOpts: undefined });
}}
label={
<Tooltip
description={
<p>
{t(`Trade only a fraction of the order size at once.
After the peak size of the order has traded, the size is reset. This is repeated until the order is cancelled, expires, or its full volume trades away.
For example, an iceberg order with a size of 1000 and a peak size of 100 will effectively be split into 10 orders with a size of 100 each.
Note that the full volume of the order is not hidden and is still reflected in the order book.`)}
</p>
}
>
<span className="text-xs">{t('Iceberg')}</span>
</Tooltip>
}
/>
)}
/>
)}
</div>
{order.iceberg && (
<DealTicketSizeIceberg
update={update}
market={market}
peakSizeError={errors.icebergOpts?.peakSize?.message}
minimumVisibleSizeError={
errors.icebergOpts?.minimumVisibleSize?.message
}
control={control}
size={order.size}
peakSize={order.icebergOpts?.peakSize || ''}
minimumVisibleSize={order.icebergOpts?.minimumVisibleSize || ''}
/>
)}
<SummaryMessage
errorMessage={errors.summary?.message}
asset={asset}
+3 -6
View File
@@ -4,7 +4,6 @@ import { getDefaultOrder, useOrder } from '@vegaprotocol/orders';
import { useEffect } from 'react';
import { useForm } from 'react-hook-form';
import type { OrderSubmission } from '@vegaprotocol/wallet';
import type { Exact } from 'type-fest';
export type OrderFormFields = OrderObj & {
summary: string;
@@ -51,13 +50,11 @@ export const useOrderForm = (marketId: string) => {
}
}, [order, isSubmitted, getValues, setValue]);
const handleSubmitWrapper = (
cb: <T>(o: Exact<OrderSubmission, T>) => void
) => {
const handleSubmitWrapper = (cb: (o: OrderSubmission) => void) => {
return handleSubmit(() => {
// remove the persist key from the order in the store, the wallet will reject
// remove the persist and iceberg key from the order in the store, the wallet will reject
// an order that contains unrecognized additional keys
cb(omit(order, 'persist'));
cb(omit(order, 'persist', 'iceberg'));
});
};
+1 -1
View File
@@ -180,4 +180,4 @@ export function useLiquidityProviderFeeShareLazyQuery(baseOptions?: Apollo.LazyQ
}
export type LiquidityProviderFeeShareQueryHookResult = ReturnType<typeof useLiquidityProviderFeeShareQuery>;
export type LiquidityProviderFeeShareLazyQueryHookResult = ReturnType<typeof useLiquidityProviderFeeShareLazyQuery>;
export type LiquidityProviderFeeShareQueryResult = Apollo.QueryResult<LiquidityProviderFeeShareQuery, LiquidityProviderFeeShareQueryVariables>;
export type LiquidityProviderFeeShareQueryResult = Apollo.QueryResult<LiquidityProviderFeeShareQuery, LiquidityProviderFeeShareQueryVariables>;
@@ -16,6 +16,16 @@ fragment DataSource on DataSourceDefinition {
}
}
}
... on DataSourceDefinitionInternal {
sourceType {
... on DataSourceSpecConfigurationTime {
conditions {
operator
value
}
}
}
}
}
}
@@ -3,14 +3,14 @@ import * as Types from '@vegaprotocol/types';
import { gql } from '@apollo/client';
import * as Apollo from '@apollo/client';
const defaultOptions = {} as const;
export type DataSourceFragment = { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null } } | { __typename?: 'DataSourceDefinitionInternal' } };
export type DataSourceFragment = { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } };
export type MarketInfoQueryVariables = Types.Exact<{
marketId: Types.Scalars['ID'];
}>;
export type MarketInfoQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, lpPriceRange: string, parentMarketID?: string | null, proposal?: { __typename?: 'Proposal', id?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string } } | null, marketTimestamps: { __typename?: 'MarketTimestamps', open: any, close: any }, openingAuction: { __typename?: 'AuctionDuration', durationSecs: number, volume: number }, accountsConnection?: { __typename?: 'AccountsConnection', edges?: Array<{ __typename?: 'AccountEdge', node: { __typename?: 'AccountBalance', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string } } } | null> | null } | null, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, priceMonitoringSettings: { __typename?: 'PriceMonitoringSettings', parameters?: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null } | null }, riskFactors?: { __typename?: 'RiskFactor', market: string, short: string, long: string } | null, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: string, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array<string> | null }, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number }, dataSourceSpecForSettlementData: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null } } | { __typename?: 'DataSourceDefinitionInternal' } } }, dataSourceSpecForTradingTermination: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null } } | { __typename?: 'DataSourceDefinitionInternal' } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } }, riskModel: { __typename?: 'LogNormalRiskModel', tau: number, riskAversionParameter: number, params: { __typename?: 'LogNormalModelParams', r: number, sigma: number, mu: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } }, marginCalculator?: { __typename?: 'MarginCalculator', scalingFactors: { __typename?: 'ScalingFactors', searchLevel: number, initialMargin: number, collateralRelease: number } } | null } } | null };
export type MarketInfoQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, lpPriceRange: string, parentMarketID?: string | null, proposal?: { __typename?: 'Proposal', id?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string } } | null, marketTimestamps: { __typename?: 'MarketTimestamps', open: any, close: any }, openingAuction: { __typename?: 'AuctionDuration', durationSecs: number, volume: number }, accountsConnection?: { __typename?: 'AccountsConnection', edges?: Array<{ __typename?: 'AccountEdge', node: { __typename?: 'AccountBalance', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string } } } | null> | null } | null, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, priceMonitoringSettings: { __typename?: 'PriceMonitoringSettings', parameters?: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null } | null }, riskFactors?: { __typename?: 'RiskFactor', market: string, short: string, long: string } | null, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: string, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array<string> | null }, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number }, dataSourceSpecForSettlementData: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } }, dataSourceSpecForTradingTermination: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } }, riskModel: { __typename?: 'LogNormalRiskModel', tau: number, riskAversionParameter: number, params: { __typename?: 'LogNormalModelParams', r: number, sigma: number, mu: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } }, marginCalculator?: { __typename?: 'MarginCalculator', scalingFactors: { __typename?: 'ScalingFactors', searchLevel: number, initialMargin: number, collateralRelease: number } } | null } } | null };
export const DataSourceFragmentDoc = gql`
fragment DataSource on DataSourceDefinition {
@@ -31,6 +31,16 @@ export const DataSourceFragmentDoc = gql`
}
}
}
... on DataSourceDefinitionInternal {
sourceType {
... on DataSourceSpecConfigurationTime {
conditions {
operator
value
}
}
}
}
}
}
`;
@@ -129,6 +129,7 @@ export const MarketInfoAccordion = ({
.filter((a) => a.type === Schema.AccountType.ACCOUNT_TYPE_INSURANCE)
.map((a) => (
<AccordionItem
key={`${a.type}:${a.asset.id}`}
itemId={`${a.type}:${a.asset.id}`}
title={t('Insurance pool')}
content={<InsurancePoolInfoPanel market={market} account={a} />}
@@ -203,6 +204,7 @@ export const MarketInfoAccordion = ({
{(market.priceMonitoringSettings?.parameters?.triggers || []).map(
(_, triggerIndex) => (
<AccordionItem
key={`trigger-${triggerIndex}`}
itemId={`trigger-${triggerIndex}`}
title={t(`Price monitoring bounds ${triggerIndex + 1}`)}
content={
@@ -22,7 +22,7 @@ export type OrdersQueryVariables = Types.Exact<{
export type OrdersQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, ordersConnection?: { __typename?: 'OrderConnection', edges?: Array<{ __typename?: 'OrderEdge', cursor?: string | null, node: { __typename?: 'Order', id: string, type?: Types.OrderType | null, side: Types.Side, size: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, price: string, timeInForce: Types.OrderTimeInForce, remaining: string, expiresAt?: any | null, createdAt: any, updatedAt?: any | null, postOnly?: boolean | null, reduceOnly?: boolean | null, market: { __typename?: 'Market', id: string }, liquidityProvision?: { __typename: 'LiquidityProvision' } | null, peggedOrder?: { __typename: 'PeggedOrder', reference: Types.PeggedReference, offset: string } | null, icebergOrder?: { __typename: 'IcebergOrder', peakSize: string, minimumVisibleSize: string, reservedRemaining: string } | null } }> | null, pageInfo?: { __typename?: 'PageInfo', startCursor: string, endCursor: string, hasNextPage: boolean, hasPreviousPage: boolean } | null } | null } | null };
export type OrderUpdateFieldsFragment = { __typename?: 'OrderUpdate', id: string, marketId: string, type?: Types.OrderType | null, side: Types.Side, size: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, price: string, timeInForce: Types.OrderTimeInForce, remaining: string, expiresAt?: any | null, createdAt: any, updatedAt?: any | null, liquidityProvisionId?: string | null, peggedOrder?: { __typename: 'PeggedOrder', reference: Types.PeggedReference, offset: string } | null, icebergOrder?: { __typename?: 'IcebergOrder', peakSize: string, minimumVisibleSize: string, reservedRemaining: string } | null };
export type OrderUpdateFieldsFragment = { __typename?: 'OrderUpdate', id: string, marketId: string, type?: Types.OrderType | null, side: Types.Side, size: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, price: string, timeInForce: Types.OrderTimeInForce, remaining: string, expiresAt?: any | null, createdAt: any, updatedAt?: any | null, liquidityProvisionId?: string | null, peggedOrder?: { __typename: 'PeggedOrder', reference: Types.PeggedReference, offset: string } | null, icebergOrder?: { __typename: 'IcebergOrder', peakSize: string, minimumVisibleSize: string, reservedRemaining: string } | null };
export type OrdersUpdateSubscriptionVariables = Types.Exact<{
partyId: Types.Scalars['ID'];
@@ -30,7 +30,7 @@ export type OrdersUpdateSubscriptionVariables = Types.Exact<{
}>;
export type OrdersUpdateSubscription = { __typename?: 'Subscription', orders?: Array<{ __typename?: 'OrderUpdate', id: string, marketId: string, type?: Types.OrderType | null, side: Types.Side, size: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, price: string, timeInForce: Types.OrderTimeInForce, remaining: string, expiresAt?: any | null, createdAt: any, updatedAt?: any | null, liquidityProvisionId?: string | null, peggedOrder?: { __typename: 'PeggedOrder', reference: Types.PeggedReference, offset: string } | null, icebergOrder?: { __typename?: 'IcebergOrder', peakSize: string, minimumVisibleSize: string, reservedRemaining: string } | null }> | null };
export type OrdersUpdateSubscription = { __typename?: 'Subscription', orders?: Array<{ __typename?: 'OrderUpdate', id: string, marketId: string, type?: Types.OrderType | null, side: Types.Side, size: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, price: string, timeInForce: Types.OrderTimeInForce, remaining: string, expiresAt?: any | null, createdAt: any, updatedAt?: any | null, liquidityProvisionId?: string | null, peggedOrder?: { __typename: 'PeggedOrder', reference: Types.PeggedReference, offset: string } | null, icebergOrder?: { __typename: 'IcebergOrder', peakSize: string, minimumVisibleSize: string, reservedRemaining: string } | null }> | null };
export const OrderFieldsFragmentDoc = gql`
fragment OrderFields on Order {
@@ -89,6 +89,7 @@ export const OrderUpdateFieldsFragmentDoc = gql`
offset
}
icebergOrder {
__typename
peakSize
minimumVisibleSize
reservedRemaining
@@ -65,7 +65,6 @@ export const mapOrderUpdateToOrder = (
liquidityProvision: liquidityProvision,
icebergOrder: order.icebergOrder
? {
__typename: 'IcebergOrder',
...order.icebergOrder,
}
: undefined,
@@ -267,12 +267,14 @@ export const OrderListTable = memo<
<div className="flex gap-2 items-center justify-end">
{isOrderAmendable(data) && !props.isReadOnly && (
<>
<ButtonLink
data-testid="edit"
onClick={() => onEdit(data)}
>
{t('Edit')}
</ButtonLink>
{!data.icebergOrder && (
<ButtonLink
data-testid="edit"
onClick={() => onEdit(data)}
>
{t('Edit')}
</ButtonLink>
)}
<ButtonLink
data-testid="cancel"
onClick={() => onCancel(data)}
@@ -56,4 +56,4 @@ export function useOrderSubSubscription(baseOptions: Apollo.SubscriptionHookOpti
return Apollo.useSubscription<OrderSubSubscription, OrderSubSubscriptionVariables>(OrderSubDocument, options);
}
export type OrderSubSubscriptionHookResult = ReturnType<typeof useOrderSubSubscription>;
export type OrderSubSubscriptionResult = Apollo.SubscriptionResult<OrderSubSubscription>;
export type OrderSubSubscriptionResult = Apollo.SubscriptionResult<OrderSubSubscription>;
@@ -16,7 +16,13 @@ export type OrderObj = {
persist: boolean; // key used to determine if order should be kept in localStorage
postOnly?: boolean;
reduceOnly?: boolean;
iceberg?: boolean;
icebergOpts?: {
peakSize: string;
minimumVisibleSize: string;
};
};
type OrderMap = { [marketId: string]: OrderObj | undefined };
type UpdateOrder = (
+2
View File
@@ -96,6 +96,8 @@ export enum AccountType {
ACCOUNT_TYPE_HOLDING = 'ACCOUNT_TYPE_HOLDING',
/** Insurance pool account - only for 'system' party */
ACCOUNT_TYPE_INSURANCE = 'ACCOUNT_TYPE_INSURANCE',
/** Per liquidity provider, per market account for holding LPs' fees before distribution */
ACCOUNT_TYPE_LP_LIQUIDITY_FEES = 'ACCOUNT_TYPE_LP_LIQUIDITY_FEES',
/**
* Margin - The leverage account for parties, contains funds set aside for the margin needed to support
* a party's open positions. Each party will have a margin account for each market they have traded in.
+1
View File
@@ -45,6 +45,7 @@ export const AccountTypeMapping: {
ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES: 'Reward Maker paid fees',
ACCOUNT_TYPE_SETTLEMENT: 'Settlement',
ACCOUNT_TYPE_HOLDING: 'Holding',
ACCOUNT_TYPE_LP_LIQUIDITY_FEES: 'LP Liquidity Fees',
};
/**
@@ -4,7 +4,7 @@ import type { ReactNode } from 'react';
export interface FormGroupProps {
children: ReactNode;
className?: string;
label: string; // For accessibility reasons this must always be set for screen readers. If you want it to not show, then use the hideLabel prop"
label: string | ReactNode; // For accessibility reasons this must always be set for screen readers. If you want it to not show, then use the hideLabel prop"
labelFor: string; // Same as above
hideLabel?: boolean;
labelDescription?: string;
+1 -1
View File
@@ -7,7 +7,7 @@ import {
export const formatValue = (
value: string | number | null | undefined,
decimalPlaces: number,
quantum?: string,
quantum?: string | number,
formatDecimals?: number,
emptyValue = '-'
): string => {
+2 -3
View File
@@ -28,7 +28,7 @@ export type OrderTxUpdateSubscriptionVariables = Types.Exact<{
}>;
export type OrderTxUpdateSubscription = { __typename?: 'Subscription', orders?: Array<{ __typename?: 'OrderUpdate', type?: Types.OrderType | null, id: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, createdAt: any, size: string, price: string, timeInForce: Types.OrderTimeInForce, expiresAt?: any | null, side: Types.Side, marketId: string }> | null };
export type OrderTxUpdateSubscription = { __typename?: 'Subscription', orders?: Array<{ __typename?: 'OrderUpdate', type?: Types.OrderType | null, id: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, createdAt: any, size: string, price: string, timeInForce: Types.OrderTimeInForce, expiresAt?: any | null, side: Types.Side, marketId: string }> | null };
export type DepositBusEventFieldsFragment = { __typename?: 'Deposit', id: string, status: Types.DepositStatus, amount: string, createdTimestamp: any, creditedTimestamp?: any | null, txHash?: string | null, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } };
@@ -88,7 +88,6 @@ export const OrderTxUpdateFieldsFragmentDoc = gql`
expiresAt
side
marketId
remaining
}
`;
export const DepositBusEventFieldsFragmentDoc = gql`
@@ -238,4 +237,4 @@ export function useDepositBusEventSubscription(baseOptions: Apollo.SubscriptionH
return Apollo.useSubscription<DepositBusEventSubscription, DepositBusEventSubscriptionVariables>(DepositBusEventDocument, options);
}
export type DepositBusEventSubscriptionHookResult = ReturnType<typeof useDepositBusEventSubscription>;
export type DepositBusEventSubscriptionResult = Apollo.SubscriptionResult<DepositBusEventSubscription>;
export type DepositBusEventSubscriptionResult = Apollo.SubscriptionResult<DepositBusEventSubscription>;
@@ -47,6 +47,10 @@ export interface OrderSubmission {
expiresAt?: string;
postOnly?: boolean;
reduceOnly?: boolean;
icebergOpts?: {
peakSize: string;
minimumVisibleSize: string;
};
}
export interface OrderCancellation {
+7
View File
@@ -50,6 +50,13 @@ export const normalizeOrderSubmission = (
: undefined,
postOnly: order.postOnly,
reduceOnly: order.reduceOnly,
icebergOpts: order.icebergOpts && {
peakSize: removeDecimal(order.icebergOpts.peakSize, positionDecimalPlaces),
minimumVisibleSize: removeDecimal(
order.icebergOpts.minimumVisibleSize,
positionDecimalPlaces
),
},
});
export const normalizeOrderAmendment = <T extends Exact<OrderAmendment, T>>(