questrade-ts v1.0.2
Questrade TS
This NPM Package is an unofficial Questrade API wrapper for NodeJS with full TypeScript support.
Getting Started
This NodeJS wrapper is an easy way to use the Questrade API immediately. It give full TypeScript support.
Simply start by installing this questrade-ts library:
npm install --save-exact questrade-ts
or
npm install --save-exact questrade-ts@latest
Currently, this API does not have any test suites installed and is therefore not to be considered ready for production
Until version 1.0 breaking change will occur at minor version change 0.X.0, Please make sure to open a GitHub issues for anything problematic to help us during the development phase of this project. use the --save-exact
flag until the version 1.0.x Using the caret (circumflex accentU+005E
) ^0.X.Y on a version stating with 0.x should not upgrade to folowing minor version but to have full control make sure you unsing that flag or -E
and then to upgrade to a new latest version use @latest
i.e. npm i --save-exact questrade-ts@latest
. alternatively you may use --no-save
to prevents saving to dependencies at all.
To obtain or provide feedback (as bug reports or enhancements): visit our GitHub Issue page To contribute to this project: visit the GitHub Repo page of the project
Features
- Token management
- Easy to use API calls
- Auto-select primary account
You will then need to get an API key.
After that, it is really simple to use:
// TypeScript/JavaScript
import { tokenConnection } from 'questrade-ts';
// using async Immediately Invoked Function Expressions to avoid using then().catch()
(async () => {
// always put your code in a try catch block
try {
// you do not have to put the token in plain text you should import it from elsewhere
const seedToken = 'YOUR-TOKEN-HERE_jKi1YCwCjAMJFugwD4A8cgb0';
const { qt } = await tokenConnection(seedToken);
const symb = await qt.searchSymbol('aapl');
console.log(symb);
console.log(await qt.getQuote(symb.symbolId));
} catch (error) {
// manage your errors here if needed
console.log(error.message);
}
})();
Security and Token management
Questrade's security token system requires that you save the latest refresh token that it vends you. After you create one in the user apps page, our library needs to save a key somewhere onto disk. By default, we create a folder for these keys in ./keys
at your working directory, but you can change the directory location or load from a text file (with the key as its contents).
In order to do that, you should set either the keyDir
option (defaults to ./keys
) or keyFile
to point to a file (defaults to using a directory.) -- See full options below.
Switching Accounts
By default, if you instantiate the Questrade
class without passing in an account ID to options, we will try to find and select the primary account (by fetching a list of all the accounts). If you want to change the account, simply do:
qt.account = '12345678'; // Switch to account 12345678 -- All future calls will use this 8 digits account.
Contributions
All contributions are welcome!
MIT LICENSE
Copyright (c) 2019 Benjamin Vincent Kasapoglu (Luxcium)
Copyright (c) 2016-2019 Leander Lee
Permission is hereby granted, free of charge, to all person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ALL KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ALL CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Questrade does not maintain this unofficial SDK
Refer to Questrade's Documentation to get help. Please always open a questrade-ts GitHub issue for anything you feel doesn't match the way it should be working when referring to Questrade docs.
Originaly based on the work of
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago