alpaca.getBarsV2 is not a function
See original GitHub issuefollowing 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
Issue Analytics
- State:
- Created 2 years ago
- Comments:17 (6 by maintainers)
Top Results From Across the Web
getBar and getAggregate api are missing on alpaca js object
Below are the errors, i am getting… How to fix it? TypeError: alpaca.getBars is not a function at Object. (D:\myproj\stockscreener\testalpaca.js ...
Read more >@neeschit/alpaca-trade-api - npm
Javascript library for the Alpaca Trade API. Latest version: 2.6.0, last published: a year ago. Start using @neeschit/alpaca-trade-api in ...
Read more >node-red-contrib-alpaca (node)
Added websocket v2 node (this one works!) Added Get Trade and Get Quote (aka "Get Last Trade/Quote") functions to main Alpaca node; Added...
Read more >npm:@alpacahq/alpaca-trade-api | Skypack
Javascript library for the Alpaca Trade API. ... As a general rule, required method parameters are passed as plain function arguments, and the...
Read more >ALPACA Error when try to load a page - Stack Overflow
Uncaught TypeError : $(...).alpaca is not a function(…) I AM GETTING AN ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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’
It still doesn’t appear to work properly (or as documented). Certainly doesn’t work close to the V1. I had to solve it via a direct API call to your V2 endpoint and then parse the response data accordingly.
Call to API endpoint (V2):
Example of how to parse the response data:
For more fun with trading bots, please visit https://github.com/michaeljwright/robobull-trading-bot