fragment FillFields on Trade {
  id
  market {
    id
  }
  createdAt
  price
  size
  buyOrder
  sellOrder
  aggressor
  buyer {
    id
  }
  seller {
    id
  }
  buyerFee {
    makerFee
    infrastructureFee
    liquidityFee
  }
  sellerFee {
    makerFee
    infrastructureFee
    liquidityFee
  }
}

fragment FillEdge on TradeEdge {
  node {
    ...FillFields
  }
  cursor
}

query Fills($partyId: ID!, $marketId: ID, $pagination: Pagination) {
  party(id: $partyId) {
    id
    tradesConnection(marketId: $marketId, pagination: $pagination) {
      edges {
        ...FillEdge
      }
      pageInfo {
        startCursor
        endCursor
        hasNextPage
        hasPreviousPage
      }
    }
  }
}

subscription FillsEvent($partyId: ID!) {
  trades(partyId: $partyId) {
    id
    marketId
    buyOrder
    sellOrder
    buyerId
    sellerId
    aggressor
    price
    size
    createdAt
    type
    buyerFee {
      makerFee
      infrastructureFee
      liquidityFee
    }
    sellerFee {
      makerFee
      infrastructureFee
      liquidityFee
    }
  }
}
