fragment TradeFields on Trade {
  id
  price
  size
  createdAt
  aggressor
  market {
    id
  }
}

query Trades($marketId: ID!, $pagination: Pagination) {
  trades(filter: { marketIds: [$marketId] }, pagination: $pagination) {
    edges {
      node {
        ...TradeFields
      }
      cursor
    }
    pageInfo {
      startCursor
      endCursor
      hasNextPage
      hasPreviousPage
    }
  }
}

fragment TradeUpdateFields on TradeUpdate {
  id
  price
  size
  createdAt
  marketId
  aggressor
}

subscription TradesUpdate($marketId: ID!) {
  tradesStream(filter: { marketIds: [$marketId] }) {
    ...TradeUpdateFields
  }
}
