Node.js client for Wealthsimple API: https://developers.wealthsimple.com
This is still under development and therefore currently only supports sandbox.
npm install --save https://github.com/anthfran/wealthsimple-node
const credentials = {
"client_id": "XXXXXXXXX",
"client_secret": "XXXXXXXXX",
"redirect_uri": "https://localhost:3000/auth"
};
const Wealthsimple = require('wealthsimple-node').appId(credentials);
wealthsimple.tokenExchange(authCode)
.then(tokens => {
return Wealthsimple.listAccounts(tokens.access_token)
})
.then(accountResponse => {
console.log(accountResponse);
// do something with response
})
.catch(error => {
// do something with error
});
- tokenExchange
- tokenRefresh
- createUser
- listUsers
- getUser
- createPerson
- listPeople
- getPerson
- updatePerson
- createAccount
- listAccounts
- getAccount
- getAccountTypes
- getDailyValues
- listPositions
- listTransactions
- getProjection
- listBankAccounts
- createDeposit
- listDeposits
- getDeposit
Exchanges an auth code for OAuth2 tokens
codeString Auth string from Wealthsimple redirect
wealthsimple.tokenExchange(authCode).then(response=>console.log(response));Returns Promise Fetch promise which will resolve containing OAuth2 Tokens
Refreshes OAuth2 tokens
refreshTokenString Refresh Token
wealthsimple.tokenRefresh(refreshToken).then(response=>console.log(response));Returns Promise Fetch promise which will resolve containing OAuth2 Tokens
Create a User https://developers.wealthsimple.com/#operation/Create%20User
bodyObject
wealthsimple.createUser(body).then(response=>console.log(response));Returns Promise Fetch promise which will resolve with newly created user
List Users https://developers.wealthsimple.com/#operation/List%20Users This API will return a list of Users scoped by the authorization credentials.
tokenString OAuth token for a userparamsObject? See Wealthsimple website for an example of the request parameters
wealthsimple.listUsers(token).then(response=>console.log(response));let params = { limit: 25, offset: 50, created_before: "2017-06-21"};
wealthsimple.listUsers(token, params).then(response=>console.log(response));Returns Promise Fetch promise which will resolve with newly created user
Get User https://developers.wealthsimple.com/#operation/Get%20User
wealthsimple.getUser(token, userId).then(response=>console.log(response));Returns Promise Fetch promise which will resolve with user info
Create Person https://developers.wealthsimple.com/#operation/Create%20Person
tokenString OAuth token for a userbodyObject See Wealthsimple website for an example of the request body
wealthsimple.createPerson(token, body).then(response=>console.log(response));Returns Promise Fetch promise which will resolve with the created Person
List People https://developers.wealthsimple.com/#operation/List%20People This API will return a list of People scoped by the authorization credentials.
tokenString OAuth token for a userparamsObject See Wealthsimple website for an example of the request parameters
wealthsimple.createPerson(token, body).then(response=>console.log(response));Returns Promise Fetch promise which will resolve with the list of people
Get Person https://developers.wealthsimple.com/#operation/Get%20Person Get a Person entity if you know the person_id and the current credentials have access to the Person.
wealthsimple.getPerson(token, "person-12398ud").then(response=>console.log(response));Returns Promise Fetch promise which will resolve with the Person details
Update Person https://developers.wealthsimple.com/#operation/Update%20Person You can add/remove information to the Person entity as the information becomes available using this API. To remove a previously set attribute, set the value to null. Attributes that are not mentioned in the request payload will leave the attribute unchanged in the Person entity.
tokenString OAuth token for a userpersonIdString Example "person-12398ud"bodyObject See Wealthsimple website for an example of the body
wealthsimple.updatePerson(token, "person-12398ud", body).then(response=>console.log(response));Returns Promise Fetch promise which will resolve with the updated Person
Create Account https://developers.wealthsimple.com/#operation/Create%20Account You can add/remove information to the Person entity as the information becomes available using this API. To remove a previously set attribute, set the value to null. Attributes that are not mentioned in the request payload will leave the attribute unchanged in the Person entity.
tokenString OAuth token for a userpersonIdString Example "person-12398ud"bodyObject See Wealthsimple website for an example of the body
wealthsimple.createAccount(token, body).then(response=>console.log(response));Returns Promise Fetch promise which will resolve with the created Account
List Accounts https://developers.wealthsimple.com/#operation/List%20Accounts
tokenString OAuth token for a userparamsObject? Optional filter params, See Wealthsimple website for an example of the request parameters
wealthsimple.listAccounts(token).then(response=>console.log(response));wealthsimple.listAccounts(token,params).then(response=>console.log(response));Returns Promise Fetch promise which will resolve with the list of accounts
Get Account https://developers.wealthsimple.com/#operation/Get%20Account
wealthsimple.listAccounts(token).then(response=>console.log(response));wealthsimple.getAccount(token,accountId).then(response=>console.log(response));Returns Promise Fetch promise which will resolve with the account details
Get Account Types https://developers.wealthsimple.com/#operation/Get%20Account%20Types Returns openable account types. If a client_id is provided it will scope the types to the client in question, otherwise it will default to the requestor
tokenString OAuth token for a userparamsObject? Optional filter params, See Wealthsimple website for an example of the request parameters
wealthsimple.getAccountTypes(token).then(response=>console.log(response));wealthsimple.getAccountTypes(token,params).then(response=>console.log(response));Returns Promise Fetch promise which will resolve with the account details
Get Daily Values https://developers.wealthsimple.com/#operation/List%20Daily%20Values Returns historical daily values for a given account. This API will only return a maximum of 365 days worth of daily values from a given start date. By default, it will return historical values for the last 30-days. The start date must occur before the end date if provided. If the difference between the start date and the end date exceeds 365 days, an error will be thrown. The number of Daily Values can be potentially prohibitively large, the results are paginated.
tokenString OAuth token for a userparamsObject? Optional filter params, See Wealthsimple website for an example of the request parametersparams.accound_idObject Required account_id param
wealthsimple.getDailyValues(token,{ params.accound_id: "rrsp-r3e9c1w" }).then(response=>console.log(response));Returns Promise Fetch promise which will resolve with the account daily values
List Positions https://developers.wealthsimple.com/#tag/Positions Returns positions for a given account. This API will also allow you to retrieve historical Positions held on a given date.
tokenString OAuth token for a userparamsObject? Optional filter params, See Wealthsimple website for an example of the request parametersparams.accound_idObject Required account_id param
wealthsimple.listPositions(token,{ params.accound_id: "rrsp-r3e9c1w" }).then(response=>console.log(response));Returns Promise Fetch promise which will resolve with the account positions
List Transactions https://developers.wealthsimple.com/#operation/List%20Transactions Lists all Transactions. The number of Transactions can be potentially prohibitively large, the results are paginated. By default, the API will return the 250 latest transactions in the last 30 days.
tokenString OAuth token for a userparamsObject? Optional filter params, See Wealthsimple website for an example of the request parametersparams.accound_idObject Required account_id param
wealthsimple.listTransactions(token,{ params.accound_id: "rrsp-r3e9c1w" }).then(response=>console.log(response));Returns Promise Fetch promise which will resolve with the account transactions
Get Projection https://developers.wealthsimple.com/#operation/Get%20Projection Retrieves a projections of returns for an account based on deposits and frequency.
wealthsimple.getProjection(token, params).then(response=>console.log(response));Returns Promise Fetch promise which will resolve with the projection
List Bank Accounts https://developers.wealthsimple.com/#operation/List%20Bank%20Accounts
wealthsimple.listBankAccounts(token, params).then(response=>console.log(response));Returns Promise Fetch promise which will resolve with list of bank accounts
Create Deposit https://developers.wealthsimple.com/#operation/Create%20Deposit Initiates an electronic funds transfer to deposit funds to an Account from a Bank Account
wealthsimple.createDeposit(token, body).then(response=>console.log(response));Returns Promise Fetch promise which will resolve with deposit info
List Deposits https://developers.wealthsimple.com/#operation/List%20Deposits
wealthsimple.listDeposits(token, body).then(response=>console.log(response));Returns Promise Fetch promise which will resolve with deposit list
Get Deposit https://developers.wealthsimple.com/#operation/List%20Deposits
let fundsTransferId = "funds_transfer_id-r3e9c1w";
wealthsimple.getDeposit(token, fundsTransferId).then(response=>console.log(response));Returns Promise Fetch promise which will resolve with a deposit entity.