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')
|
||||
.eq(1)
|
||||
.within(() =>
|
||||
|
@ -18,14 +18,16 @@ export const generateMarketList = (
|
||||
positionDecimalPlaces: 0,
|
||||
state: MarketState.Active,
|
||||
tradingMode: MarketTradingMode.Continuous,
|
||||
positionDecimalPlaces: 2,
|
||||
name: 'Market 0',
|
||||
fees: {
|
||||
factors: {
|
||||
makerFee: '0.0002',
|
||||
infrastructureFee: '0.0005',
|
||||
liquidityFee: '0.001',
|
||||
__typename: 'FeeFactors',
|
||||
},
|
||||
__typename: 'Fees',
|
||||
factors: {
|
||||
__typename: 'FeeFactors',
|
||||
makerFee: '0.001',
|
||||
liquidityFee: '0.001',
|
||||
infrastructureFee: '0.001',
|
||||
},
|
||||
},
|
||||
data: {
|
||||
market: {
|
||||
@ -33,6 +35,8 @@ export const generateMarketList = (
|
||||
state: MarketState.Active,
|
||||
tradingMode: MarketTradingMode.Continuous,
|
||||
__typename: 'Market',
|
||||
state: MarketState.Active,
|
||||
tradingMode: MarketTradingMode.Continuous,
|
||||
},
|
||||
bestBidPrice: '2411432389',
|
||||
bestOfferPrice: '2346732714',
|
||||
@ -40,9 +44,21 @@ export const generateMarketList = (
|
||||
trigger: AuctionTrigger.Price,
|
||||
indicativeVolume: '1216',
|
||||
__typename: 'MarketData',
|
||||
bestBidPrice: '4612690058',
|
||||
bestOfferPrice: '4612690058',
|
||||
trigger: AuctionTrigger.Liquidity,
|
||||
indicativeVolume: '0',
|
||||
},
|
||||
tradableInstrument: {
|
||||
instrument: {
|
||||
id: '10cd0a793ad2887b340940337fa6d97a212e0e517fe8e9eab2b5ef3a38633f35',
|
||||
product: {
|
||||
__typename: 'Future',
|
||||
settlementAsset: {
|
||||
__typename: 'Asset',
|
||||
symbol: 'ETH',
|
||||
},
|
||||
},
|
||||
name: 'BTC/USD Monthly',
|
||||
code: 'BTCUSD.MF21',
|
||||
metadata: {
|
||||
@ -83,22 +99,48 @@ export const generateMarketList = (
|
||||
positionDecimalPlaces: 0,
|
||||
state: MarketState.Suspended,
|
||||
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: {
|
||||
market: {
|
||||
id: '34d95e10faa00c21d19d382d6d7e6fc9722a96985369f0caec041b0f44b775ed',
|
||||
state: MarketState.Suspended,
|
||||
tradingMode: MarketTradingMode.MonitoringAuction,
|
||||
__typename: 'Market',
|
||||
state: MarketState.Suspended,
|
||||
tradingMode: MarketTradingMode.MonitoringAuction,
|
||||
},
|
||||
bestBidPrice: '17065127',
|
||||
bestOfferPrice: '17017654',
|
||||
markPrice: '8441',
|
||||
indicativeVolume: '249',
|
||||
__typename: 'MarketData',
|
||||
bestBidPrice: '4612690058',
|
||||
bestOfferPrice: '4612690058',
|
||||
trigger: AuctionTrigger.Liquidity,
|
||||
|
||||
indicativeVolume: '0',
|
||||
},
|
||||
tradableInstrument: {
|
||||
instrument: {
|
||||
product: {
|
||||
__typename: 'Future',
|
||||
settlementAsset: {
|
||||
__typename: 'Asset',
|
||||
symbol: 'ETH',
|
||||
},
|
||||
},
|
||||
name: 'SOL/USD',
|
||||
id: '34d95e10faa00c21d19d382d6d7e6fc9722a96985369f0caec041b0f44b775ed',
|
||||
code: 'SOLUSD',
|
||||
metadata: {
|
||||
__typename: 'InstrumentMetadata',
|
||||
|
@ -33,6 +33,12 @@ export function createClient(base?: string) {
|
||||
Instrument: {
|
||||
keyFields: false,
|
||||
},
|
||||
TradableInstrument: {
|
||||
keyFields: ['instrument'],
|
||||
},
|
||||
Product: {
|
||||
keyFields: ['settlementAsset', ['id']],
|
||||
},
|
||||
MarketData: {
|
||||
keyFields: ['market', ['id']],
|
||||
},
|
||||
|
@ -40,6 +40,7 @@ const MARKET_QUERY = gql`
|
||||
}
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
id
|
||||
name
|
||||
code
|
||||
metadata {
|
||||
|
@ -111,6 +111,10 @@ export interface Market_market_tradableInstrument_instrument_product {
|
||||
|
||||
export interface Market_market_tradableInstrument_instrument {
|
||||
__typename: "Instrument";
|
||||
/**
|
||||
* Uniquely identify an instrument across all instruments available on Vega (string)
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* 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 {
|
||||
__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)
|
||||
*/
|
||||
|
@ -15,6 +15,7 @@ const DEAL_TICKET_QUERY = gql`
|
||||
tradingMode
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
id
|
||||
product {
|
||||
... on Future {
|
||||
quoteName
|
||||
|
@ -103,6 +103,10 @@ export interface MarketList_markets_tradableInstrument_instrument_product {
|
||||
|
||||
export interface MarketList_markets_tradableInstrument_instrument {
|
||||
__typename: "Instrument";
|
||||
/**
|
||||
* Uniquely identify an instrument across all instruments available on Vega (string)
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Full and fairly descriptive name for the instrument
|
||||
*/
|
||||
|
@ -53,6 +53,7 @@ export const MARKET_LIST_QUERY = gql`
|
||||
}
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
id
|
||||
name
|
||||
code
|
||||
metadata {
|
||||
|
@ -23,6 +23,7 @@ export const generateOrder = (
|
||||
tradableInstrument: {
|
||||
__typename: 'TradableInstrument',
|
||||
instrument: {
|
||||
id: 'instrument-id',
|
||||
__typename: 'Instrument',
|
||||
code: 'instrument-code',
|
||||
},
|
||||
|
@ -11,6 +11,10 @@ import { OrderType, Side, OrderStatus, OrderRejectionReason, OrderTimeInForce }
|
||||
|
||||
export interface OrderFields_market_tradableInstrument_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)
|
||||
*/
|
||||
|
@ -11,6 +11,10 @@ import { OrderType, Side, OrderStatus, OrderRejectionReason, OrderTimeInForce }
|
||||
|
||||
export interface OrderSub_orders_market_tradableInstrument_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)
|
||||
*/
|
||||
|
@ -11,6 +11,10 @@ import { Pagination, OrderType, Side, OrderStatus, OrderRejectionReason, OrderTi
|
||||
|
||||
export interface Orders_party_ordersConnection_edges_node_market_tradableInstrument_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)
|
||||
*/
|
||||
|
@ -24,6 +24,7 @@ const ORDER_FRAGMENT = gql`
|
||||
positionDecimalPlaces
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
id
|
||||
code
|
||||
}
|
||||
}
|
||||
|
@ -120,12 +120,12 @@ export const OrderListTable = forwardRef<AgGridReact, OrderListTableProps>(
|
||||
data,
|
||||
}: {
|
||||
data: Orders_party_ordersConnection_edges_node;
|
||||
}) => data.side === Side.Buy,
|
||||
}) => data?.side === Side.Buy,
|
||||
'text-vega-red-dark dark:text-vega-red': ({
|
||||
data,
|
||||
}: {
|
||||
data: Orders_party_ordersConnection_edges_node;
|
||||
}) => data.side === Side.Sell,
|
||||
}) => data?.side === Side.Sell,
|
||||
}}
|
||||
valueFormatter={({
|
||||
value,
|
||||
@ -136,7 +136,7 @@ export const OrderListTable = forwardRef<AgGridReact, OrderListTableProps>(
|
||||
if (value === undefined || !data || !data.market) {
|
||||
return undefined;
|
||||
}
|
||||
const prefix = data.side === Side.Buy ? '+' : '-';
|
||||
const prefix = data ? (data.side === Side.Buy ? '+' : '-') : '';
|
||||
return (
|
||||
prefix + addDecimal(value, data.market.positionDecimalPlaces)
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user