accounts
is a core module to encapsulates the domain of open accounts in your Wealthsimple Trade account. With the accounts
module, you can:
- Retrieve open account ids (TFSA, RRSP, etc) for use in other APIs
- Retrieve connected bank accounts and deposits
- Retrieve meta information about your Wealthsimple Trade account
- Retrieve positions in an open account (e.g., positions in TFSA)
Note: All operations in accounts
module require talking to Wealthsimple Trade endpoints. So make sure you are authenticated through the auth
module.
Retrieves an object containing the ids of all open accounts under your Wealthsimple Trade account. The returned object could include tfsa
, rrsp
, crypto
, and personal
ids.
accounts.all() -> Promise<AccountList>
{
tfsa: 'tfsa-zzzzzzzz',
rrsp: undefined,
crypto: 'non-registered-crypto-zzzzzzz',
personal: 'non-registered-zzzzzzzz'
}
Returns a list of details about your open accounts, like account type, buying power, current balance for each account.
accounts.data() -> Promise<Array<any>>
* This is not the full returned object - it has been cut.
[
{
object: 'account',
id: 'non-registered-zzzzzzzz',
deleted_at: null,
buying_power: { amount: 3000000, currency: 'CAD' },
current_balance: { amount: 200000, currency: 'CAD' },
withdrawn_earnings: { amount: 10000000, currency: 'CAD' },
net_deposits: { amount: 1000000, currency: 'CAD' },
available_to_withdraw: { amount: 1000000, currency: 'CAD' },
...
},
...
]
Retrieves some surface information about you like your name and email, account signatures, and other metadata.
accounts.me() -> Promise<any>
* This is not the full returned object - it has been cut.
{
object: 'user',
attempted_existing_bank_account_import: true,
attempted_existing_document_import: true,
first_name: 'Jane',
last_name: 'Doe',
feature_flags: [
'balance_service',
'tfsa',
'edit_kyc',
'sparkline_v2'
],
email: '[email protected]',
email_confirmed: true,
unconfirmed_email: null,
is_funded: true,
can_create_referral: false
}
Detailed information about you that you provided on signup, like residential and mailing addresses, employment, phone numbers, and so on.
accounts.person() -> Promise<any>
* This is not the full returned object - it has been cut.
{
email: '[email protected]',
phone_numbers: [ ... ],
residential_address: { ... },
mailing_address: { ... },
employment: { ... },
citizenships: [ 'CA' ],
date_of_birth: '1970-01-01',
full_legal_name: { first_name: 'Jane', middle_names: null, last_name: 'Doe' }
}
Query the history of the open account within the specified time interval.
- Valid interval values:
1d
,1w
,1m
,3m
,1y
accountId
should be one that is returned by accounts.all
accounts.history(interval, accountId) -> Promise<any>
* This is not the full returned object - it has been cut.
{
results: [
{
date: '2020-03-16',
value: [Object],
equity_value: [Object],
net_deposits: [Object],
withdrawn_earnings: [Object],
relative_equity_earnings: [Object]
},
{
date: '2020-03-17',
value: [Object],
equity_value: [Object],
net_deposits: [Object],
withdrawn_earnings: [Object],
relative_equity_earnings: [Object]
},
...
],
start_earnings: { amount: 100000.00, currency: 'CAD' }
}
See also: accounts.all
Fetches activities on your Wealthsimple Trade account. You can limit number of activities to fetch or refine what activities are fetched based on activity type (e.g., buy, sell), account (e.g., tfsa, rrsp).
filters.limit
: The number of activities to fetch. The maximum value is99
. However, if you wish to fetch all activities (which could be more than 99), leavefilters.limit
as undefined.filters.type
: The type of activities to fetch. This must be specified as an array of strings. Valid activity types:sell
,buy
,deposit
,withdrawal
,dividend
,institutional_transfer
,internal_transfer
,refund
,referral_bonus
, andaffiliate
.filters.accounts
: The accounts to pull activities from. This must be specified as an array of account ids that you get from accounts.all
Note: The filters parameter is optional. If you provide nothing, then all activities across all of your accounts will be fetched.
accounts.activities([filters]) -> Promise<Array<any>>
* This is not the full returned object - it has been cut.
[
{
id: 'funds_transfer-zzzzzzzzzzzzzzzzzzzzzzzzzzzzz',
bank_account_id: 'bank_account-zzzzzzzzzzzzzzzzzzzzzz',
created_at: '1970-01-01T14:16:46.000Z',
updated_at: '1970-01-01T23:16:32.185Z',
rejected_at: null,
cancelled_at: null,
accepted_at: '1970-01-01T00:12:55.000Z',
status: 'accepted',
value: { amount: 100000, currency: 'CAD' },
cancellable: false,
object: 'withdrawal',
withdrawal_reason: 'other',
tax_withholding: 0,
account_id: 'tfsa-zzzzzzzzz'
},
...
]
See also: accounts.all
Retrieves all bank accounts linked to the Wealthsimple Trade account.
accounts.getBankAccounts() -> Promise<Array<any>>
* This is not the full returned object - it has been cut.
[
{
object: 'bank_account',
id: 'bank_account-zzzzzzzzzzzzzzzzzzzzzzz',
type: 'chequing',
corporate: false,
account_name: null,
institution_name: 'RBC',
institution_number: '003',
transit_number: '***xx',
account_number: '****xxx',
jurisdiction: 'CA',
created_at: '1970-01-01T18:56:08Z',
updated_at: '1970-01-01T18:56:08Z',
verifications: [ [Object] ]
},
...
]
Grab all deposit records on the Wealthsimple Trade account.
accounts.deposits() -> Promise<Array<any>>
* This is not the full returned object - it has been cut.
[
{
id: 'funds_transfer-zzzzzzzzzzzzzzzzzzzzzz',
bank_account_id: 'bank_account-zzzzzzzzzzzzzzzzz',
created_at: '1970-01-01T00:17:12.000Z',
updated_at: '1970-01-01T18:54:50.188Z',
rejected_at: null,
cancelled_at: null,
accepted_at: '1970-01-01T04:00:00.000Z',
status: 'accepted',
value: { amount: 100000, currency: 'CAD' },
cancellable: false,
object: 'deposit',
account_id: 'non-registered-zzzzzzzz'
},
...
]
Lists all positions in the specified open account under the Wealthsimple Trade Account.
accountId
should be one that is returned by accounts.all
accounts.positions(accountId) -> Promise<Array<any>>
* This is not the full returned object - it has been cut.
[
{
// position 1
...
},
{
// position 2
...
},
...
]
See also: accounts.all