https://github.com/auchenberg/node-personal-capital
Node.js SDK for Personal Capital
https://github.com/auchenberg/node-personal-capital
Last synced: 6 months ago
JSON representation
Node.js SDK for Personal Capital
- Host: GitHub
- URL: https://github.com/auchenberg/node-personal-capital
- Owner: auchenberg
- License: mit
- Created: 2020-11-22T22:30:49.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2020-11-22T23:26:40.000Z (almost 5 years ago)
- Last Synced: 2025-04-19T18:15:02.796Z (7 months ago)
- Language: TypeScript
- Size: 14.6 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
## Node.js SDK for the [Personal Capital](https://www.personalcapital.com/) private API.
Node.js SDK that implements the private API for Personal Capital.
Authentication to the Personal Capital API is a bit tricky, as it's cookie-based, so the SDK is using a persisted cookie storage mechanism, where cookies are stored in a JSON file. This enables 2FA authentication to work, as the cookie session is restored upon load.
### Installation
```bash
$ npm install personal-capital-sdk
```
### Example
```
const PersonalCapital = require("personal-capital-sdk").PersonalCapital;
let pc = new PersonalCapital({
cookiePath: "./pc-state.json",
});
(async () => {
try {
await pc.login("username", "password");
console.log("authenticated!");
let accounts = await pc.getAccounts();
console.log("accounts", accounts);
} catch (err) {
console.log("err", err);
if (err.message == "2FA_required") {
console.log("2FA_required");
await pc.challangeTwoFactor("sms");
//await pc.enterTwoFactorCode("sms", "");
//await pc.login("username", "password");
//let accounts = await pc.getAccounts();
}
}
})();
```
### API
Authentication:
- `login`
- `challangeTwoFactor`
- `enterTwoFactorCode`
API:
- `getHoldings`
- `getAccounts`
- `getHistories`
- `getUserTransactions`
- `updateInvestmentCashBalance`
## License
MIT
## Credits
- John Collins ([@jamaicanmoose](https://github.com/jamaicanmoose)) for https://github.com/JamaicanMoose/personalcapital-js
- Haochi Chen ([@haochi](https://github.com/haochi)) for https://github.com/haochi/personalcapital