Closed riodda closed 3 years ago
Actually the solution was quite easy, but it might worth to add it into the readme
export POLYGON_KEY_ID=<your polygon key>
Hey! Sorry for the late reply, just wanted to drop a few things in. The first is that Alpaca's keys could be used to gain access to polygon services so I didn't bother implementing it, the other is that they're dropping service for Polygon on February 26. At that point I will be changing everything that used Polygon to Alpaca's new data endpoint.
I've tryed paper trading keys and Polygon did not liked them so i need to add a new env variable for that but it worked. I think is a good idea to use alpaca for data collection as there is no request/minute limit also for paper trading. I have a quick and dirty function for alpaca and i'm happy to share with you is needed to overcome the 1000limit on the alpaca requests, here below is for the 15min but change for the 1min is quite straightforward
def alpaca_get_15Min_bars(_symbol,_number):
_df=pd.DataFrame()
_temp=pd.DataFrame()
if _number<1000:
_df = api.get_barset(_symbol, '15Min', limit=_number, start=None, end=None, after=None, until=None).df
else:
_num_cycles, _residual = divmod(_number, 1000)
if _residual == 0:
_df = api.get_barset(_symbol, '15Min', limit=1000, start=None, end=None, after=None, until=None).df
_num_cycles -=1
else:
_df = api.get_barset(_symbol, '15Min', limit=_residual, start=None, end=None, after=None, until=None).df
for i in range(1,_num_cycles+1):
_temp = api.get_barset(_symbol, '15Min', limit=1000, start=None, end=None, after=None, until=_df.first_valid_index().isoformat()).df
_df= pd.concat([_temp,_df,])
return _df
Wold be really cool to create a standard data/command structure to be able to use all the code for other trading platforms such FXCM for europe o binance for crypto. I'm not a great coder but i'm happy to give an hand if is within my coding skills.
export POLYGON_KEY_ID=
Any Update on this ?
Hey, I mostly deprecated this project after Polygon dropped support for Alpaca, it will still work as long as this environment key is added and you sign up for a Polygon API key. The code would also only require minimal changes to work with the "new" Market Data API. If you want to make the change, feel free and create a PR and I will take a look.
I've tryed paper trading keys and Polygon did not liked them so i need to add a new env variable for that but it worked. I think is a good idea to use alpaca for data collection as there is no request/minute limit also for paper trading. I have a quick and dirty function for alpaca and i'm happy to share with you is needed to overcome the 1000limit on the alpaca requests, here below is for the 15min but change for the 1min is quite straightforward
def alpaca_get_15Min_bars(_symbol,_number): _df=pd.DataFrame() _temp=pd.DataFrame() if _number<1000: _df = api.get_barset(_symbol, '15Min', limit=_number, start=None, end=None, after=None, until=None).df else: _num_cycles, _residual = divmod(_number, 1000) if _residual == 0: _df = api.get_barset(_symbol, '15Min', limit=1000, start=None, end=None, after=None, until=None).df _num_cycles -=1 else: _df = api.get_barset(_symbol, '15Min', limit=_residual, start=None, end=None, after=None, until=None).df for i in range(1,_num_cycles+1): _temp = api.get_barset(_symbol, '15Min', limit=1000, start=None, end=None, after=None, until=_df.first_valid_index().isoformat()).df _df= pd.concat([_temp,_df,]) return _df
Wold be really cool to create a standard data/command structure to be able to use all the code for other trading platforms such FXCM for europe o binance for crypto. I'm not a great coder but i'm happy to give an hand if is within my coding skills.
I'm not sure why I never responded to this. I'm definitely down to continue letting the community maintain this repo and turn it into something better than it is right now. If you need help just ask away but I'm not sure I'll be doing too much coding on this project currently.
I think that the api key for polygon is not working anymore, shouldn't be included in the export variables so is possible to use personal api keys ? Or i miss something ?