-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
17 lines (14 loc) · 1.6 KB
/
test.js
File metadata and controls
17 lines (14 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
const fs = require('fs');
const dotenv = require('dotenv');
const Avanza = require('avanza/dist/index.js');
const avanza = new Avanza();
dotenv.config();
avanza.authenticate({
username: process.env.AVANZA_USERNAME,
password: process.env.AVANZA_PASSWORD,
totpSecret: process.env.AVANZA_TOTP
}).then(() => {
avanza.getPositions().then(positions => {
fs.writeFileSync('positions.json', JSON.stringify(positions, null, 2));
});
});