code.vegaprotocol.io/vega@v0.79.0/datanode/integration/market_test.go (about) 1 // Copyright (C) 2023 Gobalsky Labs Limited 2 // 3 // This program is free software: you can redistribute it and/or modify 4 // it under the terms of the GNU Affero General Public License as 5 // published by the Free Software Foundation, either version 3 of the 6 // License, or (at your option) any later version. 7 // 8 // This program is distributed in the hope that it will be useful, 9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 // GNU Affero General Public License for more details. 12 // 13 // You should have received a copy of the GNU Affero General Public License 14 // along with this program. If not, see <http://www.gnu.org/licenses/>. 15 16 package integration_test 17 18 import "testing" 19 20 func TestMarkets(t *testing.T) { 21 queries := map[string]string{ 22 "Basic": "{ marketsConnection{ edges { node { id, decimalPlaces, tradingMode, state } } } }", 23 "Fees": "{ marketsConnection{ edges { node { id, fees { factors { makerFee, infrastructureFee, liquidityFee } } } } } }", 24 "Instrument": "{ marketsConnection{ edges { node { id, tradableInstrument{ instrument{ id, code, name, metadata{ tags } } } } } } }", 25 "MarginCalculator": "{ marketsConnection{ edges { node { id, tradableInstrument{ marginCalculator{ scalingFactors{ searchLevel, initialMargin,collateralRelease } } } } } } }", 26 "PriceMonitor": "{ marketsConnection{ edges { node { id, priceMonitoringSettings{ parameters{ triggers{ horizonSecs, probability } } } } } } }", 27 "LiquidityMonitor": "{ marketsConnection{ edges { node { id, liquidityMonitoringParameters{ targetStakeParameters{ timeWindow, scalingFactor } } } } } }", 28 "Proposal": "{ marketsConnection{ edges { node { id, proposal{ id, reference, party { id }, state, datetime, rejectionReason} } } } }", 29 "ProposalTerms": "{ marketsConnection{ edges { node { id, proposal{ id, terms{ closingDatetime, enactmentDatetime } } } } } }", 30 "ProposalYes": "{ marketsConnection{ edges { node { id, proposal{ id, votes{ yes{ totalNumber totalWeight totalTokens} } } } } } }", 31 "ProposalYesVotes": "{ marketsConnection{ edges { node { id, proposal{ id, votes{ yes{ votes{value, party { id }, datetime, proposalId, governanceTokenBalance, governanceTokenWeight} } } } } } } }", 32 "ProposalNo": "{ marketsConnection{ edges { node { id, proposal{ id, votes{ no{ totalNumber totalWeight totalTokens} } } } } } }", 33 "PropsalNoVotes": "{ marketsConnection{ edges { node { id, proposal{ id, votes{ no{ votes{ value, party { id }, datetime, proposalId, governanceTokenBalance, governanceTokenWeight } } } } } } } }", 34 "Orders": "{ marketsConnection{ edges { node { id, ordersConnection{ edges { node { id, price, side, timeInForce, size, remaining, status, reference, type, rejectionReason, version, party{ id }, market{id}, tradesConnection{ edges{ node{ id } } } createdAt, expiresAt, updatedAt, peggedOrder { reference, offset } } } } } } } }", 35 "OrderLP": "{ marketsConnection{ edges { node { id, ordersConnection{ edges { node { id, liquidityProvision{ commitmentAmount, fee, status, version, reference, createdAt, updatedAt, market { id } } } } } } } } }", 36 "OrderTrades": "{ marketsConnection{ edges { node { id, tradesConnection{ edges { node { id, price, size, createdAt, market{ id }, type, buyOrder, sellOrder, buyer{id}, seller{id}, aggressor, buyerAuctionBatch, sellerAuctionBatch } } } } } } }", 37 "OrderBuyFees": "{ marketsConnection{ edges { node { id, tradesConnection{ edges { node { id, buyerFee { makerFee, infrastructureFee, liquidityFee } } } } } } } }", 38 "OrderSellFees": "{ marketsConnection{ edges { node { id, tradesConnection{ edges { node { id, sellerFee { makerFee, infrastructureFee, liquidityFee } } } } } } } }", 39 "Candles1Minute": "{ marketsConnection{ edges { node { id, candlesConnection(since : \"2000-01-01T00:00:00Z\",interval : INTERVAL_I1M) { edges { node { periodStart, lastUpdateInPeriod, high, low, open, close, volume } } } } } } }", 40 "Candles5Minute": "{ marketsConnection{ edges { node { id, candlesConnection(since : \"2000-01-01T00:00:00Z\",interval : INTERVAL_I5M) { edges { node { periodStart, lastUpdateInPeriod, high, low, open, close, volume } } } } } } }", 41 "Candles15Minute": "{ marketsConnection{ edges { node { id, candlesConnection(since : \"2000-01-01T00:00:00Z\",interval : INTERVAL_I15M) { edges { node { periodStart, lastUpdateInPeriod, high, low, open, close, volume } } } } } } }", 42 "RiskFactor": "{ marketsConnection{ edges { node { riskFactors { market, short, long } } } } }", 43 "LiquidityProvisions": "{ marketsConnection{ edges { node { id, liquidityProvisionsConnection { edges { node { id, party { id }, createdAt, updatedAt, market { id }, commitmentAmount, fee, sells { liquidityOrder { reference } }, buys { liquidityOrder { reference } }, version, status, reference } } } } } } }", 44 "Accounts": "{ marketsConnection{ edges { node { id, accountsConnection { edges { node { balance, asset {id}, type, market {id} } } } } } } }", 45 "MarketDepth": "{ marketsConnection{ edges { node { id, depth{ sequenceNumber buy{ price volume numberOfOrders} sell{ price volume numberOfOrders} lastTrade{ id buyer{id} seller{id} price size } } } } } }", 46 } 47 48 assertGraphQLQueriesReturnSame(t, queries["LiquidityProvisions"]) 49 50 for name, query := range queries { 51 t.Run(name, func(t *testing.T) { 52 assertGraphQLQueriesReturnSame(t, query) 53 }) 54 } 55 }