Skip to content

Commit f7a938a

Browse files
committed
Added 8th Project
1 parent e034c35 commit f7a938a

File tree

9 files changed

+213
-0
lines changed

9 files changed

+213
-0
lines changed

Project-8 CandleStickPlotting/plot.py

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
from flask import Flask ,render_template
2+
3+
app=Flask(__name__)
4+
@app.route('/plot/')
5+
def plot():
6+
import pandas as pd
7+
pd.core.common.is_list_like = pd.api.types.is_list_like
8+
from pandas_datareader import data
9+
import datetime
10+
import fix_yahoo_finance as yf
11+
yf.pdr_override()
12+
from bokeh.plotting import figure, show, output_file
13+
from bokeh.embed import components
14+
from bokeh.resources import CDN
15+
16+
start=datetime.datetime(2015,11,1)
17+
end=datetime.datetime(2016,3,10)
18+
19+
df=data.get_data_yahoo(tickers="GOOG", start=start, end=end)
20+
21+
22+
def inc_dec(c, o):
23+
if c > o:
24+
value="Increase"
25+
elif c < o:
26+
value="Decrease"
27+
else:
28+
value="Equal"
29+
return value
30+
31+
df["Status"]=[inc_dec(c,o) for c, o in zip(df.Close,df.Open)]
32+
df["Middle"]=(df.Open+df.Close)/2
33+
df["Height"]=abs(df.Close-df.Open)
34+
35+
p=figure(x_axis_type='datetime', width=1000, height=300)
36+
p.title.text="Candlestick Chart"
37+
p.grid.grid_line_alpha=0.3
38+
39+
hours_12=12*60*60*1000
40+
41+
p.segment(df.index, df.High, df.index, df.Low, color="Black")
42+
43+
p.rect(df.index[df.Status=="Increase"],df.Middle[df.Status=="Increase"],
44+
hours_12, df.Height[df.Status=="Increase"],fill_color="#CCFFFF",line_color="black")
45+
46+
p.rect(df.index[df.Status=="Decrease"],df.Middle[df.Status=="Decrease"],
47+
hours_12, df.Height[df.Status=="Decrease"],fill_color="#FF3333",line_color="black")
48+
49+
script1, div1 = components(p)
50+
cdn_js=CDN.js_files[0]
51+
cdn_css=CDN.css_files[0]
52+
return render_template("plot.html",
53+
script1=script1,
54+
div1=div1,
55+
cdn_css=cdn_css,
56+
cdn_js=cdn_js )
57+
@app.route('/')
58+
def home():
59+
return render_template("homepage.html")
60+
61+
@app.route('/about/')
62+
def about():
63+
return render_template("about.html")
64+
if __name__=="__main__":
65+
print(__name__)
66+
app.run(debug=True)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
body {
2+
margin: 0;
3+
padding: 0;
4+
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
5+
color: #060;
6+
}
7+
8+
/*
9+
* Formatting the header area
10+
*/
11+
12+
header {
13+
background-color: #DFB887;
14+
height: 35px;
15+
width: 100%;
16+
opacity: .9;
17+
margin-bottom: 10px;
18+
}
19+
20+
header h1.logo {
21+
margin: 0;
22+
font-size: 1.7em;
23+
color: #fff;
24+
text-transform: uppercase;
25+
float: left;
26+
}
27+
28+
header h1.logo:hover {
29+
color: #fff;
30+
text-decoration: none;
31+
}
32+
33+
/*
34+
* Center the body content
35+
*/
36+
37+
.container {
38+
width: 1200px;
39+
margin: 0 auto;
40+
}
41+
42+
div.homepage {
43+
padding: 10px 0 30px 0;
44+
background-color: #E6E6FA;
45+
-webkit-border-radius: 6px;
46+
-moz-border-radius: 6px;
47+
border-radius: 6px;
48+
}
49+
50+
div.about {
51+
padding: 10px 0 30px 0;
52+
background-color: #E6E6FA;
53+
-webkit-border-radius: 6px;
54+
-moz-border-radius: 6px;
55+
border-radius: 6px;
56+
}
57+
58+
h2 {
59+
font-size: 3em;
60+
margin-top: 40px;
61+
text-align: center;
62+
letter-spacing: -2px;
63+
}
64+
65+
h3 {
66+
font-size: 1.7em;
67+
font-weight: 100;
68+
margin-top: 30px;
69+
text-align: center;
70+
letter-spacing: -1px;
71+
color: #999;
72+
}
73+
74+
.menu {
75+
float: right;
76+
margin-top: 8px;
77+
}
78+
79+
.menu li {
80+
display: inline;
81+
}
82+
83+
.menu li + li {
84+
margin-left: 35px;
85+
}
86+
87+
.menu li a {
88+
color: #444;
89+
text-decoration: none;
90+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{%extends "layout.html"%}
2+
{%block content%}
3+
<div class="about">
4+
<h1>About Page</h1>
5+
<p>I know JSP as well..</p>
6+
</div>
7+
{%endblock%}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{%extends "layout.html"%}
2+
{%block content%}
3+
<div class="homepage">
4+
<h1>Home Page</h1>
5+
<p>This is my First Try in Python</p>
6+
</div>
7+
{%endblock%}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Flask Application</title>
5+
<link rel="stylesheet" href="{{url_for('static',filename='css/main.css')}}">
6+
</head>
7+
<body>
8+
<header>
9+
<div class="container">
10+
<h1 class="logo">saharsh Web Page</h1>
11+
<strong><nav>
12+
<ul class="menu">
13+
<li><a href="{{url_for("home")}}">Home</a></li>
14+
<li><a href="{{url_for("about")}}">About</a></li>
15+
<li><a href="{{url_for("plot")}}">Plot</a></li>
16+
</ul>
17+
</nav></strong>
18+
</div>
19+
</header>
20+
<div class="container">
21+
{%block content%}
22+
{%endblock%}
23+
</div>
24+
</body>
25+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{%extends "layout.html"%}
2+
{%block content%}
3+
<link rel="stylesheet" href={{cdn_css | safe}} type="text/css" />
4+
<script type="text/javascript" src={{cdn_js | safe}}></script>
5+
6+
<div class="about">
7+
<h1>My about page</h1>
8+
<p>This is a test website again</p>
9+
</div>
10+
{{script1 | safe}}
11+
{{div1 | safe}}
12+
{%endblock%}

Project1-Dictionary/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Dictionary
2+
with the help of csv taken from Kaggle i made this,which consists of 20 lakh words.

Project2-Maps/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Maps
2+
Used Folium Library to draw map of the given Data
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Web-Camera-Motion-Detector
2+
Detects any object that comes in camera region by comparing to initial Frame and showing rectangle boxes over new objects. There is a plotting.py that plots graph in HTML for a initial and final time of objects

0 commit comments

Comments
 (0)