alpaca-trade-api-js: alpaca.getBarsV2 is not a function
following the Documentation:
getBarsV2(
symbol,
{
limit: number,
start: date isoformat string yyyy-mm-ddThh:MM:ss-04:00,
end: date isoformat string yyyy-mm-ddThh:MM:ss-04:00,
timeframe: "1Min" | "1Hour" | "1Day"
}
) => Promise<BarsObject>
Here is my code:
const alpaca = new Alpaca({
keyId: process.env.ALPACA_API_KEY_ID,
secretKey: process.env.ALPACA_API_SECRET_KEY,
paper: true,
usePolygon: false
})
alpaca.getBarsV2('GME', {
limit: 100,
start: new Date(Date.now() - 30 * 60 * 60 * 24 * 1000).toISOString(), // 30 days ago
end: new Date().toISOString(),
timeframe: '1Day',
})
Expected to get Bars. Got alpaca.getBarsV2 is not a function
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 18 (6 by maintainers)
For the time being if you’re using node.js. Here is my current solution. I decided to do the call manually.
an example value for startDate would be ‘2021-05-23’