Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NestJS--> TypeError: alpaca_trade_api_1.default is not a constructor #186

Open
en-ahsanali opened this issue Jan 16, 2022 · 4 comments
Open

Comments

@en-ahsanali
Copy link

en-ahsanali commented Jan 16, 2022

const alpaca =new Alpaca({ keyId: 'API_KEY', secretKey: 'SECRET' })
const websocket=alpaca.data_stream_v2

@en-ahsanali
Copy link
Author

Using Nestjs, and after connecting it. I tried accessing the websocket, and giving me this error. It is working fine on Nodejs

@MaherNajar
Copy link

Add this compiler option in tsconfig.json
{
"compilerOptions": {
"esModuleInterop": true
}
}

@brianhumphreys
Copy link

brianhumphreys commented Oct 21, 2024

I have the same issue. I set the compiler options like you suggested @MaherNajar .

i am on version

"@alpacahq/alpaca-trade-api": "3.1.2",

and I am initializing Alpaca exactly how the docs say to do it. https://docs.alpaca.markets/docs/getting-started-with-alpaca-market-data

import Alpaca from "@alpacahq/alpaca-trade-api";
const alpaca = new Alpaca({ keyId: 'API_KEY', secretKey: 'SECRET' });

But I am getting the compiler error

This expression is not callable.
  Type 'typeof import("/Users/brianhumphreys/brian/automation/potter-box/potter-function/process-potter-boxes/node_modules/.pnpm/@[email protected]/node_modules/@alpacahq/alpaca-trade-api/dist/index")' has no call signatures.ts(2349)

Is there a step that I am missing?

@brianhumphreys
Copy link

Screenshot 2024-10-21 at 8 15 13 AM
Here is the full TS build output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants