-
Notifications
You must be signed in to change notification settings - Fork 14
/
account.ts
33 lines (26 loc) · 1.04 KB
/
account.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import {initClient} from './initClient';
import {ActivityHistoryRequest, TransactionHistoryRequest} from '../account/AccountAPI';
async function main(): Promise<void> {
const client = await initClient();
const accountsSession = await client.rest.account.getAccounts();
console.info(accountsSession.accounts[0].accountId);
const transactionHistoryRequest: TransactionHistoryRequest = {
maxSpanSeconds: 100000000,
};
const transactionHistorySession = await client.rest.account.getTransactionHistory(transactionHistoryRequest);
transactionHistorySession.transactions.forEach(transaction => {
console.info(transaction.instrumentName);
});
const activityHistoryRequest: ActivityHistoryRequest = {
from: '2021-01-01T00:00:00',
to: '2021-01-28T00:00:00',
};
const activityHistorySession = await client.rest.account.getActivityHistory(activityHistoryRequest);
activityHistorySession.activities.forEach(activity => {
console.info(activity.dealId);
});
}
main().catch(error => {
console.error(error);
process.exit(1);
});