-
-
Save samchaaa/ca5b4756be36f610cb7814f8cb48dcf0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_data(symbol, start, end): | |
results = pd.DataFrame() | |
while True: | |
if start < end: | |
# 15m bars | |
d = api.polygon.historic_agg_v2(symbol, 15, 'minute', _from=start, to=end, unadjusted=False, limit=None).df | |
time.sleep(.2) | |
start = d.index[-1].strftime('%Y-%m-%d') | |
results = pd.concat([results, d], axis=0) | |
else: | |
break | |
results.drop_duplicates(inplace=True) | |
return results |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment