fix: apollo in memory tradable instrument (#1036)
* fix: update appolo client and set key fields for instruments * fix: use in-memory cache and tradable instrument id * fix: revert switch case * fix: add more info in gen market list for home.cy.ts * fix: instrument keyfield still false * fix: revert simple trading app and explorer updates - fixing tests * fix: remove id from instrument data provider in simple trading app * fix: remove id from market selector market names query * Update apps/trading-e2e/src/support/mocks/generate-market-list.ts * Update apps/trading-e2e/src/support/mocks/generate-market-list.ts * Update apps/trading-e2e/src/support/mocks/generate-market-list.ts * Update apps/trading-e2e/src/support/mocks/generate-market-list.ts
This commit is contained in:
parent
b50b8091cf
commit
738c93606b
@ -65,7 +65,7 @@ describe('home', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// the oldest market trading in continous mode shown at top of overlay table
|
// the oldest market trading in continuos mode shown at top of overlay table
|
||||||
cy.get('table tr')
|
cy.get('table tr')
|
||||||
.eq(1)
|
.eq(1)
|
||||||
.within(() =>
|
.within(() =>
|
||||||
|
@ -18,14 +18,16 @@ export const generateMarketList = (
|
|||||||
positionDecimalPlaces: 0,
|
positionDecimalPlaces: 0,
|
||||||
state: MarketState.Active,
|
state: MarketState.Active,
|
||||||
tradingMode: MarketTradingMode.Continuous,
|
tradingMode: MarketTradingMode.Continuous,
|
||||||
|
positionDecimalPlaces: 2,
|
||||||
|
name: 'Market 0',
|
||||||
fees: {
|
fees: {
|
||||||
factors: {
|
|
||||||
makerFee: '0.0002',
|
|
||||||
infrastructureFee: '0.0005',
|
|
||||||
liquidityFee: '0.001',
|
|
||||||
__typename: 'FeeFactors',
|
|
||||||
},
|
|
||||||
__typename: 'Fees',
|
__typename: 'Fees',
|
||||||
|
factors: {
|
||||||
|
__typename: 'FeeFactors',
|
||||||
|
makerFee: '0.001',
|
||||||
|
liquidityFee: '0.001',
|
||||||
|
infrastructureFee: '0.001',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
market: {
|
market: {
|
||||||
@ -33,6 +35,8 @@ export const generateMarketList = (
|
|||||||
state: MarketState.Active,
|
state: MarketState.Active,
|
||||||
tradingMode: MarketTradingMode.Continuous,
|
tradingMode: MarketTradingMode.Continuous,
|
||||||
__typename: 'Market',
|
__typename: 'Market',
|
||||||
|
state: MarketState.Active,
|
||||||
|
tradingMode: MarketTradingMode.Continuous,
|
||||||
},
|
},
|
||||||
bestBidPrice: '2411432389',
|
bestBidPrice: '2411432389',
|
||||||
bestOfferPrice: '2346732714',
|
bestOfferPrice: '2346732714',
|
||||||
@ -40,9 +44,21 @@ export const generateMarketList = (
|
|||||||
trigger: AuctionTrigger.Price,
|
trigger: AuctionTrigger.Price,
|
||||||
indicativeVolume: '1216',
|
indicativeVolume: '1216',
|
||||||
__typename: 'MarketData',
|
__typename: 'MarketData',
|
||||||
|
bestBidPrice: '4612690058',
|
||||||
|
bestOfferPrice: '4612690058',
|
||||||
|
trigger: AuctionTrigger.Liquidity,
|
||||||
|
indicativeVolume: '0',
|
||||||
},
|
},
|
||||||
tradableInstrument: {
|
tradableInstrument: {
|
||||||
instrument: {
|
instrument: {
|
||||||
|
id: '10cd0a793ad2887b340940337fa6d97a212e0e517fe8e9eab2b5ef3a38633f35',
|
||||||
|
product: {
|
||||||
|
__typename: 'Future',
|
||||||
|
settlementAsset: {
|
||||||
|
__typename: 'Asset',
|
||||||
|
symbol: 'ETH',
|
||||||
|
},
|
||||||
|
},
|
||||||
name: 'BTC/USD Monthly',
|
name: 'BTC/USD Monthly',
|
||||||
code: 'BTCUSD.MF21',
|
code: 'BTCUSD.MF21',
|
||||||
metadata: {
|
metadata: {
|
||||||
@ -83,22 +99,48 @@ export const generateMarketList = (
|
|||||||
positionDecimalPlaces: 0,
|
positionDecimalPlaces: 0,
|
||||||
state: MarketState.Suspended,
|
state: MarketState.Suspended,
|
||||||
tradingMode: MarketTradingMode.MonitoringAuction,
|
tradingMode: MarketTradingMode.MonitoringAuction,
|
||||||
|
name: 'BTC/USD Monthly',
|
||||||
|
positionDecimalPlaces: 2,
|
||||||
|
fees: {
|
||||||
|
__typename: 'Fees',
|
||||||
|
factors: {
|
||||||
|
__typename: 'FeeFactors',
|
||||||
|
makerFee: '0.001',
|
||||||
|
liquidityFee: '0.001',
|
||||||
|
infrastructureFee: '0.001',
|
||||||
|
},
|
||||||
|
},
|
||||||
data: {
|
data: {
|
||||||
market: {
|
market: {
|
||||||
id: '34d95e10faa00c21d19d382d6d7e6fc9722a96985369f0caec041b0f44b775ed',
|
id: '34d95e10faa00c21d19d382d6d7e6fc9722a96985369f0caec041b0f44b775ed',
|
||||||
state: MarketState.Suspended,
|
state: MarketState.Suspended,
|
||||||
tradingMode: MarketTradingMode.MonitoringAuction,
|
tradingMode: MarketTradingMode.MonitoringAuction,
|
||||||
__typename: 'Market',
|
__typename: 'Market',
|
||||||
|
state: MarketState.Suspended,
|
||||||
|
tradingMode: MarketTradingMode.MonitoringAuction,
|
||||||
},
|
},
|
||||||
bestBidPrice: '17065127',
|
bestBidPrice: '17065127',
|
||||||
bestOfferPrice: '17017654',
|
bestOfferPrice: '17017654',
|
||||||
markPrice: '8441',
|
markPrice: '8441',
|
||||||
indicativeVolume: '249',
|
indicativeVolume: '249',
|
||||||
__typename: 'MarketData',
|
__typename: 'MarketData',
|
||||||
|
bestBidPrice: '4612690058',
|
||||||
|
bestOfferPrice: '4612690058',
|
||||||
|
trigger: AuctionTrigger.Liquidity,
|
||||||
|
|
||||||
|
indicativeVolume: '0',
|
||||||
},
|
},
|
||||||
tradableInstrument: {
|
tradableInstrument: {
|
||||||
instrument: {
|
instrument: {
|
||||||
|
product: {
|
||||||
|
__typename: 'Future',
|
||||||
|
settlementAsset: {
|
||||||
|
__typename: 'Asset',
|
||||||
|
symbol: 'ETH',
|
||||||
|
},
|
||||||
|
},
|
||||||
name: 'SOL/USD',
|
name: 'SOL/USD',
|
||||||
|
id: '34d95e10faa00c21d19d382d6d7e6fc9722a96985369f0caec041b0f44b775ed',
|
||||||
code: 'SOLUSD',
|
code: 'SOLUSD',
|
||||||
metadata: {
|
metadata: {
|
||||||
__typename: 'InstrumentMetadata',
|
__typename: 'InstrumentMetadata',
|
||||||
|
@ -33,6 +33,12 @@ export function createClient(base?: string) {
|
|||||||
Instrument: {
|
Instrument: {
|
||||||
keyFields: false,
|
keyFields: false,
|
||||||
},
|
},
|
||||||
|
TradableInstrument: {
|
||||||
|
keyFields: ['instrument'],
|
||||||
|
},
|
||||||
|
Product: {
|
||||||
|
keyFields: ['settlementAsset', ['id']],
|
||||||
|
},
|
||||||
MarketData: {
|
MarketData: {
|
||||||
keyFields: ['market', ['id']],
|
keyFields: ['market', ['id']],
|
||||||
},
|
},
|
||||||
|
@ -40,6 +40,7 @@ const MARKET_QUERY = gql`
|
|||||||
}
|
}
|
||||||
tradableInstrument {
|
tradableInstrument {
|
||||||
instrument {
|
instrument {
|
||||||
|
id
|
||||||
name
|
name
|
||||||
code
|
code
|
||||||
metadata {
|
metadata {
|
||||||
|
@ -111,6 +111,10 @@ export interface Market_market_tradableInstrument_instrument_product {
|
|||||||
|
|
||||||
export interface Market_market_tradableInstrument_instrument {
|
export interface Market_market_tradableInstrument_instrument {
|
||||||
__typename: "Instrument";
|
__typename: "Instrument";
|
||||||
|
/**
|
||||||
|
* Uniquely identify an instrument across all instruments available on Vega (string)
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
/**
|
/**
|
||||||
* Full and fairly descriptive name for the instrument
|
* Full and fairly descriptive name for the instrument
|
||||||
*/
|
*/
|
||||||
|
@ -39,6 +39,10 @@ export interface DealTicketQuery_market_tradableInstrument_instrument_product {
|
|||||||
|
|
||||||
export interface DealTicketQuery_market_tradableInstrument_instrument {
|
export interface DealTicketQuery_market_tradableInstrument_instrument {
|
||||||
__typename: "Instrument";
|
__typename: "Instrument";
|
||||||
|
/**
|
||||||
|
* Uniquely identify an instrument across all instruments available on Vega (string)
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
/**
|
/**
|
||||||
* A reference to or instance of a fully specified product, including all required product parameters for that product (Product union)
|
* A reference to or instance of a fully specified product, including all required product parameters for that product (Product union)
|
||||||
*/
|
*/
|
||||||
|
@ -15,6 +15,7 @@ const DEAL_TICKET_QUERY = gql`
|
|||||||
tradingMode
|
tradingMode
|
||||||
tradableInstrument {
|
tradableInstrument {
|
||||||
instrument {
|
instrument {
|
||||||
|
id
|
||||||
product {
|
product {
|
||||||
... on Future {
|
... on Future {
|
||||||
quoteName
|
quoteName
|
||||||
|
@ -103,6 +103,10 @@ export interface MarketList_markets_tradableInstrument_instrument_product {
|
|||||||
|
|
||||||
export interface MarketList_markets_tradableInstrument_instrument {
|
export interface MarketList_markets_tradableInstrument_instrument {
|
||||||
__typename: "Instrument";
|
__typename: "Instrument";
|
||||||
|
/**
|
||||||
|
* Uniquely identify an instrument across all instruments available on Vega (string)
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
/**
|
/**
|
||||||
* Full and fairly descriptive name for the instrument
|
* Full and fairly descriptive name for the instrument
|
||||||
*/
|
*/
|
||||||
|
@ -53,6 +53,7 @@ export const MARKET_LIST_QUERY = gql`
|
|||||||
}
|
}
|
||||||
tradableInstrument {
|
tradableInstrument {
|
||||||
instrument {
|
instrument {
|
||||||
|
id
|
||||||
name
|
name
|
||||||
code
|
code
|
||||||
metadata {
|
metadata {
|
||||||
|
@ -23,6 +23,7 @@ export const generateOrder = (
|
|||||||
tradableInstrument: {
|
tradableInstrument: {
|
||||||
__typename: 'TradableInstrument',
|
__typename: 'TradableInstrument',
|
||||||
instrument: {
|
instrument: {
|
||||||
|
id: 'instrument-id',
|
||||||
__typename: 'Instrument',
|
__typename: 'Instrument',
|
||||||
code: 'instrument-code',
|
code: 'instrument-code',
|
||||||
},
|
},
|
||||||
|
@ -11,6 +11,10 @@ import { OrderType, Side, OrderStatus, OrderRejectionReason, OrderTimeInForce }
|
|||||||
|
|
||||||
export interface OrderFields_market_tradableInstrument_instrument {
|
export interface OrderFields_market_tradableInstrument_instrument {
|
||||||
__typename: "Instrument";
|
__typename: "Instrument";
|
||||||
|
/**
|
||||||
|
* Uniquely identify an instrument across all instruments available on Vega (string)
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
/**
|
/**
|
||||||
* A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string)
|
* A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string)
|
||||||
*/
|
*/
|
||||||
|
@ -11,6 +11,10 @@ import { OrderType, Side, OrderStatus, OrderRejectionReason, OrderTimeInForce }
|
|||||||
|
|
||||||
export interface OrderSub_orders_market_tradableInstrument_instrument {
|
export interface OrderSub_orders_market_tradableInstrument_instrument {
|
||||||
__typename: "Instrument";
|
__typename: "Instrument";
|
||||||
|
/**
|
||||||
|
* Uniquely identify an instrument across all instruments available on Vega (string)
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
/**
|
/**
|
||||||
* A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string)
|
* A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string)
|
||||||
*/
|
*/
|
||||||
|
@ -11,6 +11,10 @@ import { Pagination, OrderType, Side, OrderStatus, OrderRejectionReason, OrderTi
|
|||||||
|
|
||||||
export interface Orders_party_ordersConnection_edges_node_market_tradableInstrument_instrument {
|
export interface Orders_party_ordersConnection_edges_node_market_tradableInstrument_instrument {
|
||||||
__typename: "Instrument";
|
__typename: "Instrument";
|
||||||
|
/**
|
||||||
|
* Uniquely identify an instrument across all instruments available on Vega (string)
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
/**
|
/**
|
||||||
* A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string)
|
* A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string)
|
||||||
*/
|
*/
|
||||||
|
@ -24,6 +24,7 @@ const ORDER_FRAGMENT = gql`
|
|||||||
positionDecimalPlaces
|
positionDecimalPlaces
|
||||||
tradableInstrument {
|
tradableInstrument {
|
||||||
instrument {
|
instrument {
|
||||||
|
id
|
||||||
code
|
code
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,12 +120,12 @@ export const OrderListTable = forwardRef<AgGridReact, OrderListTableProps>(
|
|||||||
data,
|
data,
|
||||||
}: {
|
}: {
|
||||||
data: Orders_party_ordersConnection_edges_node;
|
data: Orders_party_ordersConnection_edges_node;
|
||||||
}) => data.side === Side.Buy,
|
}) => data?.side === Side.Buy,
|
||||||
'text-vega-red-dark dark:text-vega-red': ({
|
'text-vega-red-dark dark:text-vega-red': ({
|
||||||
data,
|
data,
|
||||||
}: {
|
}: {
|
||||||
data: Orders_party_ordersConnection_edges_node;
|
data: Orders_party_ordersConnection_edges_node;
|
||||||
}) => data.side === Side.Sell,
|
}) => data?.side === Side.Sell,
|
||||||
}}
|
}}
|
||||||
valueFormatter={({
|
valueFormatter={({
|
||||||
value,
|
value,
|
||||||
@ -136,7 +136,7 @@ export const OrderListTable = forwardRef<AgGridReact, OrderListTableProps>(
|
|||||||
if (value === undefined || !data || !data.market) {
|
if (value === undefined || !data || !data.market) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
const prefix = data.side === Side.Buy ? '+' : '-';
|
const prefix = data ? (data.side === Side.Buy ? '+' : '-') : '';
|
||||||
return (
|
return (
|
||||||
prefix + addDecimal(value, data.market.positionDecimalPlaces)
|
prefix + addDecimal(value, data.market.positionDecimalPlaces)
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user