🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

personal-capital-sdk

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

personal-capital-sdk

Node.js SDK for Personal Capital

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

Node.js SDK for the Personal Capital 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

$ 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", "<code>");
      //await pc.login("username", "password");
      //let accounts = await pc.getAccounts();
    }
  }
})();

API

Authentication:

  • login
  • challangeTwoFactor
  • enterTwoFactorCode

API:

  • getHoldings
  • getAccounts
  • getHistories
  • getUserTransactions
  • updateInvestmentCashBalance

License

MIT

Credits

Keywords

personal capital

FAQs

Package last updated on 22 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts