[Operation] Batch

Specifications

The term "batching" in the context of GraphQL often refers to the idea of batched or bulk queries, where multiple operations are combined into a single request to improve efficiency.

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: "query Accounts {\r\n    accounts {\r\n        nodes {\r\n            number\r\n            master\r\n            name\r\n        }\r\n    }\r\n    positions(where: { marketValue: { gt: 30000 }, originalCost: { lt: 20000 } }) {\r\n        nodes {\r\n            custodianId\r\n            customerId\r\n            processDate\r\n            accountId\r\n            securityId\r\n            shortPosition\r\n            quantity\r\n            marketValue\r\n            originalCost\r\n            originalCostDate\r\n            originalFace\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",
                    "name": "Test Account Name"
                },
                {
                    "number": "Y41213443S",
                    "master": "123456789",
                    "name": "Test Account Name"
                },
                {
                    "number": "Z68397130T",
                    "master": "123456789",
                    "name": "Test Account Name"
                }
            ]
        },
        "positions": {
            "nodes": [
                {
                    "custodianId": 0,
                    "customerId": 0,
                    "processDate": "2023-09-11T00:00:00.000-04:00",
                    "accountId": 12,
                    "securityId": 9929,
                    "shortPosition": false,
                    "quantity": 47662.5105000000,
                    "marketValue": 44605.5800000000,
                    "originalCost": 16405.2600000000,
                    "originalCostDate": "1950-01-01T00:00:00.000-05:00",
                    "originalFace": 275000.0000000000
                },
                {
                    "custodianId": 0,
                    "customerId": 0,
                    "processDate": "2023-09-11T00:00:00.000-04:00",
                    "accountId": 12,
                    "securityId": 10550,
                    "shortPosition": false,
                    "quantity": 35911.0080000000,
                    "marketValue": 34693.8400000000,
                    "originalCost": 11254.9900000000,
                    "originalCostDate": "1950-01-01T00:00:00.000-05:00",
                    "originalFace": 1800000.0000000000
                },
                {
                    "custodianId": 0,
                    "customerId": 0,
                    "processDate": "2023-09-11T00:00:00.000-04:00",
                    "accountId": 14,
                    "securityId": 13976,
                    "shortPosition": false,
                    "quantity": 588.0000000000,
                    "marketValue": 105463.6800000000,
                    "originalCost": 8521.2700000000,
                    "originalCostDate": "1950-01-01T00:00:00.000-05:00",
                    "originalFace": null
                },
                {
                    "custodianId": 0,
                    "customerId": 0,
                    "processDate": "2023-09-11T00:00:00.000-04:00",
                    "accountId": 14,
                    "securityId": 13989,
                    "shortPosition": false,
                    "quantity": 129.0000000000,
                    "marketValue": 42037.2300000000,
                    "originalCost": 6671.4800000000,
                    "originalCostDate": "1950-01-01T00:00:00.000-05:00",
                    "originalFace": null
                },
                {
                    "custodianId": 0,
                    "customerId": 0,
                    "processDate": "2023-09-11T00:00:00.000-04:00",
                    "accountId": 14,
                    "securityId": 13994,
                    "shortPosition": false,
                    "quantity": 56.0000000000,
                    "marketValue": 31612.0000000000,
                    "originalCost": 10657.6800000000,
                    "originalCostDate": "1950-01-01T00:00:00.000-05:00",
                    "originalFace": null
                },
                {
                    "custodianId": 0,
                    "customerId": 0,
                    "processDate": "2023-09-11T00:00:00.000-04:00",
                    "accountId": 14,
                    "securityId": 14703,
                    "shortPosition": false,
                    "quantity": 475.0000000000,
                    "marketValue": 65037.0000000000,
                    "originalCost": 6262.7300000000,
                    "originalCostDate": "1950-01-01T00:00:00.000-05:00",
                    "originalFace": null
                },
                {
                    "custodianId": 0,
                    "customerId": 0,
                    "processDate": "2023-09-11T00:00:00.000-04:00",
                    "accountId": 14,
                    "securityId": 14738,
                    "shortPosition": false,
                    "quantity": 110.0000000000,
                    "marketValue": 36120.7000000000,
                    "originalCost": 3130.0700000000,
                    "originalCostDate": "1950-01-01T00:00:00.000-05:00",
                    "originalFace": null
                },
                {
                    "custodianId": 0,
                    "customerId": 0,
                    "processDate": "2023-09-12T00:00:00.000-04:00",
                    "accountId": 12,
                    "securityId": 9929,
                    "shortPosition": false,
                    "quantity": 47662.5105000000,
                    "marketValue": 44575.0800000000,
                    "originalCost": 16405.2600000000,
                    "originalCostDate": "1950-01-01T00:00:00.000-05:00",
                    "originalFace": 275000.0000000000
                },
                {
                    "custodianId": 0,
                    "customerId": 0,
                    "processDate": "2023-09-12T00:00:00.000-04:00",
                    "accountId": 12,
                    "securityId": 10550,
                    "shortPosition": false,
                    "quantity": 35911.0080000000,
                    "marketValue": 34679.9400000000,
                    "originalCost": 11254.9900000000,
                    "originalCostDate": "1950-01-01T00:00:00.000-05:00",
                    "originalFace": 1800000.0000000000
                },
                {
                    "custodianId": 0,
                    "customerId": 0,
                    "processDate": "2023-09-12T00:00:00.000-04:00",
                    "accountId": 14,
                    "securityId": 13976,
                    "shortPosition": false,
                    "quantity": 588.0000000000,
                    "marketValue": 103664.4000000000,
                    "originalCost": 8521.2700000000,
                    "originalCostDate": "1950-01-01T00:00:00.000-05:00",
                    "originalFace": null
                }
            ]
        }
    }
}