fragment MarketDataUpdateFields on ObservableMarketData {
  marketId
  auctionEnd
  auctionStart
  bestBidPrice
  bestBidVolume
  bestOfferPrice
  bestOfferVolume
  bestStaticBidPrice
  bestStaticBidVolume
  bestStaticOfferPrice
  bestStaticOfferVolume
  indicativePrice
  indicativeVolume
  marketState
  marketTradingMode
  marketValueProxy
  markPrice
  midPrice
  openInterest
  priceMonitoringBounds {
    minValidPrice
    maxValidPrice
    trigger {
      horizonSecs
      probability
      auctionExtensionSecs
    }
    referencePrice
  }
  staticMidPrice
  suppliedStake
  targetStake
  trigger
  lastTradedPrice
}

subscription MarketDataUpdate($marketId: ID!) {
  marketsData(marketIds: [$marketId]) {
    ...MarketDataUpdateFields
  }
}

fragment MarketDataFields on MarketData {
  market {
    id
  }
  auctionEnd
  auctionStart
  bestBidPrice
  bestBidVolume
  bestOfferPrice
  bestOfferVolume
  bestStaticBidPrice
  bestStaticBidVolume
  bestStaticOfferPrice
  bestStaticOfferVolume
  indicativePrice
  indicativeVolume
  marketState
  marketTradingMode
  marketValueProxy
  markPrice
  midPrice
  openInterest
  priceMonitoringBounds {
    minValidPrice
    maxValidPrice
    trigger {
      horizonSecs
      probability
      auctionExtensionSecs
    }
    referencePrice
  }
  staticMidPrice
  suppliedStake
  targetStake
  trigger
  lastTradedPrice
}

query MarketData($marketId: ID!) {
  marketsConnection(id: $marketId) {
    edges {
      node {
        data {
          ...MarketDataFields
        }
      }
    }
  }
}
