Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: apollo in memory tradable instrument #1036

Merged
merged 26 commits into from
Aug 19, 2022
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
937f4be
Merge branch 'master' of github.com:vegaprotocol/frontend-monorepo
MadalinaRaicu Aug 6, 2022
d28d238
Merge branch 'master' of github.com:vegaprotocol/frontend-monorepo
MadalinaRaicu Aug 9, 2022
0413ef1
Merge branch 'master' of github.com:vegaprotocol/frontend-monorepo
MadalinaRaicu Aug 9, 2022
fbecf0b
Merge
MadalinaRaicu Aug 10, 2022
c7c4204
Merge branch 'master' of github.com:vegaprotocol/frontend-monorepo
MadalinaRaicu Aug 10, 2022
9715b68
Merge branch 'master' of github.com:vegaprotocol/frontend-monorepo
MadalinaRaicu Aug 11, 2022
74de416
fix: update appolo client and set key fields for instruments
MadalinaRaicu Aug 12, 2022
fdff32b
Merge branch 'master' of github.com:vegaprotocol/frontend-monorepo in…
MadalinaRaicu Aug 14, 2022
9de1e30
fix: use in-memory cache and tradable instrument id
MadalinaRaicu Aug 15, 2022
7e7f976
fix: revert switch case
MadalinaRaicu Aug 15, 2022
281c244
Merge branch 'master' of github.com:vegaprotocol/frontend-monorepo in…
MadalinaRaicu Aug 15, 2022
bd9b6df
fix: add more info in gen market list for home.cy.ts
MadalinaRaicu Aug 15, 2022
42cae14
Merge branch 'master' of github.com:vegaprotocol/frontend-monorepo in…
MadalinaRaicu Aug 16, 2022
3662907
Merge branch 'master' of github.com:vegaprotocol/frontend-monorepo in…
MadalinaRaicu Aug 16, 2022
348ba7f
Merge branch 'master' of github.com:vegaprotocol/frontend-monorepo in…
MadalinaRaicu Aug 18, 2022
b4ec5fe
Merge branch 'master' of github.com:vegaprotocol/frontend-monorepo in…
MadalinaRaicu Aug 18, 2022
5023a57
fix: instrument keyfield still false
MadalinaRaicu Aug 18, 2022
90f1590
fix: revert simple trading app and explorer updates - fixing tests
MadalinaRaicu Aug 18, 2022
5371267
fix: remove id from instrument data provider in simple trading app
MadalinaRaicu Aug 18, 2022
cfd6db7
fix: remove id from market selector market names query
MadalinaRaicu Aug 18, 2022
22c1e42
Update apps/trading-e2e/src/support/mocks/generate-market-list.ts
MadalinaRaicu Aug 18, 2022
5795875
Update apps/trading-e2e/src/support/mocks/generate-market-list.ts
MadalinaRaicu Aug 18, 2022
a6f3934
Update apps/trading-e2e/src/support/mocks/generate-market-list.ts
MadalinaRaicu Aug 18, 2022
1b949b5
Update apps/trading-e2e/src/support/mocks/generate-market-list.ts
MadalinaRaicu Aug 18, 2022
2a0cb94
Merge branch 'master' of github.com:vegaprotocol/frontend-monorepo in…
MadalinaRaicu Aug 18, 2022
f96f2a8
Merge branch 'fix/apollo-in-memory-tradable-instrument' of github.com…
MadalinaRaicu Aug 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions apps/explorer/src/app/routes/markets/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const MARKETS_QUERY = gql`
}
tradableInstrument {
instrument {
id
name
metadata {
tags
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const MARKET_TAGS_QUERY = gql`
market(id: $marketId) {
tradableInstrument {
instrument {
id
metadata {
tags
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const MARKETS_QUERY = gql`
}
tradableInstrument {
instrument {
id
code
metadata {
tags
Expand Down
2 changes: 1 addition & 1 deletion apps/trading-e2e/src/integration/home.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() =>
Expand Down
77 changes: 74 additions & 3 deletions apps/trading-e2e/src/support/mocks/generate-market-list.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import merge from 'lodash/merge';
import type { PartialDeep } from 'type-fest';
import type { MarketList, MarketList_markets } from '@vegaprotocol/market-list';
import { MarketState, MarketTradingMode } from '@vegaprotocol/types';
import {
AuctionTrigger,
MarketState,
MarketTradingMode,
} from '@vegaprotocol/types';

export const generateMarketList = (
override?: PartialDeep<MarketList>
Expand All @@ -12,16 +16,41 @@ export const generateMarketList = (
decimalPlaces: 5,
state: MarketState.Active,
tradingMode: MarketTradingMode.Continuous,
positionDecimalPlaces: 2,
name: 'Market 0',
fees: {
__typename: 'Fees',
factors: {
__typename: 'FeeFactors',
makerFee: '0.001',
liquidityFee: '0.001',
infrastructureFee: '0.001',
},
},
data: {
market: {
id: '10cd0a793ad2887b340940337fa6d97a212e0e517fe8e9eab2b5ef3a38633f35',
__typename: 'Market',
state: MarketState.Active,
tradingMode: MarketTradingMode.Continuous,
},
markPrice: '4612690058',
__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: {
Expand All @@ -37,25 +66,59 @@ export const generateMarketList = (
open: '',
close: '',
},
candles: [{ __typename: 'Candle', open: '100', close: '100' }],
candles: [
{
__typename: 'Candle',
open: '100',
close: '100',
high: '100',
MadalinaRaicu marked this conversation as resolved.
Show resolved Hide resolved
low: '100',
MadalinaRaicu marked this conversation as resolved.
Show resolved Hide resolved
},
],
__typename: 'Market',
},
{
id: 'market-1',
decimalPlaces: 2,
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',
__typename: 'Market',
state: MarketState.Suspended,
tradingMode: MarketTradingMode.MonitoringAuction,
},
markPrice: '8441',
__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',
Expand All @@ -70,7 +133,15 @@ export const generateMarketList = (
open: '',
close: '',
},
candles: [{ __typename: 'Candle', open: '100', close: '100' }],
candles: [
{
__typename: 'Candle',
open: '100',
close: '100',
high: '100',
MadalinaRaicu marked this conversation as resolved.
Show resolved Hide resolved
low: '100',
MadalinaRaicu marked this conversation as resolved.
Show resolved Hide resolved
},
],
__typename: 'Market',
},
];
Expand Down
8 changes: 7 additions & 1 deletion apps/trading/lib/apollo-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ export function createClient(base?: string) {
},
},
Instrument: {
keyFields: false,
keyFields: ['product'],
},
TradableInstrument: {
keyFields: ['instrument'],
},
Product: {
keyFields: ['settlementAsset', ['id']],
},
MarketData: {
keyFields: ['market', ['id']],
Expand Down
1 change: 1 addition & 0 deletions apps/trading/pages/markets/[marketId].page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const MARKET_QUERY = gql`
}
tradableInstrument {
instrument {
id
name
code
metadata {
Expand Down
4 changes: 4 additions & 0 deletions apps/trading/pages/markets/__generated__/Market.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions libs/deal-ticket/src/components/__generated__/MarketNames.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions libs/deal-ticket/src/components/deal-ticket-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const DEAL_TICKET_QUERY = gql`
tradingMode
tradableInstrument {
instrument {
id
product {
... on Future {
quoteName
Expand Down
2 changes: 2 additions & 0 deletions libs/deal-ticket/src/components/market-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ export const MARKET_NAMES_QUERY = gql`
name
tradableInstrument {
instrument {
id
code
metadata {
tags
}
product {
... on Future {
id
quoteName
}
}
Expand Down
4 changes: 4 additions & 0 deletions libs/market-list/src/lib/__generated__/MarketList.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion libs/market-list/src/lib/components/select-market.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const SelectAllMarketsTableBody = ({
) : (
<thead>
<tr>
<td className="text-black dark:text-white text-h5">
<td className="text-black dark:text-white text-ui">
{t('Loading market data...')}
</td>
</tr>
Expand Down
1 change: 1 addition & 0 deletions libs/market-list/src/lib/markets-data-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const MARKET_LIST_QUERY = gql`
}
tradableInstrument {
instrument {
id
name
code
metadata {
Expand Down
1 change: 1 addition & 0 deletions libs/orders/src/lib/components/mocks/generate-orders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const generateOrder = (
tradableInstrument: {
__typename: 'TradableInstrument',
instrument: {
id: 'instrument-id',
__typename: 'Instrument',
code: 'instrument-code',
},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const ORDER_FRAGMENT = gql`
positionDecimalPlaces
tradableInstrument {
instrument {
id
code
}
}
Expand Down