stoqey/ibkr

Is there a way to use this with nodejs without having to use typescritp?

gamebak opened this issue · 1 comments

Can this package be used without typescript?

const { ibkr, AccountSummary, IBKREVENTS, IbkrEvents, PortFolioUpdate, getContractDetails } = require('@stoqey/ibkr')
async f() {
   await ibkr({ port: 7496, host: '127.0.0.1' })

    const accountId = AccountSummary.Instance.accountSummary.AccountId;
    const totalCashValue = AccountSummary.Instance.accountSummary.TotalCashValue;

    console.log('acc id:' + accountId)
}
f()
(node:20068) UnhandledPromiseRejectionWarning: TypeError: ibkr is not a function

Hi @gamebak, thanks for reporting this, please import ibkr as the default, const ibkr = require('@stoqey/ibkr'),

PS: if you were using typescript you would see that this would show an error const {ibkr} = require('@stoqey/ibkr'),