vegaprotocol / frontend-monorepo

Toolkit for building apps that interact with Vega
https://vega.xyz
MIT License
25 stars 17 forks source link

Positions table #128

Closed mattrussell36 closed 2 years ago

mattrussell36 commented 2 years ago

Note:

Example queries to get the above data

export const POSITIONS_FRAGMENT = gql`
  fragment PositionDetails on Position {
    realisedPNL
    openVolume
    unrealisedPNL
    averageEntryPrice
    market {
      id
      name
      data {
        markPrice
      }
      decimalPlaces
      tradableInstrument {
        instrument {
          id
          name
          metadata {
            tags
          }
          code
          product {
            ... on Future {
              settlementAsset {
                id
                symbol
                name
                decimals
              }
              quoteName
            }
          }
        }
      }
    }
  }
`

export const POSITION_QUERY = gql`
  ${POSITIONS_FRAGMENT}
  query positions($partyId: ID!) {
    party(id: $partyId) {
      id
      positions {
        ...PositionDetails
      }
    }
  }
`

export const POSITIONS_SUB = gql`
  ${POSITIONS_FRAGMENT}
  subscription positionSubscribe($partyId: ID!) {
    positions(partyId: $partyId) {
      ...PositionDetails
    }
  }
`
gordsport commented 2 years ago

Closing as in status Done