Skip to content

Commit

Permalink
upload bottle example
Browse files Browse the repository at this point in the history
  • Loading branch information
victorgau committed Apr 15, 2017
1 parent aef0044 commit e7f1968
Show file tree
Hide file tree
Showing 3 changed files with 946 additions and 0 deletions.
18 changes: 18 additions & 0 deletions 03_python_web/bottle_examples/techanjs/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import pandas as pd
import pandas_datareader.data as web
from datetime import datetime
from bottle import route, run, template, get, static_file

# Static Routes
@get("/static/<filepath:re:.*\.csv>")
def csv(filepath):
return static_file(filepath, root="static")

@route('/')
def index():
df=web.DataReader("^DJI", 'yahoo', datetime(2016,1,1))
df.sort_index(ascending=False)
df[['Open','High','Low','Close','Volume']].to_csv("static/data.csv", date_format="%d-%b-%y")
return template('index', name="Dow Jones Index")

run(host='localhost', port='9999')
Loading

0 comments on commit e7f1968

Please sign in to comment.