chore(trading): shorten market mock
This commit is contained in:
parent
f8f2a3e76b
commit
3250800a1b
@ -191,157 +191,14 @@ describe('mapFormValuesToOrderSubmission', () => {
|
||||
);
|
||||
});
|
||||
|
||||
const market: MarketFieldsFragment = {
|
||||
const mockMarket: MarketFieldsFragment = {
|
||||
__typename: 'Market',
|
||||
id: 'marketId',
|
||||
decimalPlaces: 1,
|
||||
positionDecimalPlaces: 4,
|
||||
state: Schema.MarketState.STATE_ACTIVE,
|
||||
tradingMode: Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS,
|
||||
fees: {
|
||||
__typename: 'Fees',
|
||||
factors: {
|
||||
__typename: 'FeeFactors',
|
||||
makerFee: '0.0002',
|
||||
infrastructureFee: '0.0005',
|
||||
liquidityFee: '0.0001',
|
||||
},
|
||||
liquidityFeeSettings: {
|
||||
__typename: 'LiquidityFeeSettings',
|
||||
feeConstant: null,
|
||||
method: Schema.LiquidityFeeMethod.METHOD_MARGINAL_COST,
|
||||
},
|
||||
},
|
||||
tradableInstrument: {
|
||||
__typename: 'TradableInstrument',
|
||||
instrument: {
|
||||
__typename: 'Instrument',
|
||||
id: '',
|
||||
name: 'Bitcoin / Tether USD (Perpetual)',
|
||||
code: 'BTC/USDT',
|
||||
metadata: {
|
||||
__typename: 'InstrumentMetadata',
|
||||
tags: [
|
||||
'base:BTC',
|
||||
'quote:USDT',
|
||||
'oracle:pyth',
|
||||
'oracleChain:gnosis',
|
||||
'class:fx/crypto',
|
||||
'perpetual',
|
||||
'sector:defi',
|
||||
'enactment:2023-12-01T18:00:00Z',
|
||||
],
|
||||
},
|
||||
product: {
|
||||
__typename: 'Perpetual',
|
||||
quoteName: 'USDT',
|
||||
fundingRateScalingFactor: '1',
|
||||
fundingRateLowerBound: '-0.001',
|
||||
fundingRateUpperBound: '0.001',
|
||||
settlementAsset: {
|
||||
__typename: 'Asset',
|
||||
id: '8ba0b10971f0c4747746cd01ff05a53ae75ca91eba1d4d050b527910c983e27e',
|
||||
symbol: 'USDT',
|
||||
name: 'Tether USD',
|
||||
decimals: 6,
|
||||
quantum: '1000000',
|
||||
},
|
||||
dataSourceSpecForSettlementData: {
|
||||
__typename: 'DataSourceSpec',
|
||||
id: '6c3df6eb28ff3e7db9e6b2b27c62f43b30673df4837ba5e54814063527228939',
|
||||
data: {
|
||||
__typename: 'DataSourceDefinition',
|
||||
sourceType: {
|
||||
__typename: 'DataSourceDefinitionExternal',
|
||||
sourceType: {
|
||||
__typename: 'EthCallSpec',
|
||||
abi: [
|
||||
'[{"inputs": [{"internalType": "bytes32", "name": "id", "type": "bytes32"}], "name": "getPrice", "outputs": [{"internalType": "int256", "name": "", "type": "int256" }], "stateMutability": "view", "type": "function"}]',
|
||||
],
|
||||
address: '0x719abd606155442c21b7d561426d42bd0e40a776',
|
||||
args: ['"5i32yLSoX+GmfbRNwS3l2zMPesZrctxliv7fD0pBW0M="'],
|
||||
method: 'getPrice',
|
||||
requiredConfirmations: 3,
|
||||
normalisers: [
|
||||
{
|
||||
__typename: 'Normaliser',
|
||||
name: 'btc.price',
|
||||
expression: '$[0]',
|
||||
},
|
||||
],
|
||||
trigger: {
|
||||
__typename: 'EthCallTrigger',
|
||||
trigger: {
|
||||
__typename: 'EthTimeTrigger',
|
||||
initial: '2024-02-23T21:44:12Z',
|
||||
every: 60,
|
||||
until: null,
|
||||
},
|
||||
},
|
||||
filters: [
|
||||
{
|
||||
__typename: 'Filter',
|
||||
key: {
|
||||
__typename: 'PropertyKey',
|
||||
name: 'btc.price',
|
||||
type: Schema.PropertyKeyType.TYPE_INTEGER,
|
||||
numberDecimalPlaces: 18,
|
||||
},
|
||||
conditions: [
|
||||
{
|
||||
__typename: 'Condition',
|
||||
value: '0',
|
||||
operator:
|
||||
Schema.ConditionOperator.OPERATOR_GREATER_THAN,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
dataSourceSpecForSettlementSchedule: {
|
||||
__typename: 'DataSourceSpec',
|
||||
id: '5c45c686b8cf0b5bd85a5c39608cbec3d0e6e49a318264eaaf8c3f45d37255dc',
|
||||
data: {
|
||||
__typename: 'DataSourceDefinition',
|
||||
sourceType: {
|
||||
__typename: 'DataSourceDefinitionInternal',
|
||||
sourceType: {
|
||||
__typename: 'DataSourceSpecConfigurationTimeTrigger',
|
||||
triggers: [
|
||||
{
|
||||
__typename: 'InternalTimeTrigger',
|
||||
initial: 1708724652,
|
||||
every: 28800,
|
||||
},
|
||||
],
|
||||
conditions: [
|
||||
{
|
||||
__typename: 'Condition',
|
||||
operator: Schema.ConditionOperator.OPERATOR_GREATER_THAN,
|
||||
value: '0',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
dataSourceSpecBinding: {
|
||||
__typename: 'DataSourceSpecPerpetualBinding',
|
||||
settlementDataProperty: 'btc.price',
|
||||
settlementScheduleProperty: 'vegaprotocol.builtin.timetrigger',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
marketTimestamps: {
|
||||
__typename: 'MarketTimestamps',
|
||||
open: '2024-02-16T20:25:45.340803198Z',
|
||||
close: null,
|
||||
},
|
||||
};
|
||||
} as MarketFieldsFragment;
|
||||
|
||||
const orderFormValues: OrderFormValues = {
|
||||
type: OrderType.TYPE_LIMIT,
|
||||
@ -361,7 +218,7 @@ describe('mapFormValuesToTakeProfitAndStopLoss', () => {
|
||||
it('creates batch market instructions for a normal order created with TP and SL', () => {
|
||||
const result = mapFormValuesToTakeProfitAndStopLoss(
|
||||
orderFormValues,
|
||||
market,
|
||||
mockMarket,
|
||||
'reference'
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user