Compare commits

...
Author SHA1 Message Date
Matthew Russell 024be309b5 chore: v0.55.0-0.0 2022-09-20 18:51:14 -07:00
Matthew Russell e62f5f8ea2 fix: revert to deprecated candles query due to core bug 2022-09-20 18:48:01 -07:00
75 changed files with 984 additions and 1460 deletions
@@ -3,7 +3,7 @@ import { MarketState } from '@vegaprotocol/types';
import type {
Market,
MarketsCandlesQuery_marketsConnection_edges_node,
MarketsCandlesQuery_marketsConnection_edges_node_candlesConnection_edges,
MarketsCandlesQuery_marketsConnection_edges_node_candles,
Markets,
MarketsCandlesQuery,
MarketsDataQuery,
@@ -516,20 +516,13 @@ export const generateMarketsCandles = (): MarketsCandlesQuery => {
{
id: protoMarket.id,
__typename: 'Market',
candlesConnection: {
__typename: 'CandleDataConnection',
edges: protoCandles.map((node) => ({
__typename: 'CandleEdge',
node,
})) as unknown as MarketsCandlesQuery_marketsConnection_edges_node_candlesConnection_edges[],
},
candles:
protoCandles as MarketsCandlesQuery_marketsConnection_edges_node_candles[],
},
{
id: '6030e5b4e0ca3297a26081e5af4d453f97f96baab2d74bf56f84efcffc4c382f',
__typename: 'Market',
candlesConnection: {
__typename: 'CandleDataConnection',
edges: [
candles: [
{ open: '723082', close: '726800', __typename: 'Candle' },
{
open: '726800',
@@ -602,18 +595,12 @@ export const generateMarketsCandles = (): MarketsCandlesQuery => {
close: '761777',
__typename: 'Candle',
},
].map((node) => ({
__typename: 'CandleEdge',
node,
})) as unknown as MarketsCandlesQuery_marketsConnection_edges_node_candlesConnection_edges[],
},
] as MarketsCandlesQuery_marketsConnection_edges_node_candles[],
},
{
id: 'de74a5572045b300e8ec50d136896912ec76e7d7ec135bc305dfd4854d9363a4',
__typename: 'Market',
candlesConnection: {
__typename: 'CandleDataConnection',
edges: [
candles: [
{ open: '14602', close: '14596', __typename: 'Candle' },
{
open: '14596',
@@ -686,18 +673,12 @@ export const generateMarketsCandles = (): MarketsCandlesQuery => {
close: '14467',
__typename: 'Candle',
},
].map((node) => ({
__typename: 'CandleEdge',
node,
})) as unknown as MarketsCandlesQuery_marketsConnection_edges_node_candlesConnection_edges[],
},
] as MarketsCandlesQuery_marketsConnection_edges_node_candles[],
},
{
id: '87b0bbb3c171baa5d97dfc3852332829c91e5c5dc9f7c8fb584c6d8ac75aaaf2',
__typename: 'Market',
candlesConnection: {
__typename: 'CandleDataConnection',
edges: [
candles: [
{ open: '5700', close: '5688', __typename: 'Candle' },
{
open: '5688',
@@ -758,18 +739,12 @@ export const generateMarketsCandles = (): MarketsCandlesQuery => {
close: '5768',
__typename: 'Candle',
},
].map((node) => ({
__typename: 'CandleEdge',
node,
})) as unknown as MarketsCandlesQuery_marketsConnection_edges_node_candlesConnection_edges[],
},
] as MarketsCandlesQuery_marketsConnection_edges_node_candles[],
},
{
id: '65663ebdc96161162769c4d5c5508137416748178d7cb28e2cb0d07a151a2bc6',
__typename: 'Market',
candlesConnection: {
__typename: 'CandleDataConnection',
edges: [
candles: [
{ open: '6680', close: '6600', __typename: 'Candle' },
{
open: '6600',
@@ -842,18 +817,12 @@ export const generateMarketsCandles = (): MarketsCandlesQuery => {
close: '6921',
__typename: 'Candle',
},
].map((node) => ({
__typename: 'CandleEdge',
node,
})) as unknown as MarketsCandlesQuery_marketsConnection_edges_node_candlesConnection_edges[],
},
] as MarketsCandlesQuery_marketsConnection_edges_node_candles[],
},
{
id: '234afabd27e3bce1a879039c041f9f00f915d98459935ddafd0169d38dd13850',
__typename: 'Market',
candlesConnection: {
__typename: 'CandleDataConnection',
edges: [
candles: [
{ open: '15126319', close: '15087482', __typename: 'Candle' },
{
open: '15087482',
@@ -926,18 +895,12 @@ export const generateMarketsCandles = (): MarketsCandlesQuery => {
close: '14771411',
__typename: 'Candle',
},
].map((node) => ({
__typename: 'CandleEdge',
node,
})) as unknown as MarketsCandlesQuery_marketsConnection_edges_node_candlesConnection_edges[],
},
] as MarketsCandlesQuery_marketsConnection_edges_node_candles[],
},
{
id: '9f2a3c1caa67bb0773ec18d908d32b55b129b9ec2d106a8e9a87f6aa5c0375a6',
__typename: 'Market',
candlesConnection: {
__typename: 'CandleDataConnection',
edges: [
candles: [
{ open: '71263667', close: '71173749', __typename: 'Candle' },
{
open: '71173749',
@@ -1010,18 +973,12 @@ export const generateMarketsCandles = (): MarketsCandlesQuery => {
close: '67817444',
__typename: 'Candle',
},
].map((node) => ({
__typename: 'CandleEdge',
node,
})) as unknown as MarketsCandlesQuery_marketsConnection_edges_node_candlesConnection_edges[],
},
] as MarketsCandlesQuery_marketsConnection_edges_node_candles[],
},
{
id: '8a45ee934d3ddac4b036f9884df1064a5353c620a56f775ba36597d0edef9a7a',
__typename: 'Market',
candlesConnection: {
__typename: 'CandleDataConnection',
edges: [
candles: [
{ open: '5809', close: '5795', __typename: 'Candle' },
{
open: '5795',
@@ -1035,11 +992,7 @@ export const generateMarketsCandles = (): MarketsCandlesQuery => {
__typename: 'Candle',
},
{ open: '5710', close: '5691', __typename: 'Candle' },
].map((node) => ({
__typename: 'CandleEdge',
node,
})) as unknown as MarketsCandlesQuery_marketsConnection_edges_node_candlesConnection_edges[],
},
] as MarketsCandlesQuery_marketsConnection_edges_node_candles[],
},
];
return {
@@ -53,9 +53,6 @@ export interface Deposits_assetsConnection_edges_node {
export interface Deposits_assetsConnection_edges {
__typename: "AssetEdge";
/**
* The asset information
*/
node: Deposits_assetsConnection_edges_node;
}
@@ -10,7 +10,7 @@
export interface MarketMarkPrice_market_data {
__typename: "MarketData";
/**
* The mark price (an unsigned integer)
* the mark price (an unsigned integer)
*/
markPrice: string;
}
@@ -18,7 +18,7 @@ export interface MarketMarkPrice_market_data {
export interface MarketMarkPrice_market {
__typename: "Market";
/**
* The number of decimal places that an integer must be shifted by in order to get a correct
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
* number denominated in the currency of the market. (uint64)
*
* Examples:
@@ -60,19 +60,19 @@ export interface PartyMarketData_party_marginsConnection_edges_node_market {
export interface PartyMarketData_party_marginsConnection_edges_node {
__typename: "MarginLevels";
/**
* Market in which the margin is required for this party
* market in which the margin is required for this party
*/
market: PartyMarketData_party_marginsConnection_edges_node_market;
/**
* This is the minimum margin required for a party to place a new order on the network (unsigned integer)
* this is the minimum margin required for a party to place a new order on the network (unsigned integer)
*/
initialLevel: string;
/**
* Minimal margin for the position to be maintained in the network (unsigned integer)
* minimal margin for the position to be maintained in the network (unsigned integer)
*/
maintenanceLevel: string;
/**
* If the margin is between maintenance and search, the network will initiate a collateral search (unsigned integer)
* if the margin is between maintenance and search, the network will initiate a collateral search (unsigned integer)
*/
searchLevel: string;
}
@@ -28,7 +28,7 @@ export interface EstimateOrder_estimateOrder_fee {
export interface EstimateOrder_estimateOrder_marginLevels {
__typename: "MarginLevels";
/**
* This is the minimum margin required for a party to place a new order on the network (unsigned integer)
* this is the minimum margin required for a party to place a new order on the network (unsigned integer)
*/
initialLevel: string;
}
@@ -47,7 +47,7 @@ export interface EstimateOrder_estimateOrder {
export interface EstimateOrder {
/**
* Return an estimation of the potential cost for a new order
* return an estimation of the potential cost for a new order
*/
estimateOrder: EstimateOrder_estimateOrder;
}
@@ -67,9 +67,6 @@ export interface MarketPositions_party_positionsConnection_edges_node {
export interface MarketPositions_party_positionsConnection_edges {
__typename: "PositionEdge";
/**
* The position
*/
node: MarketPositions_party_positionsConnection_edges_node;
}
@@ -81,9 +81,6 @@ export interface AssetsQuery_assetsConnection_edges_node {
export interface AssetsQuery_assetsConnection_edges {
__typename: "AssetEdge";
/**
* The asset information
*/
node: AssetsQuery_assetsConnection_edges_node;
}
@@ -265,7 +265,7 @@ export interface ProposalsQuery_proposalsConnection_edges_node {
*/
datetime: string;
/**
* Why the proposal was rejected by the core
* Reason for the proposal to be rejected by the core
*/
rejectionReason: ProposalRejectionReason | null;
/**
@@ -104,15 +104,15 @@ export interface MarketsQuery_markets_tradableInstrument_instrument {
export interface MarketsQuery_markets_tradableInstrument_riskModel_LogNormalRiskModel_params {
__typename: "LogNormalModelParams";
/**
* R parameter
* r parameter
*/
r: number;
/**
* Sigma parameter, annualised volatility of the underlying asset, must be a strictly non-negative real number
* sigma parameter, annualised volatility of the underlying asset, must be a strictly non-negative real number
*/
sigma: number;
/**
* Mu parameter, annualised growth rate of the underlying asset
* mu parameter, annualised growth rate of the underlying asset
*/
mu: number;
}
@@ -158,15 +158,15 @@ export type MarketsQuery_markets_tradableInstrument_riskModel = MarketsQuery_mar
export interface MarketsQuery_markets_tradableInstrument_marginCalculator_scalingFactors {
__typename: "ScalingFactors";
/**
* The scaling factor that determines the margin level at which Vega has to search for more money
* the scaling factor that determines the margin level at which Vega has to search for more money
*/
searchLevel: number;
/**
* The scaling factor that determines the optimal margin level
* the scaling factor that determines the optimal margin level
*/
initialMargin: number;
/**
* The scaling factor that determines the overflow margin level
* the scaling factor that determines the overflow margin level
*/
collateralRelease: number;
}
@@ -362,47 +362,47 @@ export interface MarketsQuery_markets_data_liquidityProviderFeeShare {
export interface MarketsQuery_markets_data {
__typename: "MarketData";
/**
* The mark price (an unsigned integer)
* the mark price (an unsigned integer)
*/
markPrice: string;
/**
* The highest price level on an order book for buy orders.
* the highest price level on an order book for buy orders.
*/
bestBidPrice: string;
/**
* The aggregated volume being bid at the best bid price.
* the aggregated volume being bid at the best bid price.
*/
bestBidVolume: string;
/**
* The lowest price level on an order book for offer orders.
* the lowest price level on an order book for offer orders.
*/
bestOfferPrice: string;
/**
* The aggregated volume being offered at the best offer price.
* the aggregated volume being offered at the best offer price.
*/
bestOfferVolume: string;
/**
* The highest price level on an order book for buy orders not including pegged orders.
* the highest price level on an order book for buy orders not including pegged orders.
*/
bestStaticBidPrice: string;
/**
* The aggregated volume being offered at the best static bid price, excluding pegged orders
* the aggregated volume being offered at the best static bid price, excluding pegged orders
*/
bestStaticBidVolume: string;
/**
* The lowest price level on an order book for offer orders not including pegged orders.
* the lowest price level on an order book for offer orders not including pegged orders.
*/
bestStaticOfferPrice: string;
/**
* The aggregated volume being offered at the best static offer price, excluding pegged orders.
* the aggregated volume being offered at the best static offer price, excluding pegged orders.
*/
bestStaticOfferVolume: string;
/**
* The arithmetic average of the best bid price and best offer price.
* the arithmetic average of the best bid price and best offer price.
*/
midPrice: string;
/**
* The arithmetic average of the best static bid price and best static offer price
* the arithmetic average of the best static bid price and best static offer price
*/
staticMidPrice: string;
/**
@@ -410,7 +410,7 @@ export interface MarketsQuery_markets_data {
*/
timestamp: string;
/**
* The sum of the size of all positions greater than 0.
* the sum of the size of all positions greater than 0.
*/
openInterest: string;
/**
@@ -422,39 +422,39 @@ export interface MarketsQuery_markets_data {
*/
auctionStart: string | null;
/**
* Indicative price if the auction ended now, 0 if not in auction mode
* indicative price if the auction ended now, 0 if not in auction mode
*/
indicativePrice: string;
/**
* Indicative volume if the auction ended now, 0 if not in auction mode
* indicative volume if the auction ended now, 0 if not in auction mode
*/
indicativeVolume: string;
/**
* What triggered an auction (if an auction was started)
* what triggered an auction (if an auction was started)
*/
trigger: AuctionTrigger;
/**
* What extended the ongoing auction (if an auction was extended)
* what extended the ongoing auction (if an auction was extended)
*/
extensionTrigger: AuctionTrigger;
/**
* The amount of stake targeted for this market
* the amount of stake targeted for this market
*/
targetStake: string | null;
/**
* The supplied stake for the market
* the supplied stake for the market
*/
suppliedStake: string | null;
/**
* A list of valid price ranges per associated trigger
* a list of valid price ranges per associated trigger
*/
priceMonitoringBounds: MarketsQuery_markets_data_priceMonitoringBounds[] | null;
/**
* The market value proxy
* the market value proxy
*/
marketValueProxy: string;
/**
* The equity like share of liquidity fee for each liquidity provider
* the equity like share of liquidity fee for each liquidity provider
*/
liquidityProviderFeeShare: MarketsQuery_markets_data_liquidityProviderFeeShare[] | null;
}
@@ -474,7 +474,7 @@ export interface MarketsQuery_markets {
*/
tradableInstrument: MarketsQuery_markets_tradableInstrument;
/**
* The number of decimal places that an integer must be shifted by in order to get a correct
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
* number denominated in the currency of the market. (uint64)
*
* Examples:
@@ -21,7 +21,7 @@ export interface NetworkParametersQuery_networkParameters {
export interface NetworkParametersQuery {
/**
* Return the full list of network parameters
* return the full list of network parameters
*/
networkParameters: NetworkParametersQuery_networkParameters[] | null;
}
@@ -12,11 +12,11 @@ import { OracleSpecStatus, PropertyKeyType, ConditionOperator } from "@vegaproto
export interface OracleSpecs_oracleSpecs_filters_key {
__typename: "PropertyKey";
/**
* The name of the property.
* name is the name of the property.
*/
name: string | null;
/**
* The type of the property.
* type is the type of the property.
*/
type: PropertyKeyType;
}
@@ -24,11 +24,11 @@ export interface OracleSpecs_oracleSpecs_filters_key {
export interface OracleSpecs_oracleSpecs_filters_conditions {
__typename: "Condition";
/**
* The value to compare against.
* value is used by the comparator.
*/
value: string | null;
/**
* The type of comparison to make on the value.
* comparator is the type of comparison to make on the value.
*/
operator: ConditionOperator;
}
@@ -36,11 +36,11 @@ export interface OracleSpecs_oracleSpecs_filters_conditions {
export interface OracleSpecs_oracleSpecs_filters {
__typename: "Filter";
/**
* The oracle data property key targeted by the filter.
* key is the oracle data property key targeted by the filter.
*/
key: OracleSpecs_oracleSpecs_filters_key;
/**
* The conditions that should be matched by the data to be
* conditions are the conditions that should be matched by the data to be
* considered of interest.
*/
conditions: OracleSpecs_oracleSpecs_filters_conditions[] | null;
@@ -49,7 +49,7 @@ export interface OracleSpecs_oracleSpecs_filters {
export interface OracleSpecs_oracleSpecs_data {
__typename: "OracleData";
/**
* The list of public keys that signed the data
* pubKeys is the list of public keys that signed the data
*/
pubKeys: string[] | null;
}
@@ -57,7 +57,7 @@ export interface OracleSpecs_oracleSpecs_data {
export interface OracleSpecs_oracleSpecs {
__typename: "OracleSpec";
/**
* Status describes the status of the oracle spec
* status describes the status of the oracle spec
*/
status: OracleSpecStatus;
/**
@@ -73,18 +73,18 @@ export interface OracleSpecs_oracleSpecs {
*/
updatedAt: string | null;
/**
* The list of authorized public keys that signed the data for this
* pubKeys is the list of authorized public keys that signed the data for this
* oracle. All the public keys in the oracle data should be contained in these
* public keys.
*/
pubKeys: string[] | null;
/**
* Filters describes which oracle data are considered of interest or not for
* filters describes which oracle data are considered of interest or not for
* the product (or the risk model).
*/
filters: OracleSpecs_oracleSpecs_filters[] | null;
/**
* Data list all the oracle data broadcast to this spec
* data list all the oracle data broadcast to this spec
*/
data: OracleSpecs_oracleSpecs_data[];
}
@@ -69,19 +69,13 @@ export interface NodesQuery_nodes {
* Amount of stake on the next epoch
*/
pendingStake: string;
/**
* Summary of epoch data across all nodes
*/
epochData: NodesQuery_nodes_epochData | null;
/**
* Validator status of the node
*/
status: NodeStatus;
}
export interface NodesQuery {
/**
* All known network nodes
* all known network nodes
*/
nodes: NodesQuery_nodes[] | null;
}
@@ -12,7 +12,7 @@ import { AccountType } from "@vegaprotocol/types";
export interface Delegations_epoch {
__typename: "Epoch";
/**
* Numeric sequence number used to identify the epoch
* Presumably this is an integer or something. If there's no such thing, disregard
*/
id: string;
}
@@ -131,7 +131,7 @@ export interface Delegations_party {
export interface Delegations {
/**
* Get data for a specific epoch, if ID omitted it gets the current epoch. If the string is 'next', fetch the next epoch
* get data for a specific epoch, if ID omitted it gets the current epoch. If the string is 'next', fetch the next epoch
*/
epoch: Delegations_epoch;
/**
@@ -293,7 +293,7 @@ export interface ProposalFields {
*/
datetime: string;
/**
* Why the proposal was rejected by the core
* Reason for the proposal to be rejected by the core
*/
rejectionReason: ProposalRejectionReason | null;
/**
@@ -293,7 +293,7 @@ export interface Proposal_proposal {
*/
datetime: string;
/**
* Why the proposal was rejected by the core
* Reason for the proposal to be rejected by the core
*/
rejectionReason: ProposalRejectionReason | null;
/**
@@ -293,7 +293,7 @@ export interface Proposals_proposalsConnection_edges_node {
*/
datetime: string;
/**
* Why the proposal was rejected by the core
* Reason for the proposal to be rejected by the core
*/
rejectionReason: ProposalRejectionReason | null;
/**
+1 -1
View File
@@ -21,7 +21,7 @@ export interface NodeData_nodeData {
export interface NodeData {
/**
* Returns information about nodes
* returns information about nodes
*/
nodeData: NodeData_nodeData | null;
}
+4 -4
View File
@@ -40,7 +40,7 @@ export interface Rewards_party_rewardDetails_rewards_party {
export interface Rewards_party_rewardDetails_rewards_epoch {
__typename: "Epoch";
/**
* Numeric sequence number used to identify the epoch
* Presumably this is an integer or something. If there's no such thing, disregard
*/
id: string;
}
@@ -124,7 +124,7 @@ export interface Rewards_party {
*/
id: string;
/**
* Return reward information
* return reward information
*/
rewardDetails: (Rewards_party_rewardDetails | null)[] | null;
delegations: Rewards_party_delegations[] | null;
@@ -149,7 +149,7 @@ export interface Rewards_epoch_timestamps {
export interface Rewards_epoch {
__typename: "Epoch";
/**
* Numeric sequence number used to identify the epoch
* Presumably this is an integer or something. If there's no such thing, disregard
*/
id: string;
/**
@@ -164,7 +164,7 @@ export interface Rewards {
*/
party: Rewards_party | null;
/**
* Get data for a specific epoch, if ID omitted it gets the current epoch. If the string is 'next', fetch the next epoch
* get data for a specific epoch, if ID omitted it gets the current epoch. If the string is 'next', fetch the next epoch
*/
epoch: Rewards_epoch;
}
+2 -2
View File
@@ -81,11 +81,11 @@ export interface Nodes_nodeData {
export interface Nodes {
/**
* All known network nodes
* all known network nodes
*/
nodes: Nodes_nodes[] | null;
/**
* Returns information about nodes
* returns information about nodes
*/
nodeData: Nodes_nodeData | null;
}
@@ -47,7 +47,7 @@ export interface PartyDelegations_party {
export interface PartyDelegations_epoch {
__typename: "Epoch";
/**
* Numeric sequence number used to identify the epoch
* Presumably this is an integer or something. If there's no such thing, disregard
*/
id: string;
}
@@ -58,7 +58,7 @@ export interface PartyDelegations {
*/
party: PartyDelegations_party | null;
/**
* Get data for a specific epoch, if ID omitted it gets the current epoch. If the string is 'next', fetch the next epoch
* get data for a specific epoch, if ID omitted it gets the current epoch. If the string is 'next', fetch the next epoch
*/
epoch: PartyDelegations_epoch;
}
+4 -10
View File
@@ -81,7 +81,7 @@ export interface Staking_epoch_timestamps {
export interface Staking_epoch {
__typename: "Epoch";
/**
* Numeric sequence number used to identify the epoch
* Presumably this is an integer or something. If there's no such thing, disregard
*/
id: string;
/**
@@ -181,13 +181,7 @@ export interface Staking_nodes {
* The pending staked field formatted by the client
*/
pendingStakeFormatted: string;
/**
* Summary of epoch data across all nodes
*/
epochData: Staking_nodes_epochData | null;
/**
* Validator status of the node
*/
status: NodeStatus;
/**
* Ranking scores and status for the validator for the current epoch
@@ -229,15 +223,15 @@ export interface Staking {
*/
party: Staking_party | null;
/**
* Get data for a specific epoch, if ID omitted it gets the current epoch. If the string is 'next', fetch the next epoch
* get data for a specific epoch, if ID omitted it gets the current epoch. If the string is 'next', fetch the next epoch
*/
epoch: Staking_epoch;
/**
* All known network nodes
* all known network nodes
*/
nodes: Staking_nodes[] | null;
/**
* Returns information about nodes
* returns information about nodes
*/
nodeData: Staking_nodeData | null;
}
@@ -10,7 +10,7 @@ export const generateCandles = (
): CandlesQuery => {
const candles: CandleFieldsFragment[] = [
{
periodStart: '1661515200000000000',
start: '1661515200000000000',
high: '17481092',
low: '17403651',
open: '17458833',
@@ -19,7 +19,7 @@ export const generateCandles = (
__typename: 'Candle',
},
{
periodStart: '1661516100000000000',
start: '1661516100000000000',
high: '17491202',
low: '17361138',
open: '17446470',
@@ -28,7 +28,7 @@ export const generateCandles = (
__typename: 'Candle',
},
{
periodStart: '1661517000000000000',
start: '1661517000000000000',
high: '17424522',
low: '17337719',
open: '17367174',
@@ -50,11 +50,7 @@ export const generateCandles = (
},
__typename: 'TradableInstrument',
},
candlesConnection: {
edges: candles.map((node) => ({
node,
})),
},
candles,
__typename: 'Market',
},
};
@@ -113,7 +113,7 @@ export const generateMarketInfoQuery = (
},
__typename: 'LiquidityMonitoringParameters',
},
candlesConnection: null,
candles: null,
tradableInstrument: {
__typename: 'TradableInstrument',
instrument: {
@@ -11,6 +11,7 @@ import type { Market } from '../../../../trading/pages/markets/__generated__/Mar
export const generateMarket = (override?: PartialDeep<Market>): Market => {
const defaultResult: Market = {
market: {
__typename: 'Market',
id: 'market-0',
tradingMode: MarketTradingMode.TRADING_MODE_MONITORING_AUCTION,
state: MarketState.STATE_ACTIVE,
@@ -75,31 +76,21 @@ export const generateMarket = (override?: PartialDeep<Market>): Market => {
close: null,
__typename: 'MarketTimestamps',
},
candlesConnection: {
__typename: 'CandleDataConnection',
edges: [
candles: [
{
__typename: 'CandleEdge',
node: {
open: '2095312844',
close: '2090090607',
volume: '4847',
__typename: 'Candle',
},
},
{
__typename: 'CandleEdge',
node: {
open: '2090090000',
close: '2090090607',
volume: '4847',
__typename: 'Candle',
},
},
],
},
__typename: 'Market',
},
};
return merge(defaultResult, override);
@@ -313,12 +313,8 @@ export const generateMarketsCandles = (
{
__typename: 'Market',
id: 'market-0',
candlesConnection: {
__typename: 'CandleDataConnection',
edges: [
candles: [
{
__typename: 'CandleEdge',
node: {
__typename: 'Candle',
open: '100',
close: '100',
@@ -326,19 +322,13 @@ export const generateMarketsCandles = (
low: '90',
volume: '1',
},
},
],
},
},
{
__typename: 'Market',
id: 'market-1',
candlesConnection: {
__typename: 'CandleDataConnection',
edges: [
candles: [
{
__typename: 'CandleEdge',
node: {
__typename: 'Candle',
open: '100',
close: '100',
@@ -346,19 +336,13 @@ export const generateMarketsCandles = (
low: '90',
volume: '1',
},
},
],
},
},
{
__typename: 'Market',
id: 'market-2',
candlesConnection: {
__typename: 'CandleDataConnection',
edges: [
candles: [
{
__typename: 'CandleEdge',
node: {
__typename: 'Candle',
open: '100',
close: '100',
@@ -366,19 +350,13 @@ export const generateMarketsCandles = (
low: '90',
volume: '1',
},
},
],
},
},
{
__typename: 'Market',
id: 'market-3',
candlesConnection: {
__typename: 'CandleDataConnection',
edges: [
candles: [
{
__typename: 'CandleEdge',
node: {
__typename: 'Candle',
open: '100',
close: '100',
@@ -386,10 +364,8 @@ export const generateMarketsCandles = (
low: '90',
volume: '1',
},
},
],
},
},
];
const defaultResult: MarketsCandlesQuery = {
marketsConnection: {
+1 -5
View File
@@ -50,14 +50,10 @@ query Market($marketId: ID!, $interval: Interval!, $since: String!) {
open
close
}
candlesConnection(interval: $interval, since: $since) {
edges {
node {
candles(interval: $interval, since: $since) {
open
close
volume
}
}
}
}
}
@@ -65,17 +65,13 @@ const MARKET_QUERY = gql`
open
close
}
candlesConnection(interval: $interval, since: $since) {
edges {
node {
candles(interval: $interval, since: $since) {
open
close
volume
}
}
}
}
}
`;
const MarketPage = ({ id }: { id?: string }) => {
+17 -33
View File
@@ -20,7 +20,7 @@ export interface Market_market_data_market {
export interface Market_market_data {
__typename: "MarketData";
/**
* Market of the associated mark price
* market of the associated mark price
*/
market: Market_market_data_market;
/**
@@ -32,43 +32,43 @@ export interface Market_market_data {
*/
auctionEnd: string | null;
/**
* The mark price (an unsigned integer)
* the mark price (an unsigned integer)
*/
markPrice: string;
/**
* Indicative volume if the auction ended now, 0 if not in auction mode
* indicative volume if the auction ended now, 0 if not in auction mode
*/
indicativeVolume: string;
/**
* Indicative price if the auction ended now, 0 if not in auction mode
* indicative price if the auction ended now, 0 if not in auction mode
*/
indicativePrice: string;
/**
* The supplied stake for the market
* the supplied stake for the market
*/
suppliedStake: string | null;
/**
* The amount of stake targeted for this market
* the amount of stake targeted for this market
*/
targetStake: string | null;
/**
* The aggregated volume being bid at the best bid price.
* the aggregated volume being bid at the best bid price.
*/
bestBidVolume: string;
/**
* The aggregated volume being offered at the best offer price.
* the aggregated volume being offered at the best offer price.
*/
bestOfferVolume: string;
/**
* The aggregated volume being offered at the best static bid price, excluding pegged orders
* the aggregated volume being offered at the best static bid price, excluding pegged orders
*/
bestStaticBidVolume: string;
/**
* The aggregated volume being offered at the best static offer price, excluding pegged orders.
* the aggregated volume being offered at the best static offer price, excluding pegged orders.
*/
bestStaticOfferVolume: string;
/**
* What triggered an auction (if an auction was started)
* what triggered an auction (if an auction was started)
*/
trigger: AuctionTrigger;
}
@@ -169,7 +169,7 @@ export interface Market_market_marketTimestamps {
close: string | null;
}
export interface Market_market_candlesConnection_edges_node {
export interface Market_market_candles {
__typename: "Candle";
/**
* Open price (uint64)
@@ -185,22 +185,6 @@ export interface Market_market_candlesConnection_edges_node {
volume: string;
}
export interface Market_market_candlesConnection_edges {
__typename: "CandleEdge";
/**
* The candle
*/
node: Market_market_candlesConnection_edges_node;
}
export interface Market_market_candlesConnection {
__typename: "CandleDataConnection";
/**
* The candles
*/
edges: (Market_market_candlesConnection_edges | null)[] | null;
}
export interface Market_market {
__typename: "Market";
/**
@@ -216,7 +200,7 @@ export interface Market_market {
*/
state: MarketState;
/**
* The number of decimal places that an integer must be shifted by in order to get a correct
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
* number denominated in the currency of the market. (uint64)
*
* Examples:
@@ -233,7 +217,7 @@ export interface Market_market {
*/
decimalPlaces: number;
/**
* The number of decimal places that an integer must be shifted in order to get a correct size (uint64).
* positionDecimalPlaces indicates the number of decimal places that an integer must be shifted in order to get a correct size (uint64).
* i.e. 0 means there are no fractional orders for the market, and order sizes are always whole sizes.
* 2 means sizes given as 10^2 * desired size, e.g. a desired size of 1.23 is represented as 123 in this market.
* This sets how big the smallest order / position on the market can be.
@@ -248,13 +232,13 @@ export interface Market_market {
*/
tradableInstrument: Market_market_tradableInstrument;
/**
* Timestamps for state changes in the market
* timestamps for state changes in the market
*/
marketTimestamps: Market_market_marketTimestamps;
/**
* Candles on a market, for the 'last' n candles, at 'interval' seconds as specified by parameters using cursor based pagination
* Candles on a market, for the 'last' n candles, at 'interval' seconds as specified by parameters
*/
candlesConnection: Market_market_candlesConnection | null;
candles: (Market_market_candles | null)[] | null;
}
export interface Market {
@@ -10,7 +10,7 @@ export type MarketQueryVariables = Types.Exact<{
}>;
export type MarketQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, tradingMode: Types.MarketTradingMode, state: Types.MarketState, decimalPlaces: number, positionDecimalPlaces: number, data?: { __typename?: 'MarketData', auctionStart?: string | null, auctionEnd?: string | null, markPrice: string, indicativeVolume: string, indicativePrice: string, suppliedStake?: string | null, targetStake?: string | null, bestBidVolume: string, bestOfferVolume: string, bestStaticBidVolume: string, bestStaticOfferVolume: string, trigger: Types.AuctionTrigger, market: { __typename?: 'Market', id: string } } | null, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array<string> | null }, product: { __typename?: 'Future', quoteName: string, oracleSpecForTradingTermination: { __typename?: 'OracleSpec', id: string }, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number } } } }, marketTimestamps: { __typename?: 'MarketTimestamps', open?: string | null, close?: string | null }, candlesConnection?: { __typename?: 'CandleDataConnection', edges?: Array<{ __typename?: 'CandleEdge', node: { __typename?: 'Candle', open: string, close: string, volume: string } } | null> | null } | null } | null };
export type MarketQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, tradingMode: Types.MarketTradingMode, state: Types.MarketState, decimalPlaces: number, positionDecimalPlaces: number, data?: { __typename?: 'MarketData', auctionStart?: string | null, auctionEnd?: string | null, markPrice: string, indicativeVolume: string, indicativePrice: string, suppliedStake?: string | null, targetStake?: string | null, bestBidVolume: string, bestOfferVolume: string, bestStaticBidVolume: string, bestStaticOfferVolume: string, trigger: Types.AuctionTrigger, market: { __typename?: 'Market', id: string } } | null, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array<string> | null }, product: { __typename?: 'Future', quoteName: string, oracleSpecForTradingTermination: { __typename?: 'OracleSpec', id: string }, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number } } } }, marketTimestamps: { __typename?: 'MarketTimestamps', open?: string | null, close?: string | null }, candles?: Array<{ __typename?: 'Candle', open: string, close: string, volume: string } | null> | null } | null };
export const MarketDocument = gql`
@@ -66,16 +66,12 @@ export const MarketDocument = gql`
open
close
}
candlesConnection(interval: $interval, since: $since) {
edges {
node {
candles(interval: $interval, since: $since) {
open
close
volume
}
}
}
}
}
`;
+3 -2
View File
@@ -1,3 +1,4 @@
import compact from 'lodash/compact';
import { DealTicketContainer } from '@vegaprotocol/deal-ticket';
import { MarketInfoContainer } from '@vegaprotocol/market-info';
import { OrderbookContainer } from '@vegaprotocol/market-depth';
@@ -121,8 +122,8 @@ export const TradeMarketHeader = ({
const { setAssetDetailsDialogOpen, setAssetDetailsDialogSymbol } =
useAssetDetailsDialogStore();
const candlesClose: string[] = (market?.candlesConnection?.edges || [])
.map((candle) => candle?.node.close)
const candlesClose: string[] = compact(market?.candles)
.map((candle) => candle.close)
.filter((c): c is CandleClose => c !== null);
const symbol =
market.tradableInstrument.instrument.product?.settlementAsset?.symbol;
@@ -53,9 +53,6 @@ export interface DepositPage_assetsConnection_edges_node {
export interface DepositPage_assetsConnection_edges {
__typename: "AssetEdge";
/**
* The asset information
*/
node: DepositPage_assetsConnection_edges_node;
}
@@ -1,60 +0,0 @@
import { Schema as Types } from '@vegaprotocol/types';
import { gql } from '@apollo/client';
import * as Apollo from '@apollo/client';
const defaultOptions = {} as const;
export type AssetsConnectionQueryVariables = Types.Exact<{ [key: string]: never; }>;
export type AssetsConnectionQuery = { __typename?: 'Query', assetsConnection?: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } } } | null> | null } | null };
export const AssetsConnectionDocument = gql`
query AssetsConnection {
assetsConnection {
edges {
node {
id
name
symbol
decimals
quantum
source {
... on ERC20 {
contractAddress
lifetimeLimit
withdrawThreshold
}
}
}
}
}
}
`;
/**
* __useAssetsConnectionQuery__
*
* To run a query within a React component, call `useAssetsConnectionQuery` and pass it any options that fit your needs.
* When your component renders, `useAssetsConnectionQuery` returns an object from Apollo Client that contains loading, error, and data properties
* you can use to render your UI.
*
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
*
* @example
* const { data, loading, error } = useAssetsConnectionQuery({
* variables: {
* },
* });
*/
export function useAssetsConnectionQuery(baseOptions?: Apollo.QueryHookOptions<AssetsConnectionQuery, AssetsConnectionQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useQuery<AssetsConnectionQuery, AssetsConnectionQueryVariables>(AssetsConnectionDocument, options);
}
export function useAssetsConnectionLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<AssetsConnectionQuery, AssetsConnectionQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useLazyQuery<AssetsConnectionQuery, AssetsConnectionQueryVariables>(AssetsConnectionDocument, options);
}
export type AssetsConnectionQueryHookResult = ReturnType<typeof useAssetsConnectionQuery>;
export type AssetsConnectionLazyQueryHookResult = ReturnType<typeof useAssetsConnectionLazyQuery>;
export type AssetsConnectionQueryResult = Apollo.QueryResult<AssetsConnectionQuery, AssetsConnectionQueryVariables>;
+2 -6
View File
@@ -1,5 +1,5 @@
fragment CandleFields on Candle {
periodStart
datetime
high
low
open
@@ -18,14 +18,10 @@ query Candles($marketId: ID!, $interval: Interval!, $since: String!) {
code
}
}
candlesConnection(interval: $interval, since: $since) {
edges {
node {
candles(interval: $interval, since: $since) {
...CandleFields
}
}
}
}
}
subscription CandlesEvents($marketId: ID!, $interval: Interval!) {
@@ -3,7 +3,7 @@ import { Schema as Types } from '@vegaprotocol/types';
import { gql } from '@apollo/client';
import * as Apollo from '@apollo/client';
const defaultOptions = {} as const;
export type CandleFieldsFragment = { __typename?: 'Candle', periodStart: string, high: string, low: string, open: string, close: string, volume: string };
export type CandleFieldsFragment = { __typename?: 'Candle', datetime: string, high: string, low: string, open: string, close: string, volume: string };
export type CandlesQueryVariables = Types.Exact<{
marketId: Types.Scalars['ID'];
@@ -12,7 +12,7 @@ export type CandlesQueryVariables = Types.Exact<{
}>;
export type CandlesQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string } }, candlesConnection?: { __typename?: 'CandleDataConnection', edges?: Array<{ __typename?: 'CandleEdge', node: { __typename?: 'Candle', periodStart: string, high: string, low: string, open: string, close: string, volume: string } } | null> | null } | null } | null };
export type CandlesQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string } }, candles?: Array<{ __typename?: 'Candle', datetime: string, high: string, low: string, open: string, close: string, volume: string } | null> | null } | null };
export type CandlesEventsSubscriptionVariables = Types.Exact<{
marketId: Types.Scalars['ID'];
@@ -20,11 +20,11 @@ export type CandlesEventsSubscriptionVariables = Types.Exact<{
}>;
export type CandlesEventsSubscription = { __typename?: 'Subscription', candles: { __typename?: 'Candle', periodStart: string, high: string, low: string, open: string, close: string, volume: string } };
export type CandlesEventsSubscription = { __typename?: 'Subscription', candles: { __typename?: 'Candle', datetime: string, high: string, low: string, open: string, close: string, volume: string } };
export const CandleFieldsFragmentDoc = gql`
fragment CandleFields on Candle {
periodStart
datetime
high
low
open
@@ -44,14 +44,10 @@ export const CandlesDocument = gql`
code
}
}
candlesConnection(interval: $interval, since: $since) {
edges {
node {
candles(interval: $interval, since: $since) {
...CandleFields
}
}
}
}
}
${CandleFieldsFragmentDoc}`;
+3 -4
View File
@@ -143,11 +143,10 @@ export class VegaDataSource implements DataSource {
fetchPolicy: 'no-cache',
});
if (data?.market?.candlesConnection?.edges) {
if (data?.market?.candles) {
const decimalPlaces = data.market.decimalPlaces;
const candles = data.market.candlesConnection.edges
.map((edge) => edge?.node)
const candles = data.market.candles
.filter((node): node is CandleFieldsFragment => !!node)
.map((node) => parseCandle(node, decimalPlaces));
@@ -200,7 +199,7 @@ function parseCandle(
decimalPlaces: number
): Candle {
return {
date: new Date(Number(candle.periodStart) / 1_000_000),
date: new Date(candle.datetime),
high: Number(addDecimal(candle.high, decimalPlaces)),
low: Number(addDecimal(candle.low, decimalPlaces)),
open: Number(addDecimal(candle.open, decimalPlaces)),
@@ -84,7 +84,7 @@ export interface DealTicketQuery_market {
*/
id: string;
/**
* The number of decimal places that an integer must be shifted by in order to get a correct
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
* number denominated in the currency of the market. (uint64)
*
* Examples:
@@ -101,7 +101,7 @@ export interface DealTicketQuery_market {
*/
decimalPlaces: number;
/**
* The number of decimal places that an integer must be shifted in order to get a correct size (uint64).
* positionDecimalPlaces indicates the number of decimal places that an integer must be shifted in order to get a correct size (uint64).
* i.e. 0 means there are no fractional orders for the market, and order sizes are always whole sizes.
* 2 means sizes given as 10^2 * desired size, e.g. a desired size of 1.23 is represented as 123 in this market.
* This sets how big the smallest order / position on the market can be.
+1 -1
View File
@@ -34,7 +34,7 @@ export type DepositEvent_busEvents_event = DepositEvent_busEvents_event_TimeUpda
export interface DepositEvent_busEvents {
__typename: "BusEvent";
/**
* The payload - the wrapped event
* the payload - the wrapped event
*/
event: DepositEvent_busEvents_event;
}
+1 -1
View File
@@ -66,7 +66,7 @@ export type DepositEventSub_busEvents_event = DepositEventSub_busEvents_event_Ti
export interface DepositEventSub_busEvents {
__typename: "BusEvent";
/**
* The payload - the wrapped event
* the payload - the wrapped event
*/
event: DepositEventSub_busEvents_event;
}
+1 -1
View File
@@ -10,7 +10,7 @@
export interface BlockTime_busEvents {
__typename: "BusEvent";
/**
* The ID for this event
* the ID for this event
*/
id: string;
}
+1 -1
View File
@@ -21,7 +21,7 @@ export interface Statistics_statistics {
export interface Statistics {
/**
* Get statistics about the Vega node
* get statistics about the Vega node
*/
statistics: Statistics_statistics;
}
+1 -19
View File
@@ -84,7 +84,7 @@ export interface Fills_party_tradesConnection_edges_node {
*/
price: string;
/**
* The number of units traded, will always be <= the remaining size of both orders immediately before the trade (uint64)
* The number of contracts trades, will always be <= the remaining size of both orders immediately before the trade (uint64)
*/
size: string;
/**
@@ -119,33 +119,15 @@ export interface Fills_party_tradesConnection_edges_node {
export interface Fills_party_tradesConnection_edges {
__typename: "TradeEdge";
/**
* The trade
*/
node: Fills_party_tradesConnection_edges_node;
/**
* The cursor for this trade
*/
cursor: string;
}
export interface Fills_party_tradesConnection_pageInfo {
__typename: "PageInfo";
/**
* The first cursor in the current page
*/
startCursor: string;
/**
* The last cursor in the current page
*/
endCursor: string;
/**
* The connection has more pages to fetch when traversing forward through the connection
*/
hasNextPage: boolean;
/**
* The connection has more pages to fetch when traversing backward through the connection
*/
hasPreviousPage: boolean;
}
@@ -28,7 +28,7 @@ export interface ProposalEvent_busEvents_event_Proposal {
*/
state: ProposalState;
/**
* Why the proposal was rejected by the core
* Reason for the proposal to be rejected by the core
*/
rejectionReason: ProposalRejectionReason | null;
/**
@@ -42,11 +42,11 @@ export type ProposalEvent_busEvents_event = ProposalEvent_busEvents_event_TimeUp
export interface ProposalEvent_busEvents {
__typename: "BusEvent";
/**
* The type of event
* the type of event
*/
type: BusEventType;
/**
* The payload - the wrapped event
* the payload - the wrapped event
*/
event: ProposalEvent_busEvents_event;
}
+8 -8
View File
@@ -174,27 +174,27 @@ export interface MarketLiquidity_market_data_liquidityProviderFeeShare {
export interface MarketLiquidity_market_data {
__typename: "MarketData";
/**
* Market of the associated mark price
* market of the associated mark price
*/
market: MarketLiquidity_market_data_market;
/**
* The supplied stake for the market
* the supplied stake for the market
*/
suppliedStake: string | null;
/**
* The sum of the size of all positions greater than 0.
* the sum of the size of all positions greater than 0.
*/
openInterest: string;
/**
* The amount of stake targeted for this market
* the amount of stake targeted for this market
*/
targetStake: string | null;
/**
* The market value proxy
* the market value proxy
*/
marketValueProxy: string;
/**
* The equity like share of liquidity fee for each liquidity provider
* the equity like share of liquidity fee for each liquidity provider
*/
liquidityProviderFeeShare: MarketLiquidity_market_data_liquidityProviderFeeShare[] | null;
}
@@ -206,7 +206,7 @@ export interface MarketLiquidity_market {
*/
id: string;
/**
* The number of decimal places that an integer must be shifted by in order to get a correct
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
* number denominated in the currency of the market. (uint64)
*
* Examples:
@@ -223,7 +223,7 @@ export interface MarketLiquidity_market {
*/
decimalPlaces: number;
/**
* The number of decimal places that an integer must be shifted in order to get a correct size (uint64).
* positionDecimalPlaces indicates the number of decimal places that an integer must be shifted in order to get a correct size (uint64).
* i.e. 0 means there are no fractional orders for the market, and order sizes are always whole sizes.
* 2 means sizes given as 10^2 * desired size, e.g. a desired size of 1.23 is represented as 123 in this market.
* This sets how big the smallest order / position on the market can be.
@@ -79,13 +79,9 @@ query MarketInfoQuery($marketId: ID!, $interval: Interval!, $since: String!) {
scalingFactor
}
}
candlesConnection(interval: $interval, since: $since) {
edges {
node {
candles(interval: $interval, since: $since) {
volume
}
}
}
tradableInstrument {
instrument {
id
@@ -10,7 +10,7 @@ export type MarketInfoQueryQueryVariables = Types.Exact<{
}>;
export type MarketInfoQueryQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string } }> | 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, data?: { __typename?: 'MarketData', markPrice: string, indicativeVolume: string, bestBidVolume: string, bestOfferVolume: string, bestStaticBidVolume: string, bestStaticOfferVolume: string, openInterest: string, bestBidPrice: string, bestOfferPrice: string, trigger: Types.AuctionTrigger, market: { __typename?: 'Market', id: string }, priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string, trigger: { __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number } }> | null } | null, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: number, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, candlesConnection?: { __typename?: 'CandleDataConnection', edges?: Array<{ __typename?: 'CandleEdge', node: { __typename?: 'Candle', volume: string } } | null> | null } | null, 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 }, oracleSpecForSettlementPrice: { __typename?: 'OracleSpec', id: string }, oracleSpecForTradingTermination: { __typename?: 'OracleSpec', id: string }, oracleSpecBinding: { __typename?: 'OracleSpecToFutureBinding', settlementPriceProperty: 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 } } }, depth: { __typename?: 'MarketDepth', lastTrade?: { __typename?: 'Trade', price: string } | null } } | null };
export type MarketInfoQueryQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string } }> | 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, data?: { __typename?: 'MarketData', markPrice: string, indicativeVolume: string, bestBidVolume: string, bestOfferVolume: string, bestStaticBidVolume: string, bestStaticOfferVolume: string, openInterest: string, bestBidPrice: string, bestOfferPrice: string, trigger: Types.AuctionTrigger, market: { __typename?: 'Market', id: string }, priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string, trigger: { __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number } }> | null } | null, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: number, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, candles?: Array<{ __typename?: 'Candle', volume: string } | null> | null, 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 }, oracleSpecForSettlementPrice: { __typename?: 'OracleSpec', id: string }, oracleSpecForTradingTermination: { __typename?: 'OracleSpec', id: string }, oracleSpecBinding: { __typename?: 'OracleSpecToFutureBinding', settlementPriceProperty: 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 } } }, depth: { __typename?: 'MarketDepth', lastTrade?: { __typename?: 'Trade', price: string } | null } } | null };
export const MarketInfoQueryDocument = gql`
@@ -95,13 +95,9 @@ export const MarketInfoQueryDocument = gql`
scalingFactor
}
}
candlesConnection(interval: $interval, since: $since) {
edges {
node {
candles(interval: $interval, since: $since) {
volume
}
}
}
tradableInstrument {
instrument {
id
@@ -168,59 +168,59 @@ export interface MarketInfoQuery_market_data_priceMonitoringBounds {
export interface MarketInfoQuery_market_data {
__typename: "MarketData";
/**
* Market of the associated mark price
* market of the associated mark price
*/
market: MarketInfoQuery_market_data_market;
/**
* The mark price (an unsigned integer)
* the mark price (an unsigned integer)
*/
markPrice: string;
/**
* The aggregated volume being bid at the best bid price.
* the aggregated volume being bid at the best bid price.
*/
bestBidVolume: string;
/**
* The aggregated volume being offered at the best offer price.
* the aggregated volume being offered at the best offer price.
*/
bestOfferVolume: string;
/**
* The aggregated volume being offered at the best static bid price, excluding pegged orders
* the aggregated volume being offered at the best static bid price, excluding pegged orders
*/
bestStaticBidVolume: string;
/**
* The aggregated volume being offered at the best static offer price, excluding pegged orders.
* the aggregated volume being offered at the best static offer price, excluding pegged orders.
*/
bestStaticOfferVolume: string;
/**
* The highest price level on an order book for buy orders.
* the highest price level on an order book for buy orders.
*/
bestBidPrice: string;
/**
* The lowest price level on an order book for offer orders.
* the lowest price level on an order book for offer orders.
*/
bestOfferPrice: string;
/**
* What triggered an auction (if an auction was started)
* what triggered an auction (if an auction was started)
*/
trigger: AuctionTrigger;
/**
* The sum of the size of all positions greater than 0.
* the sum of the size of all positions greater than 0.
*/
openInterest: string;
/**
* The supplied stake for the market
* the supplied stake for the market
*/
suppliedStake: string | null;
/**
* The amount of stake targeted for this market
* the amount of stake targeted for this market
*/
targetStake: string | null;
/**
* The market value proxy
* the market value proxy
*/
marketValueProxy: string;
/**
* A list of valid price ranges per associated trigger
* a list of valid price ranges per associated trigger
*/
priceMonitoringBounds: MarketInfoQuery_market_data_priceMonitoringBounds[] | null;
}
@@ -249,7 +249,7 @@ export interface MarketInfoQuery_market_liquidityMonitoringParameters {
targetStakeParameters: MarketInfoQuery_market_liquidityMonitoringParameters_targetStakeParameters;
}
export interface MarketInfoQuery_market_candlesConnection_edges_node {
export interface MarketInfoQuery_market_candles {
__typename: "Candle";
/**
* Volume price (uint64)
@@ -257,22 +257,6 @@ export interface MarketInfoQuery_market_candlesConnection_edges_node {
volume: string;
}
export interface MarketInfoQuery_market_candlesConnection_edges {
__typename: "CandleEdge";
/**
* The candle
*/
node: MarketInfoQuery_market_candlesConnection_edges_node;
}
export interface MarketInfoQuery_market_candlesConnection {
__typename: "CandleDataConnection";
/**
* The candles
*/
edges: (MarketInfoQuery_market_candlesConnection_edges | null)[] | null;
}
export interface MarketInfoQuery_market_tradableInstrument_instrument_metadata {
__typename: "InstrumentMetadata";
/**
@@ -374,15 +358,15 @@ export interface MarketInfoQuery_market_tradableInstrument_instrument {
export interface MarketInfoQuery_market_tradableInstrument_riskModel_LogNormalRiskModel_params {
__typename: "LogNormalModelParams";
/**
* R parameter
* r parameter
*/
r: number;
/**
* Sigma parameter, annualised volatility of the underlying asset, must be a strictly non-negative real number
* sigma parameter, annualised volatility of the underlying asset, must be a strictly non-negative real number
*/
sigma: number;
/**
* Mu parameter, annualised growth rate of the underlying asset
* mu parameter, annualised growth rate of the underlying asset
*/
mu: number;
}
@@ -460,7 +444,7 @@ export interface MarketInfoQuery_market {
*/
id: string;
/**
* The number of decimal places that an integer must be shifted by in order to get a correct
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
* number denominated in the currency of the market. (uint64)
*
* Examples:
@@ -477,7 +461,7 @@ export interface MarketInfoQuery_market {
*/
decimalPlaces: number;
/**
* The number of decimal places that an integer must be shifted in order to get a correct size (uint64).
* positionDecimalPlaces indicates the number of decimal places that an integer must be shifted in order to get a correct size (uint64).
* i.e. 0 means there are no fractional orders for the market, and order sizes are always whole sizes.
* 2 means sizes given as 10^2 * desired size, e.g. a desired size of 1.23 is represented as 123 in this market.
* This sets how big the smallest order / position on the market can be.
@@ -516,9 +500,9 @@ export interface MarketInfoQuery_market {
*/
liquidityMonitoringParameters: MarketInfoQuery_market_liquidityMonitoringParameters;
/**
* Candles on a market, for the 'last' n candles, at 'interval' seconds as specified by parameters using cursor based pagination
* Candles on a market, for the 'last' n candles, at 'interval' seconds as specified by parameters
*/
candlesConnection: MarketInfoQuery_market_candlesConnection | null;
candles: (MarketInfoQuery_market_candles | null)[] | null;
/**
* An instance of, or reference to, a tradable instrument.
*/
@@ -74,13 +74,9 @@ export const MARKET_INFO_QUERY = gql`
scalingFactor
}
}
candlesConnection(interval: $interval, since: $since) {
edges {
node {
candles(interval: $interval, since: $since) {
volume
}
}
}
tradableInstrument {
instrument {
id
@@ -20,7 +20,7 @@ import { MARKET_INFO_QUERY } from './info-market-query';
import type {
MarketInfoQuery,
MarketInfoQuery_market,
MarketInfoQuery_market_candlesConnection_edges,
MarketInfoQuery_market_candles,
} from './__generated__/MarketInfoQuery';
import { MarketInfoTable } from './info-key-value-table';
import { ExternalLink } from '@vegaprotocol/ui-toolkit';
@@ -39,16 +39,10 @@ export interface InfoProps {
export const calcCandleVolume = (
m: MarketInfoQuery_market
): string | undefined => {
return m.candlesConnection?.edges
?.reduce(
(
acc: BigNumber,
c: MarketInfoQuery_market_candlesConnection_edges | null
) => {
return acc.plus(new BigNumber(c?.node?.volume ?? 0));
},
new BigNumber(m.candlesConnection?.edges[0]?.node.volume ?? 0)
)
return m.candles
?.reduce((acc: BigNumber, c: MarketInfoQuery_market_candles | null) => {
return acc.plus(new BigNumber(c?.volume ?? 0));
}, new BigNumber(m.candles[0]?.volume ?? 0))
?.toString();
};
+3 -25
View File
@@ -9,7 +9,7 @@ import { Interval } from "@vegaprotocol/types";
// GraphQL query operation: MarketCandlesQuery
// ====================================================
export interface MarketCandlesQuery_marketsConnection_edges_node_candlesConnection_edges_node {
export interface MarketCandlesQuery_marketsConnection_edges_node_candles {
__typename: "Candle";
/**
* High price (uint64)
@@ -33,35 +33,16 @@ export interface MarketCandlesQuery_marketsConnection_edges_node_candlesConnecti
volume: string;
}
export interface MarketCandlesQuery_marketsConnection_edges_node_candlesConnection_edges {
__typename: "CandleEdge";
/**
* The candle
*/
node: MarketCandlesQuery_marketsConnection_edges_node_candlesConnection_edges_node;
}
export interface MarketCandlesQuery_marketsConnection_edges_node_candlesConnection {
__typename: "CandleDataConnection";
/**
* The candles
*/
edges: (MarketCandlesQuery_marketsConnection_edges_node_candlesConnection_edges | null)[] | null;
}
export interface MarketCandlesQuery_marketsConnection_edges_node {
__typename: "Market";
/**
* Candles on a market, for the 'last' n candles, at 'interval' seconds as specified by parameters using cursor based pagination
* Candles on a market, for the 'last' n candles, at 'interval' seconds as specified by parameters
*/
candlesConnection: MarketCandlesQuery_marketsConnection_edges_node_candlesConnection | null;
candles: (MarketCandlesQuery_marketsConnection_edges_node_candles | null)[] | null;
}
export interface MarketCandlesQuery_marketsConnection_edges {
__typename: "MarketEdge";
/**
* The market
*/
node: MarketCandlesQuery_marketsConnection_edges_node;
}
@@ -74,9 +55,6 @@ export interface MarketCandlesQuery_marketsConnection {
}
export interface MarketCandlesQuery {
/**
* One or more instruments that are trading on the Vega network
*/
marketsConnection: MarketCandlesQuery_marketsConnection | null;
}
+11 -17
View File
@@ -20,47 +20,47 @@ export interface MarketDataQuery_marketsConnection_edges_node_data_market {
export interface MarketDataQuery_marketsConnection_edges_node_data {
__typename: "MarketData";
/**
* Market of the associated mark price
* market of the associated mark price
*/
market: MarketDataQuery_marketsConnection_edges_node_data_market;
/**
* The highest price level on an order book for buy orders.
* the highest price level on an order book for buy orders.
*/
bestBidPrice: string;
/**
* The lowest price level on an order book for offer orders.
* the lowest price level on an order book for offer orders.
*/
bestOfferPrice: string;
/**
* The mark price (an unsigned integer)
* the mark price (an unsigned integer)
*/
markPrice: string;
/**
* What triggered an auction (if an auction was started)
* what triggered an auction (if an auction was started)
*/
trigger: AuctionTrigger;
/**
* The arithmetic average of the best static bid price and best static offer price
* the arithmetic average of the best static bid price and best static offer price
*/
staticMidPrice: string;
/**
* What mode the market is in (auction, continuous, etc)
* what mode the market is in (auction, continuous, etc)
*/
marketTradingMode: MarketTradingMode;
/**
* Indicative volume if the auction ended now, 0 if not in auction mode
* indicative volume if the auction ended now, 0 if not in auction mode
*/
indicativeVolume: string;
/**
* Indicative price if the auction ended now, 0 if not in auction mode
* indicative price if the auction ended now, 0 if not in auction mode
*/
indicativePrice: string;
/**
* The highest price level on an order book for buy orders not including pegged orders.
* the highest price level on an order book for buy orders not including pegged orders.
*/
bestStaticBidPrice: string;
/**
* The lowest price level on an order book for offer orders not including pegged orders.
* the lowest price level on an order book for offer orders not including pegged orders.
*/
bestStaticOfferPrice: string;
}
@@ -75,9 +75,6 @@ export interface MarketDataQuery_marketsConnection_edges_node {
export interface MarketDataQuery_marketsConnection_edges {
__typename: "MarketEdge";
/**
* The market
*/
node: MarketDataQuery_marketsConnection_edges_node;
}
@@ -90,9 +87,6 @@ export interface MarketDataQuery_marketsConnection {
}
export interface MarketDataQuery {
/**
* One or more instruments that are trading on the Vega network
*/
marketsConnection: MarketDataQuery_marketsConnection | null;
}
+11 -11
View File
@@ -12,47 +12,47 @@ import { AuctionTrigger, MarketTradingMode } from "@vegaprotocol/types";
export interface MarketDataSub_marketsData {
__typename: "ObservableMarketData";
/**
* Market ID of the associated mark price
* market ID of the associated mark price
*/
marketId: string;
/**
* The highest price level on an order book for buy orders.
* the highest price level on an order book for buy orders.
*/
bestBidPrice: string;
/**
* The lowest price level on an order book for offer orders.
* the lowest price level on an order book for offer orders.
*/
bestOfferPrice: string;
/**
* The mark price (an unsigned integer)
* the mark price (an unsigned integer)
*/
markPrice: string;
/**
* What triggered an auction (if an auction was started)
* what triggered an auction (if an auction was started)
*/
trigger: AuctionTrigger;
/**
* The arithmetic average of the best static bid price and best static offer price
* the arithmetic average of the best static bid price and best static offer price
*/
staticMidPrice: string;
/**
* What mode the market is in (auction, continuous etc)
* what mode the market is in (auction, continuous etc)
*/
marketTradingMode: MarketTradingMode;
/**
* Indicative volume if the auction ended now, 0 if not in auction mode
* indicative volume if the auction ended now, 0 if not in auction mode
*/
indicativeVolume: string;
/**
* Indicative price if the auction ended now, 0 if not in auction mode
* indicative price if the auction ended now, 0 if not in auction mode
*/
indicativePrice: string;
/**
* The highest price level on an order book for buy orders not including pegged orders.
* the highest price level on an order book for buy orders not including pegged orders.
*/
bestStaticBidPrice: string;
/**
* The lowest price level on an order book for offer orders not including pegged orders
* the lowest price level on an order book for offer orders not including pegged orders
*/
bestStaticOfferPrice: string;
}
+3 -3
View File
@@ -116,7 +116,7 @@ export interface MarketFields {
*/
id: string;
/**
* The number of decimal places that an integer must be shifted by in order to get a correct
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
* number denominated in the currency of the market. (uint64)
*
* Examples:
@@ -133,7 +133,7 @@ export interface MarketFields {
*/
decimalPlaces: number;
/**
* The number of decimal places that an integer must be shifted in order to get a correct size (uint64).
* positionDecimalPlaces indicates the number of decimal places that an integer must be shifted in order to get a correct size (uint64).
* i.e. 0 means there are no fractional orders for the market, and order sizes are always whole sizes.
* 2 means sizes given as 10^2 * desired size, e.g. a desired size of 1.23 is represented as 123 in this market.
* This sets how big the smallest order / position on the market can be.
@@ -156,7 +156,7 @@ export interface MarketFields {
*/
tradableInstrument: MarketFields_tradableInstrument;
/**
* Timestamps for state changes in the market
* timestamps for state changes in the market
*/
marketTimestamps: MarketFields_marketTimestamps;
}
+3 -9
View File
@@ -116,7 +116,7 @@ export interface Markets_marketsConnection_edges_node {
*/
id: string;
/**
* The number of decimal places that an integer must be shifted by in order to get a correct
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
* number denominated in the currency of the market. (uint64)
*
* Examples:
@@ -133,7 +133,7 @@ export interface Markets_marketsConnection_edges_node {
*/
decimalPlaces: number;
/**
* The number of decimal places that an integer must be shifted in order to get a correct size (uint64).
* positionDecimalPlaces indicates the number of decimal places that an integer must be shifted in order to get a correct size (uint64).
* i.e. 0 means there are no fractional orders for the market, and order sizes are always whole sizes.
* 2 means sizes given as 10^2 * desired size, e.g. a desired size of 1.23 is represented as 123 in this market.
* This sets how big the smallest order / position on the market can be.
@@ -156,16 +156,13 @@ export interface Markets_marketsConnection_edges_node {
*/
tradableInstrument: Markets_marketsConnection_edges_node_tradableInstrument;
/**
* Timestamps for state changes in the market
* timestamps for state changes in the market
*/
marketTimestamps: Markets_marketsConnection_edges_node_marketTimestamps;
}
export interface Markets_marketsConnection_edges {
__typename: "MarketEdge";
/**
* The market
*/
node: Markets_marketsConnection_edges_node;
}
@@ -178,8 +175,5 @@ export interface Markets_marketsConnection {
}
export interface Markets {
/**
* One or more instruments that are trading on the Vega network
*/
marketsConnection: Markets_marketsConnection | null;
}
+3 -25
View File
@@ -9,7 +9,7 @@ import { Interval } from "@vegaprotocol/types";
// GraphQL query operation: MarketsCandlesQuery
// ====================================================
export interface MarketsCandlesQuery_marketsConnection_edges_node_candlesConnection_edges_node {
export interface MarketsCandlesQuery_marketsConnection_edges_node_candles {
__typename: "Candle";
/**
* High price (uint64)
@@ -33,22 +33,6 @@ export interface MarketsCandlesQuery_marketsConnection_edges_node_candlesConnect
volume: string;
}
export interface MarketsCandlesQuery_marketsConnection_edges_node_candlesConnection_edges {
__typename: "CandleEdge";
/**
* The candle
*/
node: MarketsCandlesQuery_marketsConnection_edges_node_candlesConnection_edges_node;
}
export interface MarketsCandlesQuery_marketsConnection_edges_node_candlesConnection {
__typename: "CandleDataConnection";
/**
* The candles
*/
edges: (MarketsCandlesQuery_marketsConnection_edges_node_candlesConnection_edges | null)[] | null;
}
export interface MarketsCandlesQuery_marketsConnection_edges_node {
__typename: "Market";
/**
@@ -56,16 +40,13 @@ export interface MarketsCandlesQuery_marketsConnection_edges_node {
*/
id: string;
/**
* Candles on a market, for the 'last' n candles, at 'interval' seconds as specified by parameters using cursor based pagination
* Candles on a market, for the 'last' n candles, at 'interval' seconds as specified by parameters
*/
candlesConnection: MarketsCandlesQuery_marketsConnection_edges_node_candlesConnection | null;
candles: (MarketsCandlesQuery_marketsConnection_edges_node_candles | null)[] | null;
}
export interface MarketsCandlesQuery_marketsConnection_edges {
__typename: "MarketEdge";
/**
* The market
*/
node: MarketsCandlesQuery_marketsConnection_edges_node;
}
@@ -78,9 +59,6 @@ export interface MarketsCandlesQuery_marketsConnection {
}
export interface MarketsCandlesQuery {
/**
* One or more instruments that are trading on the Vega network
*/
marketsConnection: MarketsCandlesQuery_marketsConnection | null;
}
+11 -17
View File
@@ -20,47 +20,47 @@ export interface MarketsDataQuery_marketsConnection_edges_node_data_market {
export interface MarketsDataQuery_marketsConnection_edges_node_data {
__typename: "MarketData";
/**
* Market of the associated mark price
* market of the associated mark price
*/
market: MarketsDataQuery_marketsConnection_edges_node_data_market;
/**
* The highest price level on an order book for buy orders.
* the highest price level on an order book for buy orders.
*/
bestBidPrice: string;
/**
* The lowest price level on an order book for offer orders.
* the lowest price level on an order book for offer orders.
*/
bestOfferPrice: string;
/**
* The mark price (an unsigned integer)
* the mark price (an unsigned integer)
*/
markPrice: string;
/**
* What triggered an auction (if an auction was started)
* what triggered an auction (if an auction was started)
*/
trigger: AuctionTrigger;
/**
* The arithmetic average of the best static bid price and best static offer price
* the arithmetic average of the best static bid price and best static offer price
*/
staticMidPrice: string;
/**
* What mode the market is in (auction, continuous, etc)
* what mode the market is in (auction, continuous, etc)
*/
marketTradingMode: MarketTradingMode;
/**
* Indicative volume if the auction ended now, 0 if not in auction mode
* indicative volume if the auction ended now, 0 if not in auction mode
*/
indicativeVolume: string;
/**
* Indicative price if the auction ended now, 0 if not in auction mode
* indicative price if the auction ended now, 0 if not in auction mode
*/
indicativePrice: string;
/**
* The highest price level on an order book for buy orders not including pegged orders.
* the highest price level on an order book for buy orders not including pegged orders.
*/
bestStaticBidPrice: string;
/**
* The lowest price level on an order book for offer orders not including pegged orders.
* the lowest price level on an order book for offer orders not including pegged orders.
*/
bestStaticOfferPrice: string;
}
@@ -75,9 +75,6 @@ export interface MarketsDataQuery_marketsConnection_edges_node {
export interface MarketsDataQuery_marketsConnection_edges {
__typename: "MarketEdge";
/**
* The market
*/
node: MarketsDataQuery_marketsConnection_edges_node;
}
@@ -90,8 +87,5 @@ export interface MarketsDataQuery_marketsConnection {
}
export interface MarketsDataQuery {
/**
* One or more instruments that are trading on the Vega network
*/
marketsConnection: MarketsDataQuery_marketsConnection | null;
}
@@ -1,8 +1,9 @@
import compact from 'lodash/compact';
import { gql } from '@apollo/client';
import { makeDataProvider } from '@vegaprotocol/react-helpers';
import type {
MarketCandlesQuery,
MarketCandlesQuery_marketsConnection_edges_node_candlesConnection_edges_node,
MarketCandlesQuery_marketsConnection_edges_node_candles,
MarketCandlesSub,
MarketCandlesSub_candles,
} from './__generated__';
@@ -16,9 +17,7 @@ export const MARKET_CANDLES_QUERY = gql`
marketsConnection(id: $marketId) {
edges {
node {
candlesConnection(interval: $interval, since: $since) {
edges {
node {
candles(interval: $interval, since: $since) {
high
low
open
@@ -29,8 +28,6 @@ export const MARKET_CANDLES_QUERY = gql`
}
}
}
}
}
`;
const MARKET_CANDLES_SUB = gql`
@@ -45,8 +42,7 @@ const MARKET_CANDLES_SUB = gql`
}
`;
export type Candle =
MarketCandlesQuery_marketsConnection_edges_node_candlesConnection_edges_node;
export type Candle = MarketCandlesQuery_marketsConnection_edges_node_candles;
const update = (data: Candle[], delta: MarketCandlesSub_candles) => {
return data && delta
@@ -60,10 +56,9 @@ const update = (data: Candle[], delta: MarketCandlesSub_candles) => {
: data;
};
const getData = (responseData: MarketCandlesQuery): Candle[] | null =>
responseData?.marketsConnection?.edges[0]?.node.candlesConnection?.edges
?.filter((edge) => edge?.node)
.map((edge) => edge?.node as Candle) || null;
const getData = (responseData: MarketCandlesQuery): Candle[] | null => {
return compact(responseData?.marketsConnection?.edges[0]?.node.candles);
};
const getDelta = (
subscriptionData: MarketCandlesSub
@@ -1,9 +1,10 @@
import compact from 'lodash/compact';
import { gql } from '@apollo/client';
import { makeDataProvider } from '@vegaprotocol/react-helpers';
import type {
MarketsCandlesQuery,
MarketsCandlesQuery_marketsConnection_edges_node as Market,
MarketsCandlesQuery_marketsConnection_edges_node_candlesConnection_edges_node as Candle,
MarketsCandlesQuery_marketsConnection_edges_node_candles as Candle,
} from './__generated__';
export const MARKETS_CANDLES_QUERY = gql`
@@ -12,9 +13,7 @@ export const MARKETS_CANDLES_QUERY = gql`
edges {
node {
id
candlesConnection(interval: $interval, since: $since) {
edges {
node {
candles(interval: $interval, since: $since) {
high
low
open
@@ -25,8 +24,6 @@ export const MARKETS_CANDLES_QUERY = gql`
}
}
}
}
}
`;
export interface MarketCandles {
@@ -37,9 +34,7 @@ export interface MarketCandles {
const getData = (responseData: MarketsCandlesQuery): MarketCandles[] | null =>
responseData?.marketsConnection?.edges.map((edge) => ({
marketId: edge.node.id,
candles: edge.node.candlesConnection?.edges
?.filter((edge) => edge?.node)
.map((edge) => edge?.node as Candle),
candles: compact(edge.node.candles),
})) || null;
export const marketsCandlesProvider = makeDataProvider<
@@ -85,11 +85,11 @@ export interface NetworkStats_statistics {
export interface NetworkStats {
/**
* Returns information about nodes
* returns information about nodes
*/
nodeData: NetworkStats_nodeData | null;
/**
* Get statistics about the Vega node
* get statistics about the Vega node
*/
statistics: NetworkStats_statistics;
}
@@ -75,33 +75,15 @@ export interface Orders_party_ordersConnection_edges_node {
export interface Orders_party_ordersConnection_edges {
__typename: "OrderEdge";
/**
* The order
*/
node: Orders_party_ordersConnection_edges_node;
/**
* The cursor for this order
*/
cursor: string | null;
}
export interface Orders_party_ordersConnection_pageInfo {
__typename: "PageInfo";
/**
* The first cursor in the current page
*/
startCursor: string;
/**
* The last cursor in the current page
*/
endCursor: string;
/**
* The connection has more pages to fetch when traversing forward through the connection
*/
hasNextPage: boolean;
/**
* The connection has more pages to fetch when traversing backward through the connection
*/
hasPreviousPage: boolean;
}
@@ -153,7 +153,7 @@ export const ordersWithMarketProvider = makeDerivedDataProvider<
>(
[ordersProvider, marketsProvider],
(partsData): OrderWithMarketEdge[] =>
(partsData[0] as Parameters<typeof update>['0']).map((edge) => ({
(partsData[0] as Parameters<typeof update>['0'])?.map((edge) => ({
cursor: edge.cursor,
node: {
...edge.node,
+4 -4
View File
@@ -40,7 +40,7 @@ export interface OrderEvent_busEvents_event_Order_market {
*/
tradableInstrument: OrderEvent_busEvents_event_Order_market_tradableInstrument;
/**
* The number of decimal places that an integer must be shifted by in order to get a correct
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
* number denominated in the currency of the market. (uint64)
*
* Examples:
@@ -57,7 +57,7 @@ export interface OrderEvent_busEvents_event_Order_market {
*/
decimalPlaces: number;
/**
* The number of decimal places that an integer must be shifted in order to get a correct size (uint64).
* positionDecimalPlaces indicates the number of decimal places that an integer must be shifted in order to get a correct size (uint64).
* i.e. 0 means there are no fractional orders for the market, and order sizes are always whole sizes.
* 2 means sizes given as 10^2 * desired size, e.g. a desired size of 1.23 is represented as 123 in this market.
* This sets how big the smallest order / position on the market can be.
@@ -118,11 +118,11 @@ export type OrderEvent_busEvents_event = OrderEvent_busEvents_event_TimeUpdate |
export interface OrderEvent_busEvents {
__typename: "BusEvent";
/**
* The type of event
* the type of event
*/
type: BusEventType;
/**
* The payload - the wrapped event
* the payload - the wrapped event
*/
event: OrderEvent_busEvents_event;
}
+9 -9
View File
@@ -28,19 +28,19 @@ export interface PositionFields_marginsConnection_edges_node_asset {
export interface PositionFields_marginsConnection_edges_node {
__typename: "MarginLevels";
/**
* Market in which the margin is required for this party
* market in which the margin is required for this party
*/
market: PositionFields_marginsConnection_edges_node_market;
/**
* Minimal margin for the position to be maintained in the network (unsigned integer)
* minimal margin for the position to be maintained in the network (unsigned integer)
*/
maintenanceLevel: string;
/**
* If the margin is between maintenance and search, the network will initiate a collateral search (unsigned integer)
* if the margin is between maintenance and search, the network will initiate a collateral search (unsigned integer)
*/
searchLevel: string;
/**
* This is the minimum margin required for a party to place a new order on the network (unsigned integer)
* this is the minimum margin required for a party to place a new order on the network (unsigned integer)
*/
initialLevel: string;
/**
@@ -49,7 +49,7 @@ export interface PositionFields_marginsConnection_edges_node {
*/
collateralReleaseLevel: string;
/**
* Asset for the current margins
* asset for the current margins
*/
asset: PositionFields_marginsConnection_edges_node_asset;
}
@@ -94,11 +94,11 @@ export interface PositionFields_market_data_market {
export interface PositionFields_market_data {
__typename: "MarketData";
/**
* The mark price (an unsigned integer)
* the mark price (an unsigned integer)
*/
markPrice: string;
/**
* Market of the associated mark price
* market of the associated mark price
*/
market: PositionFields_market_data_market;
}
@@ -110,7 +110,7 @@ export interface PositionFields_market {
*/
id: string;
/**
* The number of decimal places that an integer must be shifted by in order to get a correct
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
* number denominated in the currency of the market. (uint64)
*
* Examples:
@@ -127,7 +127,7 @@ export interface PositionFields_market {
*/
decimalPlaces: number;
/**
* The number of decimal places that an integer must be shifted in order to get a correct size (uint64).
* positionDecimalPlaces indicates the number of decimal places that an integer must be shifted in order to get a correct size (uint64).
* i.e. 0 means there are no fractional orders for the market, and order sizes are always whole sizes.
* 2 means sizes given as 10^2 * desired size, e.g. a desired size of 1.23 is represented as 123 in this market.
* This sets how big the smallest order / position on the market can be.
+9 -12
View File
@@ -28,19 +28,19 @@ export interface Positions_party_positionsConnection_edges_node_marginsConnectio
export interface Positions_party_positionsConnection_edges_node_marginsConnection_edges_node {
__typename: "MarginLevels";
/**
* Market in which the margin is required for this party
* market in which the margin is required for this party
*/
market: Positions_party_positionsConnection_edges_node_marginsConnection_edges_node_market;
/**
* Minimal margin for the position to be maintained in the network (unsigned integer)
* minimal margin for the position to be maintained in the network (unsigned integer)
*/
maintenanceLevel: string;
/**
* If the margin is between maintenance and search, the network will initiate a collateral search (unsigned integer)
* if the margin is between maintenance and search, the network will initiate a collateral search (unsigned integer)
*/
searchLevel: string;
/**
* This is the minimum margin required for a party to place a new order on the network (unsigned integer)
* this is the minimum margin required for a party to place a new order on the network (unsigned integer)
*/
initialLevel: string;
/**
@@ -49,7 +49,7 @@ export interface Positions_party_positionsConnection_edges_node_marginsConnectio
*/
collateralReleaseLevel: string;
/**
* Asset for the current margins
* asset for the current margins
*/
asset: Positions_party_positionsConnection_edges_node_marginsConnection_edges_node_asset;
}
@@ -94,11 +94,11 @@ export interface Positions_party_positionsConnection_edges_node_market_data_mark
export interface Positions_party_positionsConnection_edges_node_market_data {
__typename: "MarketData";
/**
* The mark price (an unsigned integer)
* the mark price (an unsigned integer)
*/
markPrice: string;
/**
* Market of the associated mark price
* market of the associated mark price
*/
market: Positions_party_positionsConnection_edges_node_market_data_market;
}
@@ -110,7 +110,7 @@ export interface Positions_party_positionsConnection_edges_node_market {
*/
id: string;
/**
* The number of decimal places that an integer must be shifted by in order to get a correct
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
* number denominated in the currency of the market. (uint64)
*
* Examples:
@@ -127,7 +127,7 @@ export interface Positions_party_positionsConnection_edges_node_market {
*/
decimalPlaces: number;
/**
* The number of decimal places that an integer must be shifted in order to get a correct size (uint64).
* positionDecimalPlaces indicates the number of decimal places that an integer must be shifted in order to get a correct size (uint64).
* i.e. 0 means there are no fractional orders for the market, and order sizes are always whole sizes.
* 2 means sizes given as 10^2 * desired size, e.g. a desired size of 1.23 is represented as 123 in this market.
* This sets how big the smallest order / position on the market can be.
@@ -181,9 +181,6 @@ export interface Positions_party_positionsConnection_edges_node {
export interface Positions_party_positionsConnection_edges {
__typename: "PositionEdge";
/**
* The position
*/
node: Positions_party_positionsConnection_edges_node;
}
@@ -28,19 +28,19 @@ export interface PositionsSubscription_positions_marginsConnection_edges_node_as
export interface PositionsSubscription_positions_marginsConnection_edges_node {
__typename: "MarginLevels";
/**
* Market in which the margin is required for this party
* market in which the margin is required for this party
*/
market: PositionsSubscription_positions_marginsConnection_edges_node_market;
/**
* Minimal margin for the position to be maintained in the network (unsigned integer)
* minimal margin for the position to be maintained in the network (unsigned integer)
*/
maintenanceLevel: string;
/**
* If the margin is between maintenance and search, the network will initiate a collateral search (unsigned integer)
* if the margin is between maintenance and search, the network will initiate a collateral search (unsigned integer)
*/
searchLevel: string;
/**
* This is the minimum margin required for a party to place a new order on the network (unsigned integer)
* this is the minimum margin required for a party to place a new order on the network (unsigned integer)
*/
initialLevel: string;
/**
@@ -49,7 +49,7 @@ export interface PositionsSubscription_positions_marginsConnection_edges_node {
*/
collateralReleaseLevel: string;
/**
* Asset for the current margins
* asset for the current margins
*/
asset: PositionsSubscription_positions_marginsConnection_edges_node_asset;
}
@@ -94,11 +94,11 @@ export interface PositionsSubscription_positions_market_data_market {
export interface PositionsSubscription_positions_market_data {
__typename: "MarketData";
/**
* The mark price (an unsigned integer)
* the mark price (an unsigned integer)
*/
markPrice: string;
/**
* Market of the associated mark price
* market of the associated mark price
*/
market: PositionsSubscription_positions_market_data_market;
}
@@ -110,7 +110,7 @@ export interface PositionsSubscription_positions_market {
*/
id: string;
/**
* The number of decimal places that an integer must be shifted by in order to get a correct
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
* number denominated in the currency of the market. (uint64)
*
* Examples:
@@ -127,7 +127,7 @@ export interface PositionsSubscription_positions_market {
*/
decimalPlaces: number;
/**
* The number of decimal places that an integer must be shifted in order to get a correct size (uint64).
* positionDecimalPlaces indicates the number of decimal places that an integer must be shifted in order to get a correct size (uint64).
* i.e. 0 means there are no fractional orders for the market, and order sizes are always whole sizes.
* 2 means sizes given as 10^2 * desired size, e.g. a desired size of 1.23 is represented as 123 in this market.
* This sets how big the smallest order / position on the market can be.
+1 -1
View File
@@ -21,7 +21,7 @@ export interface NetworkParams_networkParameters {
export interface NetworkParams {
/**
* Return the full list of network parameters
* return the full list of network parameters
*/
networkParameters: NetworkParams_networkParameters[] | null;
}
+1 -19
View File
@@ -28,7 +28,7 @@ export interface Trades_market_tradesConnection_edges_node {
*/
price: string;
/**
* The number of units traded, will always be <= the remaining size of both orders immediately before the trade (uint64)
* The number of contracts trades, will always be <= the remaining size of both orders immediately before the trade (uint64)
*/
size: string;
/**
@@ -43,33 +43,15 @@ export interface Trades_market_tradesConnection_edges_node {
export interface Trades_market_tradesConnection_edges {
__typename: "TradeEdge";
/**
* The trade
*/
node: Trades_market_tradesConnection_edges_node;
/**
* The cursor for this trade
*/
cursor: string;
}
export interface Trades_market_tradesConnection_pageInfo {
__typename: "PageInfo";
/**
* The first cursor in the current page
*/
startCursor: string;
/**
* The last cursor in the current page
*/
endCursor: string;
/**
* The connection has more pages to fetch when traversing forward through the connection
*/
hasNextPage: boolean;
/**
* The connection has more pages to fetch when traversing backward through the connection
*/
hasPreviousPage: boolean;
}
-1
View File
@@ -1 +0,0 @@
GRAPHQL_SCHEMA_PATH=https://api.n04.d.vega.xyz/graphql
+2 -5
View File
@@ -143,9 +143,6 @@ export enum MarketTradingMode {
TRADING_MODE_OPENING_AUCTION = "TRADING_MODE_OPENING_AUCTION",
}
/**
* Validating status of a node, i.e. validator or non-validator
*/
export enum NodeStatus {
NODE_STATUS_NON_VALIDATOR = "NODE_STATUS_NON_VALIDATOR",
NODE_STATUS_VALIDATOR = "NODE_STATUS_VALIDATOR",
@@ -160,7 +157,7 @@ export enum OracleSpecStatus {
}
/**
* Why the order was rejected by the core node
* Reason for the order being rejected by the core node
*/
export enum OrderRejectionReason {
ORDER_ERROR_AMEND_FAILURE = "ORDER_ERROR_AMEND_FAILURE",
@@ -255,7 +252,7 @@ export enum PropertyKeyType {
}
/**
* Why the proposal was rejected by the core node
* Reason for the proposal being rejected by the core node
*/
export enum ProposalRejectionReason {
PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE = "PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE",
+201 -300
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -21,7 +21,7 @@ export interface NetworkParamsQuery_networkParameters {
export interface NetworkParamsQuery {
/**
* Return the full list of network parameters
* return the full list of network parameters
*/
networkParameters: NetworkParamsQuery_networkParameters[] | null;
}
+1 -1
View File
@@ -42,7 +42,7 @@ export interface Erc20Approval_erc20WithdrawalApproval {
export interface Erc20Approval {
/**
* Find an erc20 withdrawal approval using its withdrawal ID
* find an erc20 withdrawal approval using its withdrawal ID
*/
erc20WithdrawalApproval: Erc20Approval_erc20WithdrawalApproval | null;
}
@@ -109,9 +109,6 @@ export interface WithdrawFormQuery_assetsConnection_edges_node {
export interface WithdrawFormQuery_assetsConnection_edges {
__typename: "AssetEdge";
/**
* The asset information
*/
node: WithdrawFormQuery_assetsConnection_edges_node;
}
+1 -1
View File
@@ -108,7 +108,7 @@ export type WithdrawalEvent_busEvents_event = WithdrawalEvent_busEvents_event_Ti
export interface WithdrawalEvent_busEvents {
__typename: "BusEvent";
/**
* The payload - the wrapped event
* the payload - the wrapped event
*/
event: WithdrawalEvent_busEvents_event;
}
-3
View File
@@ -101,9 +101,6 @@ export interface Withdrawals_party_withdrawalsConnection_edges_node {
export interface Withdrawals_party_withdrawalsConnection_edges {
__typename: "WithdrawalEdge";
/**
* The withdrawal
*/
node: Withdrawals_party_withdrawalsConnection_edges_node;
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "nx-monorepo",
"version": "0.0.0",
"version": "0.55.0-0.0",
"license": "MIT",
"scripts": {
"start": "nx serve",