-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
Integration of other marketdata vendors / alpaca.markets #167
Comments
Thank you very much for the feature request! Let me add support for it definitely! |
Now that I am back, I will take care of this one. I may need your help testing it, as I don't have an Alpaca subscription unless they offer free tier. |
@cinar happy to help wherever I can. The alpaca marketdata can be freely accessed :) You only need to create a account (https://alpaca.markets/) and api key/secret. I've written a simplified example of receiving the bars from alpaca below (in hour format and of the last x days):
|
This is super helpful! I was trying to find the right API to use. Is GetBars will be enough or should I try to add support for the streaming APIs too? |
Yeah, I had the same problem when going trough the API Docs 😅 GetBars would be enough for me, others might find the streaming API very useful too. I had no chance to look into the streaming API yet so I am not sure how much extra work it will take to implement. Btw./Offtopic, I am currently playing around with the backtesting of v2 as well, but I couldn't get it running without issues yet. I always get "Best outcome for brk-b is 0.00% with Apo Strategy." for some reason, but thats a different issue I might open soon if I am not missing something important on my part. |
Awesome, yes, they have a ton of API, so I wasn't sure which one to use. Let me start with the GetBars then, and hopefully adding the streaming one is not a big deal later on. I am thinking of doing this as a separate Go module, so that I don't introduce a dependency to Alpaca directly. As soon as I have something functional, I'll share it here. Regarding the backtest problem. I've seen that happening before. At that time, I believe I had old data, and backtest was looking for a time window that I had no data points. Not sure if it is the same problem for you. Definitely let me know, I am also very curious. |
@iocron please take a look at https://github.com/cinar/indicatoralpaca. I hope it works the way you envisioned? |
Receiving the data seems to work as expected 👍 :) But the backtest seems off (I had to increase the date range to get any trading signals at all, otherwise i always get 0.00% as outcome). I created a fork and added a example to examples/alpaca_example_macd.go (https://github.com/iocron/indicatoralpaca). Running the example Btw, how can I choose multiple Timeframe Units the way it is implemented right now (e.g. for HTF/HigherTimeFrame Trading)? |
That's correct, I also only get 2 transactions, one buy, and one sell. It is normalized, so it could be Sell, Sell, Buy, Buy, Sell, but you'll only get Buy, Sell. But looking at the chart, it seems to be acting according to the logic in the strategy. MACD > Signal and MACD < 0 results in a Buy Their logic may be different. For a long time, I didn't have the MACD < 0 and MACD > 0 checks, and it was generating more transactions but those were unnecessary, so had to add this change. Certainly we can define a new strategy without that check also if that helps. Currently the library is assuming days as the time unit for the periods. However, it should work for other time units also with some tweaking. Can you give an example? I am also curious how we can enable that. |
# Describe Request Alpaca Markets Repository added. Fixed #167 # Change Type New feature.
Is your feature request related to a problem? Please describe.
Marketdata from other vendors would be awesome, especially alpaca.markets
Describe the solution you'd like
Marketdata Integration by using the official alpaca.markets api: https://github.com/alpacahq/alpaca-trade-api-go
The text was updated successfully, but these errors were encountered: