Skip to content

Instantly share code, notes, and snippets.

@mlivingston40
Last active November 21, 2017 23:12
Show Gist options
  • Save mlivingston40/7f32e236a5428ca705722fc500e58a2b to your computer and use it in GitHub Desktop.
Save mlivingston40/7f32e236a5428ca705722fc500e58a2b to your computer and use it in GitHub Desktop.
flash flask routing
@application.route('/correlation/result/<security1>/<security2>/<start_date>/<end_date>')
def correlation_result(security1,security2,start_date,end_date):
try:
c = Correlation(security1, security2, start_date, end_date)
except:
if start_date > end_date:
flash("Start Date can't be greater than End Date and min window is 7 days")
return redirect(url_for('correlation'))
else:
flash("Please be sure to select both ticker inputs from the autocomplete first and then select dates")
return redirect(url_for('correlation'))
### Code continues if no errors ###
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment