Skip to content

Instantly share code, notes, and snippets.

@otbbdeploy
Created January 10, 2018 12:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save otbbdeploy/060e9f26602498c95e14650883b2fa60 to your computer and use it in GitHub Desktop.
Save otbbdeploy/060e9f26602498c95e14650883b2fa60 to your computer and use it in GitHub Desktop.
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