wealthsimple-api
v1.0.1
Published
An unofficial wrapper for the WealthSimple API
Maintainers
Readme
wealthsimple-api
Unofficial WealthSimple API Documentation
This information was extracted from the web WSTrade client as well as the mobile app.
Use at your own risk.
This API documentation does not cover requests with write scopes (placing orders, etc).
API Documentation
See the following files
Node Package
Installation
Install via npm
npm i wealthsimple-apiOr simply clone the repo
git clone [email protected]:bufutda/wealthsimple-api.gitUsage
import {WSAPI} from 'wealthsimple-api';
import {createInterface} from 'node:readline';
function prompt(question) {
return new Promise((resolve, _reject) => {
const rl = createInterface({
input: process.stdin,
output: process.stdout
});
rl.question(question, (answer) => {
rl.close();
resolve(answer);
});
});
}
async function main() {
const api = new WSAPI();
await api.authenticator.authenticate({
username: '[email protected]',
password: '1234'
}, (method) => prompt(`2FA Code Required. (Check ${method}) > `));
// Regular API call
console.log(await api.searchForSecurity('AAPL'));
// GraphqL API call
console.log(await (await api.gql.query).fetchSecurity({securityId: 'sec-s-3c2fe9c9cff54ba283d291eebbd091c8'}));
// WebSocket API
api.socket.on('message', console.log);
await api.socket.initSocket();
// Get all buy and sell orders
for await (const order of api.getAllActivities({type: ['buy', 'sell']})) {
console.log(order);
}
}