avanza-ts
v0.7.0
Published
A wrapper for the unofficial Avanza API written in Typescript
Downloads
3
Readme
Avanza
Please note that I am not affiliated with Avanza Bank AB in any way. The underlying API can be taken down or changed without warning at any point in time.
A Node.js wrapper for the unofficial Avanza API. Written in TypeScript will full typings and tested with Jest.
Authentication methods:
- [ ] Username, password and TOTP (2FA) (WIP)
- [x] BankID
Quick start
Install
npm install avanza-ts
or
yarn add avanza-ts
Usage
BankID
import { AvanzaClient } from "avanza-ts";
import { toString } from "qrcode";
import fetch from "node-fetch";
async function main() {
const client = new AvanzaClient({ fetch });
console.log("Signin with BankID");
const res = await client.authenticateWithBankID(
"19900101-1000",
async (qrCode) => {
console.log("Scan this QR code with your BankID app", qrCode);
console.log(await toString(qrCode, { type: "terminal" }));
}
);
const positions = await client.account.getPositions();
console.log(positions);
}
main()
.then(() => {
console.log("Done with program");
})
.catch((err) => {
try {
const e = JSON.parse(err.message);
console.error(e);
} catch (e) {
console.error(err);
}
});
Documentation
TODO
Also see
Shoutouts
Major inspiration goes to Node.js unofficial avanza api
RESPONSIBILITIES
The author of this software is not responsible for any indirect damages (foreseeable or unforeseeable), such as, if necessary, loss or alteration of or fraudulent access to data, accidental transmission of viruses or of any other harmful element, loss of profits or opportunities, the cost of replacement goods and services or the attitude and behavior of a third party.