Example Use Case

Specifications

Let’s suppose that a customer wants to access information about the positions of a certain group of accounts filtered by the Master field for a specific date. From the position information, they are interested in knowing the Quantity, MarketValue, OriginalCost, and OriginalCostDate. Additionally, they need data about the Security of that position, specifically the SecurityTypeCode, PrimarySymbol, Cusip, and Sedol fields.

Endpoint URL

https://api.wealthtechs.com/v2/graphql/

Authorization

// Authorization via JWT Token

Authorization: Bearer <YourToken>

Responses

CodeType
200Success
204No Content
400Bad Request
401Unauthorized

Example Code

var myHeaders = new Headers();

myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySW5mbyI6IntcIklkXCI6OTgxLFwiSWRlbnRpdHlJZFwiOlwiNjMyMzhhZTQtMzAyMC00NWI5LWEwODktOTE2ZTY4MDMyZTY3XCIsXCJVc2VyTmFtZVwiOlwiMF9URVNUX0NMSUVOVFwiLFwiRW1haWxcIjpcInRlc3RjbGllbnRAd2VhbHRodGVjaHMuY29tXCIsXCJGaXJzdE5hbWVcIjpcIlRlc3RcIixcIkxhc3ROYW1lXCI6XCJDbGllbnRcIixcIklzQ2xpZW50VXNlclwiOmZhbHNlfSIsIm5iZiI6MTY5NDcwMjU3OSwiZXhwIjoxOTI0OTIzNjAwLCJpc3MiOiJXZWFsdGhUZWNocyIsImF1ZCI6IkFQSVVzZXJzIn0.bNcP0ouNwtFoxrI7pYXw0WKiw0TN6w_R2-Ban5moo1A");

var graphql = JSON.stringify({
  query: "{\r\n    accounts(\r\n        where: {master: {eq: \"123456789\"}, positions: {all: {processDate: {gte: \"2023-09-11T00:00:00.000-04:00\"}}}}\r\n    ) {\r\n        nodes {\r\n            number\r\n            master\r\n            positions {\r\n                quantity\r\n                marketValue\r\n                originalCost\r\n                originalCostDate\r\n                security {\r\n                    primarySymbol\r\n                    cusip\r\n                    sedol\r\n                    securityType {\r\n                        code\r\n                    }\r\n                }\r\n            }\r\n        }\r\n        pageInfo {\r\n            hasNextPage\r\n            hasPreviousPage\r\n            startCursor\r\n            endCursor\r\n        }\r\n    }\r\n}",
  variables: {}
})

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: graphql,
  redirect: 'follow'
};

fetch("https://api.wealthtechs.com/v2/graphql/", requestOptions)
  .then(response => response.json())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Example Response

{
    "data": {
        "accounts": {
            "nodes": [
                {
                    "number": "X72843476R",
                    "master": "123456789",
                    "positions": [
                        {
                            "quantity": 200000,
                            "marketValue": 198652.8,
                            "originalCost": 199112,
                            "originalCostDate": "1950-01-01T00:00:00.000-05:00",
                            "security": {
                                "primarySymbol": "C00084928",
                                "cusip": "C00084928",
                                "sedol": null,
                                "securityType": {
                                    "code": "CD"
                                }
                            }
                        },
                        {
                            "quantity": 200000,
                            "marketValue": 193444.6,
                            "originalCost": 200011,
                            "originalCostDate": "1950-01-01T00:00:00.000-05:00",
                            "security": {
                                "primarySymbol": "C00085168",
                                "cusip": "C00085168",
                                "sedol": null,
                                "securityType": {
                                    "code": "CD"
                                }
                            }
                        },
                        {
                            "quantity": 500000,
                            "marketValue": 495548,
                            "originalCost": 500012,
                            "originalCostDate": "1950-01-01T00:00:00.000-05:00",
                            "security": {
                                "primarySymbol": "C00086468",
                                "cusip": "C00086468",
                                "sedol": null,
                                "securityType": {
                                    "code": "CD"
                                }
                            }
                        }
                    ]
                }
            ],
            "pageInfo": {
                "hasNextPage": false,
                "hasPreviousPage": false,
                "startCursor": "MA==",
                "endCursor": "Mg=="
            }
        }
    }
}