Useful Queries

Query Securities

Request:

query {
  allSecurities {
    nodes {
      id
      holdingsBySecurityId {
        nodes {
          id
          investorId
          amount
          createdOn
          accountByInvestorId {
            id
            name
            email
          }
        }
      }
    }
  }
}
Response:

{
  "data": {
    "allSecurities": {
      "nodes": [
        {
          "id": "6a93a168-31b6-4a67-b9f9-8cda51e5e6ba",
          "holdingsBySecurityId": {
            "nodes": [
              {
                "id": "67ebd6a5-3ffa-4336-b683-31d1d4251a2c",
                "investorId": "d6fb328d-2426-4689-98d0-8a0a03679a03",
                "amount": "100000.000000000000000000",
                "createdOn": "2021-12-16T22:05:46.253555+00:00",
                "accountByInvestorId": {
                  "id": "d6fb328d-2426-4689-98d0-8a0a03679a03",
                  "name": "Bob Smith",
                  "email": "bob.smith@example.com"
                }
              }
            ]
          }
        }
      ]
    }
  }
}

In this example, the query fetches all securities (and respective holdings) for which you are the listing ATS.

Query a Specific Security

Request:

query {
  securityById(id: "6a93a168-31b6-4a67-b9f9-8cda51e5e6ba") {
    id
    holdingsBySecurityId {
      nodes {
        id
        investorId
        amount
        createdOn
        accountByInvestorId {
          id
          name
          email
        }
      }
    }
  }
}
Response:

{
  "data": {
    "securityById": {
      "id": "6a93a168-31b6-4a67-b9f9-8cda51e5e6ba",
      "holdingsBySecurityId": {
        "nodes": [
          {
            "id": "67ebd6a5-3ffa-4336-b683-31d1d4251a2c",
            "investorId": "d6fb328d-2426-4689-98d0-8a0a03679a03",
            "amount": "100000.000000000000000000",
            "createdOn": "2021-12-16T22:05:46.253555+00:00",
            "accountByInvestorId": {
              "id": "d6fb328d-2426-4689-98d0-8a0a03679a03",
              "name": "Bob Smith",
              "email": "bob.smith@example.com"
            }
          }
        ]
      }
    }
  }
}

In this example, the query fetches an individual security (and respective holdings) by its ID.

Query an Investor’s Holdings

Request:

query {
  accountByTypeAndEmail(type: "investor", email: "bob.smith@example.com") {
    holdingsByInvestorId(filter: {amount: {greaterThan: "0"}}) {
      nodes {
        id
        securityId
        amount
        createdOn
      }
    }
  }
}
Response:

{
  "data": {
    "accountByTypeAndEmail": {
      "holdingsByInvestorId": {
        "nodes": [
          {
            "id": "67ebd6a5-3ffa-4336-b683-31d1d4251a2c",
            "securityId": "6a93a168-31b6-4a67-b9f9-8cda51e5e6ba",
            "amount": "100000.000000000000000000",
            "createdOn": "2021-12-16T22:05:46.253555+00:00"
          }
        ]
      }
    }
  }
}

In this example, the query fetches a specific investor’s holdings (with an optional filter for only holdings that are greater than zero).

Query Submitted Transfer Requests

Request:

query {
  allRequests {
    nodes {
      id
      stagedTransfersByRequestId {
        nodes {
          id
          accountId
          status
        }
      }
    }
  }
}
Response:

{
  "data": {
    "allRequests": {
      "nodes": [
        {
          "id": "171d4d20-72a3-4d0e-9e29-8b0f6fd5e83e",
          "stagedTransfersByRequestId": {
            "nodes": [
              {
                "id": "f8a7063b-11e8-481e-8c88-d2ef02abaa91",
                "accountId": "f65c9272-0586-468e-bd2a-6d908680cc57",
                "status": "review"
              }
            ]
          }
        },
        {
          "id": "c17d4b74-61f2-4c74-b106-bb658a67663a",
          "stagedTransfersByRequestId": {
            "nodes": [
              {
                "id": "3c09e83d-9f1d-461b-bbca-549cff51cea4",
                "accountId": "f65c9272-0586-468e-bd2a-6d908680cc57",
                "status": "complete"
              }
            ]
          }
        },
        {
          "id": "1e8a23a4-23be-4262-a95d-7d8773cfed2a",
          "stagedTransfersByRequestId": {
            "nodes": [
              {
                "id": "0e56f766-991d-44cc-b6cc-33df9dbb2b0d",
                "accountId": "e65c9272-0586-468e-bd2a-6d908680cc57",
                "status": "failed"
              }
            ]
          }
        }
      ]
    }
  }
}

In this example, the query returns ALL requests submitted using the batchTransfer mutation documented in this chapter. Standard GraphQL conditions/filters may be applied to this type of query in order limit the size of the result set. See the Appendix for more details.