fragment CandleFields on Candle {
  periodStart
  lastUpdateInPeriod
  high
  low
  open
  close
  volume
}

query Candles($marketId: ID!, $interval: Interval!, $since: String!) {
  market(id: $marketId) {
    id
    decimalPlaces
    positionDecimalPlaces
    tradableInstrument {
      instrument {
        id
        name
        code
      }
    }
    candlesConnection(interval: $interval, since: $since) {
      edges {
        node {
          ...CandleFields
        }
      }
    }
  }
}

subscription CandlesEvents($marketId: ID!, $interval: Interval!) {
  candles(marketId: $marketId, interval: $interval) {
    ...CandleFields
  }
}
