Created
January 10, 2018 12:55
-
-
Save otbbdeploy/060e9f26602498c95e14650883b2fa60 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
for p in test_periods: | |
# Print our progress | |
print('Running test period ' + str(p)); | |
# Create the condition | |
condition = 'price change percentage(1) < ' + str(p) | |
# Form the request | |
request_data = {'symbol':symbol,'condition_id':1,'condition':condition,"periods":periods,'from':usingdatafrom,'to':usingdatato} | |
# Send the request | |
analytic = requests.post('https://api.gatsiva.com/api/v1/conditions/return_profile',json=request_data,headers=my_headers) | |
# Pull out the results and format it into a pandas data frame | |
results = analytic.json()['results'] | |
df = pd.read_json(json.dumps(results), orient='records') | |
# Add the mean and number of observations to our list | |
data_run_list.append(df['mean']) | |
obs_num_list.append(results[0]['n']) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment