"Final changes"
This commit is contained in:
parent
9ff7a4be37
commit
a85327e94e
8
.idea/.gitignore
vendored
Normal file
8
.idea/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
36
.idea/FinTech_app.iml
Normal file
36
.idea/FinTech_app.iml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="PYTHON_MODULE" version="4">
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="django" name="Django">
|
||||||
|
<configuration>
|
||||||
|
<option name="rootFolder" value="$MODULE_DIR$" />
|
||||||
|
<option name="settingsModule" value="FinTech_app/settings.py" />
|
||||||
|
<option name="manageScript" value="$MODULE_DIR$/manage.py" />
|
||||||
|
<option name="environment" value="<map/>" />
|
||||||
|
<option name="doNotUseTestRunner" value="false" />
|
||||||
|
<option name="trackFilePattern" value="migrations" />
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/.idea/dataSources" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" name="bootstrap" level="application" />
|
||||||
|
<orderEntry type="library" name="jquery-3.4.1.slim" level="application" />
|
||||||
|
<orderEntry type="library" name="popper.js" level="application" />
|
||||||
|
<orderEntry type="library" name="jquery-3.2.1.slim" level="application" />
|
||||||
|
<orderEntry type="library" name="chart.js" level="application" />
|
||||||
|
</component>
|
||||||
|
<component name="TemplatesService">
|
||||||
|
<option name="TEMPLATE_CONFIGURATION" value="Django" />
|
||||||
|
<option name="TEMPLATE_FOLDERS">
|
||||||
|
<list>
|
||||||
|
<option value="$MODULE_DIR$/../FinTech_app\templates" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</module>
|
21
.idea/dataSources.xml
Normal file
21
.idea/dataSources.xml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||||
|
<data-source source="LOCAL" name="db" uuid="683f61cd-d3b1-4d1e-bd0b-7b859cacda56">
|
||||||
|
<driver-ref>sqlite.xerial</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:sqlite:J:\Desktop\FinTech_app\db.sqlite3</jdbc-url>
|
||||||
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
|
</data-source>
|
||||||
|
<data-source source="LOCAL" name="Django default" uuid="a50cdda5-8fe8-4a03-a372-70599e0e6924">
|
||||||
|
<driver-ref>sqlite.xerial</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<imported>true</imported>
|
||||||
|
<remarks>$PROJECT_DIR$/FinTech_app/settings.py</remarks>
|
||||||
|
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:sqlite:J:\Desktop\FinTech_app\db.sqlite3</jdbc-url>
|
||||||
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
|
</data-source>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
.idea/inspectionProfiles/profiles_settings.xml
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<settings>
|
||||||
|
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||||
|
<version value="1.0" />
|
||||||
|
</settings>
|
||||||
|
</component>
|
6
.idea/jsLibraryMappings.xml
Normal file
6
.idea/jsLibraryMappings.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="JavaScriptLibraryMappings">
|
||||||
|
<file url="file://$PROJECT_DIR$" libraries="{bootstrap, chart.js, jquery-3.2.1.slim, jquery-3.4.1.slim, popper.js}" />
|
||||||
|
</component>
|
||||||
|
</project>
|
4
.idea/misc.xml
Normal file
4
.idea/misc.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (FinTech_app)" project-jdk-type="Python SDK" />
|
||||||
|
</project>
|
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/FinTech_app.iml" filepath="$PROJECT_DIR$/.idea/FinTech_app.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
BIN
FinTech_app/Akcje.pdf
Normal file
BIN
FinTech_app/Akcje.pdf
Normal file
Binary file not shown.
BIN
FinTech_app/Czym jest portfel inwestycyjny.pdf
Normal file
BIN
FinTech_app/Czym jest portfel inwestycyjny.pdf
Normal file
Binary file not shown.
BIN
FinTech_app/RYNKI.pdf
Normal file
BIN
FinTech_app/RYNKI.pdf
Normal file
Binary file not shown.
@ -9,7 +9,7 @@ https://docs.djangoproject.com/en/4.1/topics/settings/
|
|||||||
For the full list of settings and their values, see
|
For the full list of settings and their values, see
|
||||||
https://docs.djangoproject.com/en/4.1/ref/settings/
|
https://docs.djangoproject.com/en/4.1/ref/settings/
|
||||||
"""
|
"""
|
||||||
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
@ -38,7 +38,9 @@ INSTALLED_APPS = [
|
|||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'bootstrap4',
|
'bootstrap4',
|
||||||
'crispy_forms'
|
'crispy_forms',
|
||||||
|
'charts',
|
||||||
|
'matplotlib'
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -130,3 +132,7 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
|||||||
|
|
||||||
LOGIN_REDIRECT_URL = "/"
|
LOGIN_REDIRECT_URL = "/"
|
||||||
LOGOUT_REDIRECT_URL = "/"
|
LOGOUT_REDIRECT_URL = "/"
|
||||||
|
|
||||||
|
STATICFILES_DIRS = [
|
||||||
|
os.path.join(BASE_DIR, 'static')
|
||||||
|
]
|
||||||
|
@ -16,8 +16,10 @@ Including another URLconf
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import path, include
|
from django.urls import path, include
|
||||||
from django.views.generic.base import TemplateView
|
from django.views.generic.base import TemplateView
|
||||||
|
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
path('', TemplateView.as_view(template_name='main.html'), name='home'),
|
path('', TemplateView.as_view(template_name='main.html'), name='home'),
|
||||||
@ -25,4 +27,11 @@ urlpatterns = [
|
|||||||
path("login/", views.login_request, name="login"),
|
path("login/", views.login_request, name="login"),
|
||||||
path("logout/", views.logout_request, name="logout"),
|
path("logout/", views.logout_request, name="logout"),
|
||||||
path("main/", views.logout_request, name="main"),
|
path("main/", views.logout_request, name="main"),
|
||||||
|
path('chart/', include('charts.urls')),
|
||||||
|
path('view-pdf1/', views.pdf_view1, name='pdf_view1'),
|
||||||
|
path('view-pdf-rynki/', views.pdf_view_rynki, name='pdf_view_rynki'),
|
||||||
|
path('view-pdf-akcje/', views.pdf_view_akcje, name='pdf_view_akcje'),
|
||||||
|
path('plot/', views.plot, name='plot'),
|
||||||
|
path('wigplot/', views.plot_view, name='plot_view'),
|
||||||
|
path('oblplot/', views.ob_plot_view, name='ob_plot_view'),
|
||||||
]
|
]
|
||||||
|
@ -1,9 +1,21 @@
|
|||||||
|
from django.http import HttpResponse
|
||||||
from django.shortcuts import render, redirect
|
from django.shortcuts import render, redirect
|
||||||
from .forms import NewUserForm
|
from .forms import NewUserForm
|
||||||
from django.contrib.auth import login, authenticate, logout
|
from django.contrib.auth import login, authenticate, logout
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth.forms import AuthenticationForm
|
from django.contrib.auth.forms import AuthenticationForm
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import numpy as np
|
||||||
|
from matplotlib.backends.backend_agg import FigureCanvasAgg
|
||||||
|
import pandas as pd
|
||||||
|
from sklearn.linear_model import LinearRegression
|
||||||
|
from io import BytesIO
|
||||||
|
import base64
|
||||||
|
from datetime import datetime
|
||||||
|
from sklearn.preprocessing import PolynomialFeatures
|
||||||
|
from sklearn.linear_model import LinearRegression
|
||||||
|
from sklearn.metrics import mean_squared_error, r2_score
|
||||||
|
from sklearn.model_selection import train_test_split
|
||||||
|
|
||||||
def register_request(request):
|
def register_request(request):
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
@ -43,8 +55,108 @@ def logout_request(request):
|
|||||||
return redirect("/")
|
return redirect("/")
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
def pdf_view1(request):
|
||||||
if request.user.is_authenticated:
|
with open('FinTech_app/Czym jest portfel inwestycyjny.pdf', 'rb') as pdf:
|
||||||
print("Logged in")
|
response = HttpResponse(pdf.read(), content_type='application/pdf')
|
||||||
else:
|
response['Content-Disposition'] = 'inline;filename=mypdf.pdf'
|
||||||
print("Not logged in")
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
def pdf_view_rynki(request):
|
||||||
|
with open('FinTech_app/RYNKI.pdf', 'rb') as pdf:
|
||||||
|
response = HttpResponse(pdf.read(), content_type='application/pdf')
|
||||||
|
response['Content-Disposition'] = 'inline;filename=mypdf.pdf'
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
def pdf_view_akcje(request):
|
||||||
|
with open('FinTech_app/Akcje.pdf', 'rb') as pdf:
|
||||||
|
response = HttpResponse(pdf.read(), content_type='application/pdf')
|
||||||
|
response['Content-Disposition'] = 'inline;filename=mypdf.pdf'
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
def plot(request):
|
||||||
|
# Data for plotting
|
||||||
|
t = np.arange(0.0, 2.0, 0.01)
|
||||||
|
s = 1 + np.sin(2 * np.pi * t)
|
||||||
|
|
||||||
|
fig, ax = plt.subplots()
|
||||||
|
ax.plot(t, s)
|
||||||
|
|
||||||
|
ax.set(xlabel='czas', ylabel='kurs',
|
||||||
|
title='Przewidywany kurs dla ...')
|
||||||
|
ax.grid()
|
||||||
|
|
||||||
|
response = HttpResponse(content_type = 'image/png')
|
||||||
|
canvas = FigureCanvasAgg(fig)
|
||||||
|
canvas.print_png(response)
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
def my_view(request):
|
||||||
|
fig, ax = plt.subplots()
|
||||||
|
ax.plot([1, 2, 3, 4])
|
||||||
|
return render(request, 'my_template.html', {'fig': fig})
|
||||||
|
|
||||||
|
|
||||||
|
def plot_view(request):
|
||||||
|
data = pd.read_csv("charts/static/akcjeWIG40.csv")
|
||||||
|
months = data['Data']
|
||||||
|
prices = data['Otwarcie']
|
||||||
|
months = np.array(months).reshape(-1, 1)
|
||||||
|
poly_feat = PolynomialFeatures(degree=2)
|
||||||
|
months_poly = poly_feat.fit_transform(months)
|
||||||
|
model = LinearRegression()
|
||||||
|
model.fit(months_poly, prices)
|
||||||
|
future_months = np.array([12, 13, 14, 15, 16, 17, 18]).reshape(-1, 1)
|
||||||
|
future_months_poly = poly_feat.fit_transform(future_months)
|
||||||
|
predictions = model.predict(future_months_poly)
|
||||||
|
plt.plot(months, prices, color='cyan')
|
||||||
|
plt.plot(future_months, predictions, color='pink')
|
||||||
|
plt.title('Wykres cen dla następnych 6 miesięcy dla akcji 40 najwięszych spółek WIG40')
|
||||||
|
plt.xlabel('Miesiące')
|
||||||
|
plt.ylabel('Cena')
|
||||||
|
plt.xticks(range(1, 19))
|
||||||
|
plt.grid()
|
||||||
|
|
||||||
|
#save the figure to a buffer
|
||||||
|
buf = BytesIO()
|
||||||
|
plt.savefig(buf, format='png')
|
||||||
|
buf.seek(0)
|
||||||
|
string = base64.b64encode(buf.read()).decode()
|
||||||
|
uri = 'data:image/png;base64,' + string
|
||||||
|
context = { 'uri': uri }
|
||||||
|
plt.clf()
|
||||||
|
return render(request, 'wigplot.html', context)
|
||||||
|
|
||||||
|
|
||||||
|
def ob_plot_view(request):
|
||||||
|
data = pd.read_csv("charts/static/obligacjePL.csv")
|
||||||
|
months = data['Data']
|
||||||
|
prices = data['Otwarcie']
|
||||||
|
months = np.array(months).reshape(-1, 1)
|
||||||
|
poly_feat = PolynomialFeatures(degree=2)
|
||||||
|
months_poly = poly_feat.fit_transform(months)
|
||||||
|
model = LinearRegression()
|
||||||
|
model.fit(months_poly, prices)
|
||||||
|
future_months = np.array([12, 13, 14, 15, 16, 17, 18]).reshape(-1, 1)
|
||||||
|
future_months_poly = poly_feat.fit_transform(future_months)
|
||||||
|
predictions = model.predict(future_months_poly)
|
||||||
|
plt.plot(months, prices, color='cyan')
|
||||||
|
plt.plot(future_months, predictions, color='pink')
|
||||||
|
plt.title('Wykres cen dla następnych 6 miesięcy dla obligacji PL')
|
||||||
|
plt.xlabel('Miesiące')
|
||||||
|
plt.ylabel('Cena')
|
||||||
|
plt.xticks(range(1, 19))
|
||||||
|
plt.grid()
|
||||||
|
|
||||||
|
#save the figure to a buffer
|
||||||
|
buf = BytesIO()
|
||||||
|
plt.savefig(buf, format='png')
|
||||||
|
buf.seek(0)
|
||||||
|
string = base64.b64encode(buf.read()).decode()
|
||||||
|
uri = 'data:image/png;base64,' + string
|
||||||
|
context = { 'uri': uri }
|
||||||
|
plt.clf()
|
||||||
|
return render(request, 'obligacjePLplot.html', context)
|
0
charts/__init__.py
Normal file
0
charts/__init__.py
Normal file
3
charts/admin.py
Normal file
3
charts/admin.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
48
charts/algorithm.py
Normal file
48
charts/algorithm.py
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
import csv
|
||||||
|
import numpy as np
|
||||||
|
from sklearn.svm import SVR
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
dates = []
|
||||||
|
prices = []
|
||||||
|
|
||||||
|
|
||||||
|
def get_data(filename):
|
||||||
|
with open(filename, 'r') as csvfile:
|
||||||
|
csvFileReader = csv.reader(csvfile)
|
||||||
|
next(csvFileReader)
|
||||||
|
for row in csvFileReader:
|
||||||
|
dates.append(int(row[0].split('-')[1]))
|
||||||
|
prices.append(float(row[1]))
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def predict_prices(dates, prices, x):
|
||||||
|
dates = np.reshape(dates, (len(dates), 1))
|
||||||
|
|
||||||
|
svr_lin = SVR(kernel='linear', C=1e3)
|
||||||
|
svr_poly = SVR(kernel='poly', C=1e3, degree = 2)
|
||||||
|
svr_rbf = SVR(kernel='rbf', C=1e3, gamma=0.1)
|
||||||
|
svr_lin.fit(dates, prices)
|
||||||
|
svr_poly.fit(dates, prices)
|
||||||
|
svr_rbf.fit(dates, prices)
|
||||||
|
|
||||||
|
plt.scatter(dates, prices, color='black', label='Data')
|
||||||
|
plt.plot(dates, svr_lin.predict(dates), color='green', label='linear model')
|
||||||
|
plt.plot(dates, svr_poly.predict(dates), color='blue', label='Polynomial model')
|
||||||
|
plt.plot(dates, svr_rbf.predict(dates), color='red', label='RBF model')
|
||||||
|
plt.xlabel('Date')
|
||||||
|
plt.ylabel('Price')
|
||||||
|
plt.title('Support Vector Regression')
|
||||||
|
plt.legend()
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
return svr_lin.predict(x)[0], svr_poly.predict(x)[0], svr_rbf.predict(x)[0]
|
||||||
|
|
||||||
|
|
||||||
|
get_data('static/akcjeWIG40.csv')
|
||||||
|
print(dates)
|
||||||
|
print(prices)
|
||||||
|
predicted_price = predict_prices(dates, prices, 29)
|
||||||
|
|
||||||
|
print(predicted_price)
|
56
charts/algorithm_2.py
Normal file
56
charts/algorithm_2.py
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
import numpy as np
|
||||||
|
from sklearn.svm import SVR
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
|
||||||
|
X = np.sort(5 * np.random.rand(40, 1), axis=0)
|
||||||
|
y = np.sin(X).ravel()
|
||||||
|
|
||||||
|
# add noise to targets
|
||||||
|
y[::5] += 3 * (0.5 - np.random.rand(8))
|
||||||
|
svr_rbf = SVR(kernel="rbf", C=100, gamma=0.1, epsilon=0.1)
|
||||||
|
svr_lin = SVR(kernel="linear", C=100, gamma="auto")
|
||||||
|
svr_poly = SVR(kernel="poly", C=100, gamma="auto", degree=3, epsilon=0.1, coef0=1)
|
||||||
|
lw = 2
|
||||||
|
|
||||||
|
svrs = [svr_rbf, svr_lin, svr_poly]
|
||||||
|
kernel_label = ["RBF", "Linear", "Polynomial"]
|
||||||
|
model_color = ["m", "c", "g"]
|
||||||
|
|
||||||
|
fig, axes = plt.subplots(nrows=1, ncols=3, figsize=(15, 10), sharey=True)
|
||||||
|
for ix, svr in enumerate(svrs):
|
||||||
|
axes[ix].plot(
|
||||||
|
X,
|
||||||
|
svr.fit(X, y).predict(X),
|
||||||
|
color=model_color[ix],
|
||||||
|
lw=lw,
|
||||||
|
label="{} model".format(kernel_label[ix]),
|
||||||
|
)
|
||||||
|
axes[ix].scatter(
|
||||||
|
X[svr.support_],
|
||||||
|
y[svr.support_],
|
||||||
|
facecolor="none",
|
||||||
|
edgecolor=model_color[ix],
|
||||||
|
s=50,
|
||||||
|
label="{} support vectors".format(kernel_label[ix]),
|
||||||
|
)
|
||||||
|
axes[ix].scatter(
|
||||||
|
X[np.setdiff1d(np.arange(len(X)), svr.support_)],
|
||||||
|
y[np.setdiff1d(np.arange(len(X)), svr.support_)],
|
||||||
|
facecolor="none",
|
||||||
|
edgecolor="k",
|
||||||
|
s=50,
|
||||||
|
label="other training data",
|
||||||
|
)
|
||||||
|
axes[ix].legend(
|
||||||
|
loc="upper center",
|
||||||
|
bbox_to_anchor=(0.5, 1.1),
|
||||||
|
ncol=1,
|
||||||
|
fancybox=True,
|
||||||
|
shadow=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
fig.text(0.5, 0.04, "data", ha="center", va="center")
|
||||||
|
fig.text(0.06, 0.5, "target", ha="center", va="center", rotation="vertical")
|
||||||
|
fig.suptitle("Support Vector Regression", fontsize=14)
|
||||||
|
plt.show()
|
57
charts/algorithm_3.py
Normal file
57
charts/algorithm_3.py
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
import pandas as pd
|
||||||
|
import numpy as np
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
from matplotlib.pylab import rcParams
|
||||||
|
from keras.models import Sequential
|
||||||
|
from keras.layers import LSTM, Dropout, Dense
|
||||||
|
from sklearn.preprocessing import MinMaxScaler
|
||||||
|
|
||||||
|
df = pd.read_csv('static/HistoricalData_APL.csv')
|
||||||
|
df = df[['Date', 'Close/Last']]
|
||||||
|
df = df.replace({'\$': ''}, regex=True)
|
||||||
|
print(df.head())
|
||||||
|
df = df.astype({"Close/Last": float})
|
||||||
|
df["Date"] = pd.to_datetime(df.Date, format="%m/%d/%Y")
|
||||||
|
print(df.dtypes)
|
||||||
|
df.index = df['Date']
|
||||||
|
plt.plot(df["Close/Last"], label='AAPL Close Price history')
|
||||||
|
plt.show()
|
||||||
|
df = df.sort_index(ascending=True,axis=0)
|
||||||
|
data = pd.DataFrame(index=range(0,len(df)),columns=['Date','Close/Last'])
|
||||||
|
for i in range(0,len(data)):
|
||||||
|
data["Date"][i]=df['Date'][i]
|
||||||
|
data["Close/Last"][i]=df["Close/Last"][i]
|
||||||
|
scaler=MinMaxScaler(feature_range=(0,1))
|
||||||
|
data.index=data.Date
|
||||||
|
data.drop("Date",axis=1,inplace=True)
|
||||||
|
final_data = data.values
|
||||||
|
train_data=final_data[0:200,:]
|
||||||
|
valid_data=final_data[200:,:]
|
||||||
|
scaler=MinMaxScaler(feature_range=(0,1))
|
||||||
|
scaled_data=scaler.fit_transform(final_data)
|
||||||
|
x_train_data,y_train_data=[],[]
|
||||||
|
for i in range(60,len(train_data)):
|
||||||
|
x_train_data.append(scaled_data[i-60:i,0])
|
||||||
|
y_train_data.append(scaled_data[i,0])
|
||||||
|
lstm_model=Sequential()
|
||||||
|
lstm_model.add(LSTM(units=50,return_sequences=True,input_shape=(np.shape(x_train_data)[1],1)))
|
||||||
|
lstm_model.add(LSTM(units=50))
|
||||||
|
lstm_model.add(Dense(1))
|
||||||
|
model_data=data[len(data)-len(valid_data)-60:].values
|
||||||
|
model_data=model_data.reshape(-1,1)
|
||||||
|
model_data=scaler.transform(model_data)
|
||||||
|
lstm_model.compile(loss='mean_squared_error',optimizer='adam')
|
||||||
|
lstm_model.fit(x_train_data,y_train_data,epochs=1,batch_size=1,verbose=2)
|
||||||
|
X_test=[]
|
||||||
|
for i in range(60,model_data.shape[0]):
|
||||||
|
X_test.append(model_data[i-60:i,0])
|
||||||
|
X_test=np.array(X_test)
|
||||||
|
X_test=np.reshape(X_test,(X_test.shape[0],X_test.shape[1],1))
|
||||||
|
predicted_stock_price=lstm_model.predict(X_test)
|
||||||
|
predicted_stock_price=scaler.inverse_transform(predicted_stock_price)
|
||||||
|
train_data=data[:200]
|
||||||
|
valid_data=data[200:]
|
||||||
|
valid_data['Predictions']=predicted_stock_price
|
||||||
|
plt.plot(train_data["Close/Last"])
|
||||||
|
plt.plot(valid_data[['Close/Last',"Predictions"]])
|
||||||
|
plt.show()
|
63
charts/algorithm_4.py
Normal file
63
charts/algorithm_4.py
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
import pandas as pd
|
||||||
|
import numpy as np
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
from sklearn.preprocessing import PolynomialFeatures
|
||||||
|
from sklearn.linear_model import LinearRegression
|
||||||
|
from sklearn.metrics import mean_squared_error, r2_score
|
||||||
|
from sklearn.model_selection import train_test_split
|
||||||
|
|
||||||
|
# data = pd.read_csv("static/obligacjePL.csv")
|
||||||
|
#
|
||||||
|
# months = data['Data']
|
||||||
|
# prices = data['Otwarcie']
|
||||||
|
#
|
||||||
|
# months = np.array(months).reshape(-1, 1)
|
||||||
|
#
|
||||||
|
# model = LinearRegression()
|
||||||
|
# model.fit(months, prices)
|
||||||
|
#
|
||||||
|
# future_months = np.array([12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]).reshape(-1, 1)
|
||||||
|
# predictions = model.predict(future_months)
|
||||||
|
# plt.plot(months, prices, label='actual')
|
||||||
|
# plt.plot(future_months, predictions, label='prediction')
|
||||||
|
# plt.legend()
|
||||||
|
# plt.xlabel('Months')
|
||||||
|
# plt.ylabel('Prices')
|
||||||
|
# plt.title('Stock Prices Prediction')
|
||||||
|
# plt.grid()
|
||||||
|
# plt.show()
|
||||||
|
|
||||||
|
data = pd.read_csv("static/AAPL2.csv")
|
||||||
|
months = data['Date']
|
||||||
|
prices = data['Open']
|
||||||
|
months = np.array(months).reshape(-1, 1)
|
||||||
|
poly_feat = PolynomialFeatures(degree=2)
|
||||||
|
months_poly = poly_feat.fit_transform(months)
|
||||||
|
model = LinearRegression()
|
||||||
|
model.fit(months_poly, prices)
|
||||||
|
future_months = np.array([12, 13, 14, 15, 16, 17, 18]).reshape(-1, 1)
|
||||||
|
future_months_poly = poly_feat.fit_transform(future_months)
|
||||||
|
predictions = model.predict(future_months_poly)
|
||||||
|
plt.plot(months, prices, color='cyan')
|
||||||
|
plt.plot(future_months, predictions, color='pink')
|
||||||
|
plt.title('Polynomial Regression')
|
||||||
|
plt.xlabel('Months')
|
||||||
|
plt.ylabel('Prices')
|
||||||
|
plt.xticks(range(1, 18))
|
||||||
|
plt.show()
|
||||||
|
X_train, X_test, y_train, y_test = train_test_split(months_poly, prices, test_size=0.2, random_state=0)
|
||||||
|
|
||||||
|
# Fit the model to the training data
|
||||||
|
model = LinearRegression()
|
||||||
|
model.fit(X_train, y_train)
|
||||||
|
|
||||||
|
# Make predictions on the test data
|
||||||
|
y_pred = model.predict(X_test)
|
||||||
|
|
||||||
|
# Calculate the MSE and R-Squared
|
||||||
|
mse = mean_squared_error(y_test, y_pred)
|
||||||
|
r2 = r2_score(y_test, y_pred)
|
||||||
|
|
||||||
|
# Print the results
|
||||||
|
print("Mean Squared Error:", mse)
|
||||||
|
print("R-Squared:", r2)
|
6
charts/apps.py
Normal file
6
charts/apps.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class ChartsConfig(AppConfig):
|
||||||
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
name = 'charts'
|
0
charts/management/__init__.py
Normal file
0
charts/management/__init__.py
Normal file
0
charts/management/commands/__init__.py
Normal file
0
charts/management/commands/__init__.py
Normal file
38
charts/management/commands/import_stats.py
Normal file
38
charts/management/commands/import_stats.py
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import csv
|
||||||
|
|
||||||
|
from django.core.management.base import BaseCommand
|
||||||
|
from dateutil.parser import parse
|
||||||
|
|
||||||
|
from charts.models import BiteStat
|
||||||
|
|
||||||
|
|
||||||
|
class Command(BaseCommand):
|
||||||
|
help = 'Import bite exercise stats'
|
||||||
|
|
||||||
|
def add_arguments(self, parser):
|
||||||
|
parser.add_argument('-c', '--csv', required=True)
|
||||||
|
|
||||||
|
def handle(self, *args, **options):
|
||||||
|
file = options["csv"]
|
||||||
|
with open(file) as f:
|
||||||
|
reader = csv.DictReader(f)
|
||||||
|
for row in reader:
|
||||||
|
completed = row["first_completed"]
|
||||||
|
if not completed:
|
||||||
|
continue
|
||||||
|
|
||||||
|
level = row["user_level"]
|
||||||
|
if not level:
|
||||||
|
level = 0
|
||||||
|
|
||||||
|
date = parse(completed)
|
||||||
|
stat, created = BiteStat.objects.get_or_create(
|
||||||
|
exercise=row["bite_id"],
|
||||||
|
completed=date,
|
||||||
|
level=level,
|
||||||
|
)
|
||||||
|
|
||||||
|
if created:
|
||||||
|
self.stdout.write(f"{stat} created")
|
||||||
|
else:
|
||||||
|
self.stderr.write(f"{stat} already in db")
|
23
charts/migrations/0001_initial.py
Normal file
23
charts/migrations/0001_initial.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Generated by Django 4.1.3 on 2022-12-19 20:06
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='BiteStat',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('exercise', models.PositiveSmallIntegerField()),
|
||||||
|
('completed', models.DateField()),
|
||||||
|
('level', models.PositiveSmallIntegerField(blank=True, null=True)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
0
charts/migrations/__init__.py
Normal file
0
charts/migrations/__init__.py
Normal file
7
charts/models.py
Normal file
7
charts/models.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
from django.db import models
|
||||||
|
|
||||||
|
|
||||||
|
class BiteStat(models.Model):
|
||||||
|
exercise = models.PositiveSmallIntegerField() # 0 to 32767
|
||||||
|
completed = models.DateField() # I don't care about time here
|
||||||
|
level = models.PositiveSmallIntegerField(null=True, blank=True) # optional, not every Bite has user feedback
|
252
charts/static/AAPL.csv
Normal file
252
charts/static/AAPL.csv
Normal file
@ -0,0 +1,252 @@
|
|||||||
|
Date,Open,High,Low,Close,Adj Close,Volume
|
||||||
|
2022-01-03,177.830002,182.880005,177.710007,182.009995,180.959747,104487900
|
||||||
|
2022-01-04,182.630005,182.940002,179.119995,179.699997,178.663071,99310400
|
||||||
|
2022-01-05,179.610001,180.169998,174.639999,174.919998,173.910660,94537600
|
||||||
|
2022-01-06,172.699997,175.300003,171.639999,172.000000,171.007507,96904000
|
||||||
|
2022-01-07,172.889999,174.139999,171.029999,172.169998,171.176529,86709100
|
||||||
|
2022-01-10,169.080002,172.500000,168.169998,172.190002,171.196426,106765600
|
||||||
|
2022-01-11,172.320007,175.179993,170.820007,175.080002,174.069733,76138300
|
||||||
|
2022-01-12,176.119995,177.179993,174.820007,175.529999,174.517151,74805200
|
||||||
|
2022-01-13,175.779999,176.619995,171.789993,172.190002,171.196426,84505800
|
||||||
|
2022-01-14,171.339996,173.779999,171.089996,173.070007,172.071335,80440800
|
||||||
|
2022-01-18,171.509995,172.539993,169.410004,169.800003,168.820206,90956700
|
||||||
|
2022-01-19,170.000000,171.080002,165.940002,166.229996,165.270798,94815000
|
||||||
|
2022-01-20,166.979996,169.679993,164.179993,164.509995,163.560730,91420500
|
||||||
|
2022-01-21,164.419998,166.330002,162.300003,162.410004,161.472855,122848900
|
||||||
|
2022-01-24,160.020004,162.300003,154.699997,161.619995,160.687393,162294600
|
||||||
|
2022-01-25,158.979996,162.759995,157.020004,159.779999,158.858017,115798400
|
||||||
|
2022-01-26,163.500000,164.389999,157.820007,159.690002,158.768539,108275300
|
||||||
|
2022-01-27,162.449997,163.839996,158.279999,159.220001,158.301254,121954600
|
||||||
|
2022-01-28,165.710007,170.350006,162.800003,170.330002,169.347153,179935700
|
||||||
|
2022-01-31,170.160004,175.000000,169.509995,174.779999,173.771469,115541600
|
||||||
|
2022-02-01,174.009995,174.839996,172.309998,174.610001,173.602448,86213900
|
||||||
|
2022-02-02,174.750000,175.880005,173.330002,175.839996,174.825348,84914300
|
||||||
|
2022-02-03,174.479996,176.240005,172.119995,172.899994,171.902313,89418100
|
||||||
|
2022-02-04,171.679993,174.100006,170.679993,172.389999,171.613632,82465400
|
||||||
|
2022-02-07,172.860001,173.949997,170.949997,171.660004,170.886917,77251200
|
||||||
|
2022-02-08,171.729996,175.350006,171.429993,174.830002,174.042633,74829200
|
||||||
|
2022-02-09,176.050003,176.649994,174.899994,176.279999,175.486099,71285000
|
||||||
|
2022-02-10,174.139999,175.479996,171.550003,172.119995,171.344833,90865900
|
||||||
|
2022-02-11,172.330002,173.080002,168.039993,168.639999,167.880524,98670700
|
||||||
|
2022-02-14,167.369995,169.580002,166.559998,168.880005,168.119446,86185500
|
||||||
|
2022-02-15,170.970001,172.949997,170.250000,172.789993,172.011810,62527400
|
||||||
|
2022-02-16,171.850006,173.339996,170.050003,172.550003,171.772903,61177400
|
||||||
|
2022-02-17,171.029999,171.910004,168.470001,168.880005,168.119446,69589300
|
||||||
|
2022-02-18,169.820007,170.539993,166.190002,167.300003,166.546555,82772700
|
||||||
|
2022-02-22,164.979996,166.690002,162.149994,164.320007,163.579987,91162800
|
||||||
|
2022-02-23,165.539993,166.149994,159.750000,160.070007,159.349121,90009200
|
||||||
|
2022-02-24,152.580002,162.850006,152.000000,162.740005,162.007080,141147500
|
||||||
|
2022-02-25,163.839996,165.119995,160.869995,164.850006,164.107590,91974200
|
||||||
|
2022-02-28,163.059998,165.419998,162.429993,165.119995,164.376358,95056600
|
||||||
|
2022-03-01,164.699997,166.600006,161.970001,163.199997,162.465012,83474400
|
||||||
|
2022-03-02,164.389999,167.360001,162.949997,166.559998,165.809875,79724800
|
||||||
|
2022-03-03,168.470001,168.910004,165.550003,166.229996,165.481369,76678400
|
||||||
|
2022-03-04,164.490005,165.550003,162.100006,163.169998,162.435135,83737200
|
||||||
|
2022-03-07,163.360001,165.020004,159.039993,159.300003,158.582581,96418800
|
||||||
|
2022-03-08,158.820007,162.880005,155.800003,157.440002,156.730942,131148300
|
||||||
|
2022-03-09,161.479996,163.410004,159.410004,162.949997,162.216125,91454900
|
||||||
|
2022-03-10,160.199997,160.389999,155.979996,158.520004,157.806091,105342000
|
||||||
|
2022-03-11,158.929993,159.279999,154.500000,154.729996,154.033142,96970100
|
||||||
|
2022-03-14,151.449997,154.119995,150.100006,150.619995,149.941650,108732100
|
||||||
|
2022-03-15,150.899994,155.570007,150.380005,155.089996,154.391541,92964300
|
||||||
|
2022-03-16,157.050003,160.000000,154.460007,159.589996,158.871262,102300200
|
||||||
|
2022-03-17,158.610001,161.000000,157.630005,160.619995,159.896637,75615400
|
||||||
|
2022-03-18,160.509995,164.479996,159.759995,163.979996,163.241501,123511700
|
||||||
|
2022-03-21,163.509995,166.350006,163.009995,165.380005,164.635193,95811400
|
||||||
|
2022-03-22,165.509995,169.419998,164.910004,168.820007,168.059723,81532000
|
||||||
|
2022-03-23,167.990005,172.639999,167.649994,170.210007,169.443436,98062700
|
||||||
|
2022-03-24,171.059998,174.139999,170.210007,174.070007,173.286057,90131400
|
||||||
|
2022-03-25,173.880005,175.279999,172.750000,174.720001,173.933136,80546200
|
||||||
|
2022-03-28,172.169998,175.729996,172.000000,175.600006,174.809174,90371900
|
||||||
|
2022-03-29,176.690002,179.009995,176.339996,178.960007,178.154053,100589400
|
||||||
|
2022-03-30,178.550003,179.610001,176.699997,177.770004,176.969406,92633200
|
||||||
|
2022-03-31,177.839996,178.029999,174.399994,174.610001,173.823639,103049300
|
||||||
|
2022-04-01,174.029999,174.880005,171.940002,174.309998,173.524963,78751300
|
||||||
|
2022-04-04,174.570007,178.490005,174.440002,178.440002,177.636383,76468400
|
||||||
|
2022-04-05,177.500000,178.300003,174.419998,175.059998,174.271591,73401800
|
||||||
|
2022-04-06,172.360001,173.630005,170.130005,171.830002,171.056137,89058800
|
||||||
|
2022-04-07,171.160004,173.360001,169.850006,172.139999,171.364746,77594700
|
||||||
|
2022-04-08,171.779999,171.779999,169.199997,170.089996,169.323975,76575500
|
||||||
|
2022-04-11,168.710007,169.029999,165.500000,165.750000,165.003525,72246700
|
||||||
|
2022-04-12,168.020004,169.869995,166.639999,167.660004,166.904938,79265200
|
||||||
|
2022-04-13,167.389999,171.039993,166.770004,170.399994,169.632584,70618900
|
||||||
|
2022-04-14,170.619995,171.270004,165.039993,165.289993,164.545593,75329400
|
||||||
|
2022-04-18,163.919998,166.600006,163.570007,165.070007,164.326599,69023900
|
||||||
|
2022-04-19,165.020004,167.820007,163.910004,167.399994,166.646088,67723800
|
||||||
|
2022-04-20,168.759995,168.880005,166.100006,167.229996,166.476868,67929800
|
||||||
|
2022-04-21,168.910004,171.529999,165.910004,166.419998,165.670517,87227800
|
||||||
|
2022-04-22,166.460007,167.869995,161.500000,161.789993,161.061356,84882400
|
||||||
|
2022-04-25,161.119995,163.169998,158.460007,162.880005,162.146469,96046400
|
||||||
|
2022-04-26,162.250000,162.339996,156.720001,156.800003,156.093857,95623200
|
||||||
|
2022-04-27,155.910004,159.789993,155.380005,156.570007,155.864883,88063200
|
||||||
|
2022-04-28,159.250000,164.520004,158.929993,163.639999,162.903030,130216800
|
||||||
|
2022-04-29,161.839996,166.199997,157.250000,157.649994,156.939987,131747600
|
||||||
|
2022-05-02,156.710007,158.229996,153.270004,157.960007,157.248627,123055300
|
||||||
|
2022-05-03,158.149994,160.710007,156.320007,159.479996,158.761765,88966500
|
||||||
|
2022-05-04,159.669998,166.479996,159.259995,166.020004,165.272324,108256500
|
||||||
|
2022-05-05,163.850006,164.080002,154.949997,156.770004,156.063980,130525300
|
||||||
|
2022-05-06,156.009995,159.440002,154.179993,157.279999,156.801727,116124600
|
||||||
|
2022-05-09,154.929993,155.830002,151.490005,152.059998,151.597595,131577900
|
||||||
|
2022-05-10,155.520004,156.740005,152.929993,154.509995,154.040131,115366700
|
||||||
|
2022-05-11,153.500000,155.449997,145.809998,146.500000,146.054504,142689800
|
||||||
|
2022-05-12,142.770004,146.199997,138.800003,142.559998,142.126480,182602000
|
||||||
|
2022-05-13,144.589996,148.100006,143.110001,147.110001,146.662643,113990900
|
||||||
|
2022-05-16,145.550003,147.520004,144.179993,145.539993,145.097412,86643800
|
||||||
|
2022-05-17,148.860001,149.770004,146.679993,149.240005,148.786179,78336300
|
||||||
|
2022-05-18,146.850006,147.360001,139.899994,140.820007,140.391785,109742900
|
||||||
|
2022-05-19,139.880005,141.660004,136.600006,137.350006,136.932343,136095600
|
||||||
|
2022-05-20,139.089996,140.699997,132.610001,137.589996,137.171600,137426100
|
||||||
|
2022-05-23,137.789993,143.259995,137.649994,143.110001,142.674820,117726300
|
||||||
|
2022-05-24,140.809998,141.970001,137.330002,140.360001,139.933182,104132700
|
||||||
|
2022-05-25,138.429993,141.789993,138.339996,140.520004,140.092697,92482700
|
||||||
|
2022-05-26,137.389999,144.339996,137.139999,143.779999,143.342773,90601500
|
||||||
|
2022-05-27,145.389999,149.679993,145.259995,149.639999,149.184952,90978500
|
||||||
|
2022-05-31,149.070007,150.660004,146.839996,148.839996,148.387390,103718400
|
||||||
|
2022-06-01,149.899994,151.740005,147.679993,148.710007,148.257797,74286600
|
||||||
|
2022-06-02,147.830002,151.270004,146.860001,151.210007,150.750183,72348100
|
||||||
|
2022-06-03,146.899994,147.970001,144.460007,145.380005,144.937912,88570300
|
||||||
|
2022-06-06,147.029999,148.570007,144.899994,146.139999,145.695602,71598400
|
||||||
|
2022-06-07,144.350006,149.000000,144.100006,148.710007,148.257797,67808200
|
||||||
|
2022-06-08,148.580002,149.869995,147.460007,147.960007,147.510071,53950200
|
||||||
|
2022-06-09,147.080002,147.949997,142.529999,142.639999,142.206253,69473000
|
||||||
|
2022-06-10,140.279999,140.759995,137.059998,137.130005,136.713013,91437900
|
||||||
|
2022-06-13,132.869995,135.199997,131.440002,131.880005,131.478958,122207100
|
||||||
|
2022-06-14,133.130005,133.889999,131.479996,132.759995,132.356277,84784300
|
||||||
|
2022-06-15,134.289993,137.339996,132.160004,135.429993,135.018158,91533000
|
||||||
|
2022-06-16,132.080002,132.389999,129.039993,130.059998,129.664490,108123900
|
||||||
|
2022-06-17,130.070007,133.080002,129.809998,131.559998,131.159927,134520300
|
||||||
|
2022-06-21,133.419998,137.059998,133.320007,135.869995,135.456818,81000500
|
||||||
|
2022-06-22,134.789993,137.759995,133.910004,135.350006,134.938416,73409200
|
||||||
|
2022-06-23,136.820007,138.589996,135.630005,138.270004,137.849533,72433800
|
||||||
|
2022-06-24,139.899994,141.910004,139.770004,141.660004,141.229233,89116800
|
||||||
|
2022-06-27,142.699997,143.490005,140.970001,141.660004,141.229233,70207900
|
||||||
|
2022-06-28,142.130005,143.419998,137.320007,137.440002,137.022064,67083400
|
||||||
|
2022-06-29,137.460007,140.669998,136.669998,139.229996,138.806610,66242400
|
||||||
|
2022-06-30,137.250000,138.369995,133.770004,136.720001,136.304245,98964500
|
||||||
|
2022-07-01,136.039993,139.039993,135.660004,138.929993,138.507507,71051600
|
||||||
|
2022-07-05,137.770004,141.610001,136.929993,141.559998,141.129532,73353800
|
||||||
|
2022-07-06,141.350006,144.119995,141.080002,142.919998,142.485382,74064300
|
||||||
|
2022-07-07,143.289993,146.550003,143.279999,146.350006,145.904968,66253700
|
||||||
|
2022-07-08,145.259995,147.550003,145.000000,147.039993,146.592850,64547800
|
||||||
|
2022-07-11,145.669998,146.639999,143.779999,144.869995,144.429459,63141600
|
||||||
|
2022-07-12,145.759995,148.449997,145.050003,145.860001,145.416443,77588800
|
||||||
|
2022-07-13,142.990005,146.449997,142.119995,145.490005,145.047577,71185600
|
||||||
|
2022-07-14,144.080002,148.949997,143.250000,148.470001,148.018524,78140700
|
||||||
|
2022-07-15,149.779999,150.860001,148.199997,150.169998,149.713333,76259900
|
||||||
|
2022-07-18,150.740005,151.570007,146.699997,147.070007,146.622787,81420900
|
||||||
|
2022-07-19,147.919998,151.229996,146.910004,151.000000,150.540817,82982400
|
||||||
|
2022-07-20,151.119995,153.720001,150.369995,153.039993,152.574615,64823400
|
||||||
|
2022-07-21,154.500000,155.570007,151.940002,155.350006,154.877594,65086600
|
||||||
|
2022-07-22,155.389999,156.279999,153.410004,154.089996,153.621414,66675400
|
||||||
|
2022-07-25,154.009995,155.039993,152.279999,152.949997,152.484894,53623900
|
||||||
|
2022-07-26,152.259995,153.089996,150.800003,151.600006,151.138992,55138700
|
||||||
|
2022-07-27,152.580002,157.330002,152.160004,156.789993,156.313202,78620700
|
||||||
|
2022-07-28,156.979996,157.639999,154.410004,157.350006,156.871521,81378700
|
||||||
|
2022-07-29,161.240005,163.630005,159.500000,162.509995,162.015808,101786900
|
||||||
|
2022-08-01,161.009995,163.589996,160.889999,161.509995,161.018845,67829400
|
||||||
|
2022-08-02,160.100006,162.410004,159.630005,160.009995,159.523407,59907000
|
||||||
|
2022-08-03,160.839996,166.589996,160.750000,166.130005,165.624817,82507500
|
||||||
|
2022-08-04,166.009995,167.190002,164.429993,165.809998,165.305786,55474100
|
||||||
|
2022-08-05,163.210007,165.850006,163.000000,165.350006,165.076172,56697000
|
||||||
|
2022-08-08,166.369995,167.809998,164.199997,164.869995,164.596954,60276900
|
||||||
|
2022-08-09,164.020004,165.820007,163.250000,164.919998,164.646866,63135500
|
||||||
|
2022-08-10,167.679993,169.339996,166.899994,169.240005,168.959732,70170500
|
||||||
|
2022-08-11,170.059998,170.990005,168.190002,168.490005,168.210968,57149200
|
||||||
|
2022-08-12,169.820007,172.169998,169.399994,172.100006,171.814987,68039400
|
||||||
|
2022-08-15,171.520004,173.389999,171.350006,173.190002,172.903183,54091700
|
||||||
|
2022-08-16,172.779999,173.710007,171.660004,173.029999,172.743439,56377100
|
||||||
|
2022-08-17,172.770004,176.149994,172.570007,174.550003,174.260925,79542000
|
||||||
|
2022-08-18,173.750000,174.899994,173.119995,174.149994,173.861588,62290100
|
||||||
|
2022-08-19,173.029999,173.740005,171.309998,171.520004,171.235947,70346300
|
||||||
|
2022-08-22,169.690002,169.860001,167.139999,167.570007,167.292496,69026800
|
||||||
|
2022-08-23,167.080002,168.710007,166.649994,167.229996,166.953049,54147100
|
||||||
|
2022-08-24,167.320007,168.110001,166.250000,167.529999,167.252548,53841500
|
||||||
|
2022-08-25,168.779999,170.139999,168.350006,170.029999,169.748413,51218200
|
||||||
|
2022-08-26,170.570007,171.050003,163.559998,163.619995,163.349014,78961000
|
||||||
|
2022-08-29,161.149994,162.899994,159.820007,161.380005,161.112747,73314000
|
||||||
|
2022-08-30,162.130005,162.559998,157.720001,158.910004,158.646835,77906200
|
||||||
|
2022-08-31,160.309998,160.580002,157.139999,157.220001,156.959625,87991100
|
||||||
|
2022-09-01,156.639999,158.419998,154.669998,157.960007,157.698410,74229900
|
||||||
|
2022-09-02,159.750000,160.360001,154.970001,155.809998,155.551956,76957800
|
||||||
|
2022-09-06,156.470001,157.089996,153.690002,154.529999,154.274078,73714800
|
||||||
|
2022-09-07,154.820007,156.669998,153.610001,155.960007,155.701721,87449600
|
||||||
|
2022-09-08,154.639999,156.360001,152.679993,154.460007,154.204208,84923800
|
||||||
|
2022-09-09,155.470001,157.820007,154.750000,157.369995,157.109375,68028800
|
||||||
|
2022-09-12,159.589996,164.259995,159.300003,163.429993,163.159332,104956000
|
||||||
|
2022-09-13,159.899994,160.539993,153.369995,153.839996,153.585220,122656600
|
||||||
|
2022-09-14,154.789993,157.100006,153.610001,155.309998,155.052780,87965400
|
||||||
|
2022-09-15,154.649994,155.240005,151.380005,152.369995,152.117645,90481100
|
||||||
|
2022-09-16,151.210007,151.350006,148.369995,150.699997,150.450424,162278800
|
||||||
|
2022-09-19,149.309998,154.559998,149.100006,154.479996,154.224152,81474200
|
||||||
|
2022-09-20,153.399994,158.080002,153.080002,156.899994,156.640152,107689800
|
||||||
|
2022-09-21,157.339996,158.740005,153.600006,153.720001,153.465424,101696800
|
||||||
|
2022-09-22,152.380005,154.470001,150.910004,152.740005,152.487045,86652500
|
||||||
|
2022-09-23,151.190002,151.470001,148.559998,150.429993,150.180862,96029900
|
||||||
|
2022-09-26,149.660004,153.770004,149.639999,150.770004,150.520309,93339400
|
||||||
|
2022-09-27,152.740005,154.720001,149.949997,151.759995,151.508667,84442700
|
||||||
|
2022-09-28,147.639999,150.639999,144.839996,149.839996,149.591843,146691400
|
||||||
|
2022-09-29,146.100006,146.720001,140.679993,142.479996,142.244034,128138200
|
||||||
|
2022-09-30,141.279999,143.100006,138.000000,138.199997,137.971115,124925300
|
||||||
|
2022-10-03,138.210007,143.070007,137.690002,142.449997,142.214081,114311700
|
||||||
|
2022-10-04,145.029999,146.220001,144.259995,146.100006,145.858047,87830100
|
||||||
|
2022-10-05,144.070007,147.380005,143.009995,146.399994,146.157532,79471000
|
||||||
|
2022-10-06,145.809998,147.539993,145.220001,145.429993,145.189148,68402200
|
||||||
|
2022-10-07,142.539993,143.100006,139.449997,140.089996,139.857986,85925600
|
||||||
|
2022-10-10,140.419998,141.889999,138.570007,140.419998,140.187439,74899000
|
||||||
|
2022-10-11,139.899994,141.350006,138.220001,138.979996,138.749832,77033700
|
||||||
|
2022-10-12,139.130005,140.360001,138.160004,138.339996,138.110886,70433700
|
||||||
|
2022-10-13,134.990005,143.589996,134.369995,142.990005,142.753204,113224000
|
||||||
|
2022-10-14,144.309998,144.520004,138.190002,138.380005,138.150833,88598000
|
||||||
|
2022-10-17,141.070007,142.899994,140.270004,142.410004,142.174164,85250900
|
||||||
|
2022-10-18,145.490005,146.699997,140.610001,143.750000,143.511932,99136600
|
||||||
|
2022-10-19,141.690002,144.949997,141.500000,143.860001,143.621750,61758300
|
||||||
|
2022-10-20,143.020004,145.889999,142.649994,143.389999,143.152527,64522000
|
||||||
|
2022-10-21,142.869995,147.850006,142.649994,147.270004,147.026108,86548600
|
||||||
|
2022-10-24,147.190002,150.229996,146.000000,149.449997,149.202484,75981900
|
||||||
|
2022-10-25,150.089996,152.490005,149.360001,152.339996,152.087708,74732300
|
||||||
|
2022-10-26,150.960007,151.990005,148.039993,149.350006,149.102661,88194300
|
||||||
|
2022-10-27,148.070007,149.050003,144.130005,144.800003,144.560196,109180200
|
||||||
|
2022-10-28,148.199997,157.500000,147.820007,155.740005,155.482086,164762400
|
||||||
|
2022-10-31,153.160004,154.240005,151.919998,153.339996,153.086044,97943200
|
||||||
|
2022-11-01,155.080002,155.449997,149.130005,150.649994,150.400497,80379300
|
||||||
|
2022-11-02,148.949997,152.169998,145.000000,145.029999,144.789810,93604600
|
||||||
|
2022-11-03,142.059998,142.800003,138.750000,138.880005,138.650009,97918500
|
||||||
|
2022-11-04,142.089996,142.669998,134.380005,138.380005,138.380005,140814800
|
||||||
|
2022-11-07,137.110001,139.149994,135.669998,138.919998,138.919998,83374600
|
||||||
|
2022-11-08,140.410004,141.429993,137.490005,139.500000,139.500000,89908500
|
||||||
|
2022-11-09,138.500000,138.550003,134.589996,134.869995,134.869995,74917800
|
||||||
|
2022-11-10,141.240005,146.869995,139.500000,146.869995,146.869995,118854000
|
||||||
|
2022-11-11,145.820007,150.009995,144.369995,149.699997,149.699997,93979700
|
||||||
|
2022-11-14,148.970001,150.279999,147.429993,148.279999,148.279999,73374100
|
||||||
|
2022-11-15,152.220001,153.589996,148.559998,150.039993,150.039993,89868300
|
||||||
|
2022-11-16,149.130005,149.869995,147.289993,148.789993,148.789993,64218300
|
||||||
|
2022-11-17,146.429993,151.479996,146.149994,150.720001,150.720001,80389400
|
||||||
|
2022-11-18,152.309998,152.699997,149.970001,151.289993,151.289993,74829600
|
||||||
|
2022-11-21,150.160004,150.369995,147.720001,148.009995,148.009995,58724100
|
||||||
|
2022-11-22,148.130005,150.419998,146.929993,150.179993,150.179993,51804100
|
||||||
|
2022-11-23,149.449997,151.830002,149.339996,151.070007,151.070007,58301400
|
||||||
|
2022-11-25,148.309998,148.880005,147.119995,148.110001,148.110001,35195900
|
||||||
|
2022-11-28,145.139999,146.639999,143.380005,144.220001,144.220001,69246000
|
||||||
|
2022-11-29,144.289993,144.809998,140.350006,141.169998,141.169998,83763800
|
||||||
|
2022-11-30,141.399994,148.720001,140.550003,148.029999,148.029999,111380900
|
||||||
|
2022-12-01,148.210007,149.130005,146.610001,148.309998,148.309998,71250400
|
||||||
|
2022-12-02,145.960007,148.000000,145.649994,147.809998,147.809998,65447400
|
||||||
|
2022-12-05,147.770004,150.919998,145.770004,146.630005,146.630005,68826400
|
||||||
|
2022-12-06,147.070007,147.300003,141.919998,142.910004,142.910004,64727200
|
||||||
|
2022-12-07,142.190002,143.369995,140.000000,140.940002,140.940002,69721100
|
||||||
|
2022-12-08,142.360001,143.520004,141.100006,142.649994,142.649994,62128300
|
||||||
|
2022-12-09,142.339996,145.570007,140.899994,142.160004,142.160004,76097000
|
||||||
|
2022-12-12,142.699997,144.500000,141.059998,144.490005,144.490005,70462700
|
||||||
|
2022-12-13,149.500000,149.970001,144.240005,145.470001,145.470001,93886200
|
||||||
|
2022-12-14,145.350006,146.660004,141.160004,143.210007,143.210007,82291200
|
||||||
|
2022-12-15,141.110001,141.800003,136.029999,136.500000,136.500000,98931900
|
||||||
|
2022-12-16,136.690002,137.649994,133.729996,134.509995,134.509995,160156900
|
||||||
|
2022-12-19,135.110001,135.199997,131.320007,132.369995,132.369995,79592600
|
||||||
|
2022-12-20,131.389999,133.250000,129.889999,132.300003,132.300003,77432800
|
||||||
|
2022-12-21,132.979996,136.809998,132.750000,135.449997,135.449997,85928000
|
||||||
|
2022-12-22,134.350006,134.559998,130.300003,132.229996,132.229996,77852100
|
||||||
|
2022-12-23,130.919998,132.419998,129.639999,131.860001,131.860001,63814900
|
||||||
|
2022-12-27,131.380005,131.410004,128.720001,130.029999,130.029999,69007800
|
||||||
|
2022-12-28,129.669998,131.029999,125.870003,126.040001,126.040001,85438400
|
||||||
|
2022-12-29,127.989998,130.479996,127.730003,129.610001,129.610001,75703700
|
||||||
|
2022-12-30,128.410004,129.949997,127.430000,129.929993,129.929993,76960600
|
|
54
charts/static/AAPL2.csv
Normal file
54
charts/static/AAPL2.csv
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
Date,Open
|
||||||
|
01.02,176.063
|
||||||
|
01.09,176.801
|
||||||
|
01.16,168.097
|
||||||
|
01.23,170.52
|
||||||
|
01.30,159.105
|
||||||
|
02.06,169.174
|
||||||
|
02.13,172.086
|
||||||
|
02.20,166.612
|
||||||
|
02.27,164.239
|
||||||
|
03.06,162.325
|
||||||
|
03.13,162.624
|
||||||
|
03.20,150.77
|
||||||
|
03.27,162.774
|
||||||
|
04.03,171.39
|
||||||
|
04.10,173.78
|
||||||
|
04.17,167.947
|
||||||
|
04.24,163.182
|
||||||
|
05.01,160.391
|
||||||
|
05.08,156.004
|
||||||
|
05.15,154.454
|
||||||
|
05.22,145.107
|
||||||
|
05.29,137.371
|
||||||
|
06.05,148.616
|
||||||
|
06.12,146.583
|
||||||
|
06.19,132.466
|
||||||
|
06.26,133.014
|
||||||
|
07.03,142.261
|
||||||
|
07.10,137.351
|
||||||
|
07.17,145.227
|
||||||
|
07.24,150.282
|
||||||
|
07.31,153.541
|
||||||
|
08.07,160.521
|
||||||
|
08.14,166.094
|
||||||
|
08.21,171.236
|
||||||
|
08.28,169.409
|
||||||
|
09.04,160.878
|
||||||
|
09.11,156.211
|
||||||
|
09.18,159.326
|
||||||
|
09.25,149.063
|
||||||
|
10.02,149.412
|
||||||
|
10.09,137.981
|
||||||
|
10.16,140.187
|
||||||
|
10.23,140.831
|
||||||
|
10.30,146.941
|
||||||
|
11.06,152.901
|
||||||
|
11.13,137.11
|
||||||
|
11.20,148.97
|
||||||
|
11.27,150.16
|
||||||
|
12.04,145.14
|
||||||
|
12.11,147.77
|
||||||
|
12.18,142.7
|
||||||
|
12.25,135.11
|
||||||
|
|
|
20
charts/static/HistoricalData_APL.csv
Normal file
20
charts/static/HistoricalData_APL.csv
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
Date,Close/Last,Volume,Open,High,Low
|
||||||
|
01/06/2023,$129.62,87754720,$126.01,$130.29,$124.89
|
||||||
|
01/05/2023,$125.02,80962710,$127.13,$127.77,$124.76
|
||||||
|
01/04/2023,$126.36,89113630,$126.89,$128.6557,$125.08
|
||||||
|
01/03/2023,$125.07,112117500,$130.28,$130.9,$124.17
|
||||||
|
12/30/2022,$129.93,77034210,$128.41,$129.95,$127.43
|
||||||
|
12/29/2022,$129.61,75703710,$127.99,$130.4814,$127.73
|
||||||
|
12/28/2022,$126.04,85438390,$129.67,$131.0275,$125.87
|
||||||
|
12/27/2022,$130.03,69007830,$131.38,$131.41,$128.72
|
||||||
|
12/23/2022,$131.86,63814890,$130.92,$132.415,$129.64
|
||||||
|
12/22/2022,$132.23,77852110,$134.352,$134.56,$130.3
|
||||||
|
12/21/2022,$135.45,85927990,$132.98,$136.81,$132.75
|
||||||
|
12/20/2022,$132.3,77432820,$131.39,$133.25,$129.89
|
||||||
|
12/19/2022,$132.37,79592610,$135.11,$135.2,$131.32
|
||||||
|
12/16/2022,$134.51,160156900,$136.685,$137.65,$133.73
|
||||||
|
12/15/2022,$136.5,98931910,$141.11,$141.8,$136.025
|
||||||
|
12/14/2022,$143.21,82291180,$145.35,$146.655,$141.16
|
||||||
|
12/13/2022,$145.47,93886160,$149.5,$149.9692,$144.24
|
||||||
|
12/12/2022,$144.49,70462650,$142.7,$144.5,$141.06
|
||||||
|
12/09/2022,$142.16,76097010,$142.34,$145.57,$140.9
|
|
13
charts/static/akcjeWIG40.csv
Normal file
13
charts/static/akcjeWIG40.csv
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
Data,Otwarcie,Najwyzszy,Najnizszy,Zamkniecie,Wolumen
|
||||||
|
01,5310.69
|
||||||
|
02,5123.32
|
||||||
|
03,4590.48
|
||||||
|
04,4786.4
|
||||||
|
05,4374.13
|
||||||
|
06,4351.82
|
||||||
|
07,4069.32
|
||||||
|
08,4142.42
|
||||||
|
09,3828.67
|
||||||
|
10,3539.92
|
||||||
|
11,3835.14
|
||||||
|
12,4136.36
|
|
13
charts/static/mwig40_m.csv
Normal file
13
charts/static/mwig40_m.csv
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
Data,Otwarcie,Najwyzszy,Najnizszy,Zamkniecie,Wolumen
|
||||||
|
2022-01-31,5310.69,5584.52,4960.09,5106.59,110936154
|
||||||
|
2022-02-28,5123.32,5299.36,4133.55,4589.49,124463773
|
||||||
|
2022-03-31,4590.48,4879.14,4022.22,4778.07,250932976
|
||||||
|
2022-04-30,4786.4,4876.56,4298.09,4370.19,178369206
|
||||||
|
2022-05-31,4374.13,4398.18,4025.77,4349.02,161111044
|
||||||
|
2022-06-30,4351.82,4364.81,3933.24,4069.37,127681534.74069
|
||||||
|
2022-07-31,4069.32,4151.32,3871.78,4151.32,152999536
|
||||||
|
2022-08-31,4142.42,4300.99,3787.83,3838.57,137259580
|
||||||
|
2022-09-30,3828.67,4026.74,3493.06,3552.54,155079325
|
||||||
|
2022-10-31,3539.92,3824.04,3489.63,3824.04,136478417
|
||||||
|
2022-11-30,3835.14,4142.91,3782.99,4108.81,262803731.84112
|
||||||
|
2022-12-31,4136.36,4199.5,3992.16,4154.32,162133955
|
|
13
charts/static/obligacjePL.csv
Normal file
13
charts/static/obligacjePL.csv
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
Data,Otwarcie,Najwyzszy,Najnizszy,Zamkniecie
|
||||||
|
01,100.11
|
||||||
|
02,99.87
|
||||||
|
03,99.83
|
||||||
|
04,94.69
|
||||||
|
05,91.27
|
||||||
|
06,91.96
|
||||||
|
07,92.03
|
||||||
|
08,95.79
|
||||||
|
09,93.63
|
||||||
|
10,91.88
|
||||||
|
11,88.51
|
||||||
|
12,95.01
|
|
15
charts/static/xauusd_y.csv
Normal file
15
charts/static/xauusd_y.csv
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
Data;Otwarcie;Najwyzszy;Najnizszy;Zamkniecie
|
||||||
|
2010-12-31;1095.2;1430.6;1043.72;1420.55
|
||||||
|
2011-12-31;1419;1921.07;1308.26;1564.81
|
||||||
|
2012-12-31;1569.36;1795.54;1526.63;1676.4
|
||||||
|
2013-12-31;1670.6;1696.09;1180.16;1204.12
|
||||||
|
2014-12-31;1205.1;1388.34;1131.78;1183
|
||||||
|
2015-12-31;1187.09;1306.43;1046.64;1061.46
|
||||||
|
2016-12-31;1064.65;1375.42;1062.61;1150.91
|
||||||
|
2017-12-31;1150.53;1357.56;1146.18;1303.33
|
||||||
|
2018-12-31;1303.38;1366.12;1160.31;1282.56
|
||||||
|
2019-12-31;1282.6;1557.1;1266.48;1517.305
|
||||||
|
2020-12-31;1518.17;2075.11;1451.28;1898.705
|
||||||
|
2021-12-31;1903.49;1959.11;1671.9;1829.5
|
||||||
|
2022-12-31;1830.05;2069.94;1614.905;1823.48
|
||||||
|
2023-12-31;1823.65;1826.7;1823.48;1824.14
|
|
3
charts/tests.py
Normal file
3
charts/tests.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
6
charts/urls.py
Normal file
6
charts/urls.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
from django.urls import path
|
||||||
|
from charts import views
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('', views.index, name='graph'),
|
||||||
|
]
|
28
charts/views.py
Normal file
28
charts/views.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
from collections import Counter
|
||||||
|
from math import ceil
|
||||||
|
|
||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
from charts.models import BiteStat
|
||||||
|
|
||||||
|
|
||||||
|
def index(request):
|
||||||
|
stats = BiteStat.objects.order_by('completed')
|
||||||
|
|
||||||
|
data = Counter()
|
||||||
|
for row in stats:
|
||||||
|
yymm = row.completed.strftime("%Y-%m")
|
||||||
|
data[yymm] += 1
|
||||||
|
|
||||||
|
# unpack dict keys / values into two lists
|
||||||
|
labels, values = zip(*data.items())
|
||||||
|
|
||||||
|
context = {
|
||||||
|
"labels": labels,
|
||||||
|
"values": values,
|
||||||
|
}
|
||||||
|
return render(request, "graph.html", context)
|
||||||
|
|
||||||
|
|
0
education/__init__.py
Normal file
0
education/__init__.py
Normal file
3
education/admin.py
Normal file
3
education/admin.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
6
education/apps.py
Normal file
6
education/apps.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class EducationConfig(AppConfig):
|
||||||
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
name = 'education'
|
0
education/migrations/__init__.py
Normal file
0
education/migrations/__init__.py
Normal file
3
education/models.py
Normal file
3
education/models.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from django.db import models
|
||||||
|
|
||||||
|
# Create your models here.
|
3
education/tests.py
Normal file
3
education/tests.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
0
education/urls.py
Normal file
0
education/urls.py
Normal file
6
education/views.py
Normal file
6
education/views.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
|
||||||
|
def education_view(request):
|
||||||
|
context = {}
|
||||||
|
return render(request, 'education/education.html', context)
|
0
pdf_view/__init__.py
Normal file
0
pdf_view/__init__.py
Normal file
3
pdf_view/admin.py
Normal file
3
pdf_view/admin.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
6
pdf_view/apps.py
Normal file
6
pdf_view/apps.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class PdfViewConfig(AppConfig):
|
||||||
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
name = 'pdf_view'
|
0
pdf_view/migrations/__init__.py
Normal file
0
pdf_view/migrations/__init__.py
Normal file
3
pdf_view/models.py
Normal file
3
pdf_view/models.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from django.db import models
|
||||||
|
|
||||||
|
# Create your models here.
|
3
pdf_view/tests.py
Normal file
3
pdf_view/tests.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
0
pdf_view/urls.py
Normal file
0
pdf_view/urls.py
Normal file
9
pdf_view/views.py
Normal file
9
pdf_view/views.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
from django.shortcuts import render
|
||||||
|
from django.http import HttpResponse
|
||||||
|
|
||||||
|
|
||||||
|
# def pdf_view(request):
|
||||||
|
# with open('Czym jest portfel inwestycyjny.pdf', 'rb') as pdf:
|
||||||
|
# response = HttpResponse(pdf.read(), content_type='application/pdf')
|
||||||
|
# response['Content-Disposition'] = 'inline;filename=mypdf.pdf'
|
||||||
|
# return response
|
102
static/Zeszyt1.csv
Normal file
102
static/Zeszyt1.csv
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
writer;surprise;science;glass;mixture;current
|
||||||
|
79770;551446;3215546;5819979770;1;57
|
||||||
|
0;3;273;27;842;99857890
|
||||||
|
4;32;7513624;28331;949598;6473025
|
||||||
|
89;544527;4467;16834745;606;5681
|
||||||
|
1685969;666;8732;21;454322;5578336
|
||||||
|
4;71562;94693;;1563;973
|
||||||
|
3631;36934012;795;;88505714;995
|
||||||
|
993;495569353;52;974896955;319836;
|
||||||
|
9771;3626;6;873064;30332721;162
|
||||||
|
;4074212;6262;;2849432;57
|
||||||
|
47590011;6849;;484402;6079758;1534735461
|
||||||
|
6769;;75;127493;1698290;68650519
|
||||||
|
3440;8;648;2;;79
|
||||||
|
85534467;1512779;21662856;90831;5297001;1389943
|
||||||
|
2829;687539227;7099532438;941859;736794314;
|
||||||
|
590328791;679306515;3274;96950;3668;
|
||||||
|
8841396570;9446;82421547;13;5879;8265
|
||||||
|
66115269;;89036;8;864482971;374263079
|
||||||
|
73174875;21;6747893;6;63;32319195
|
||||||
|
1641585;;383799;518;558775585;8479
|
||||||
|
1086906126;5547986218;59448692;795;89;31
|
||||||
|
3;946744435;597;1967447;943;4
|
||||||
|
17;6587445;1829252;930614;19797732;653
|
||||||
|
72375;3958751;;31;335;891
|
||||||
|
;18268916;0;504456;266553541;2
|
||||||
|
744;5740105;69432484;20109;79;780068002
|
||||||
|
1;36;32313;1768860;9;
|
||||||
|
3680;0;768;2729;8339;68
|
||||||
|
;8199;2593353215;16;;430
|
||||||
|
6;30146081;931;4338;216537803;20
|
||||||
|
786748;587336;89179;580;8;5
|
||||||
|
6295555;54867;499907;5045938847;343916;938
|
||||||
|
16922;267671;760146062;343652;1089612006;4
|
||||||
|
42628;67;62;1240;50744841;7633
|
||||||
|
143836;;14072;58;;69979
|
||||||
|
1;379464;5797429598;26;801;6538
|
||||||
|
;694662;4161;337;1950084604;36104
|
||||||
|
908336621;195365;32;45759;579106;9409
|
||||||
|
2;5453152110;;98190650;88;3407217
|
||||||
|
7015805;138625;45108;94957732;5;993328285
|
||||||
|
8;579734087;349;8147403;1;
|
||||||
|
7839;89;9716987;392555822;;709263
|
||||||
|
92;672177;88249701;406;2821;26191161
|
||||||
|
691541318;42427;827;;6479862;8578
|
||||||
|
;71353;79515541;28808360;4388;415
|
||||||
|
37;431;49152278;;64221179;9985768
|
||||||
|
99;0;71880789;391501222;8729242;51
|
||||||
|
247573592;16195;1056140;434610;4;1
|
||||||
|
1044887;775;765559;382;7;30876071
|
||||||
|
1301488258;231707866;5;53849947;67;2870026
|
||||||
|
63;321;290689;899450;269344403;
|
||||||
|
5;617874;95157;8;59;61
|
||||||
|
473679384;1014;2782;2;1;9005
|
||||||
|
59;;651858;1042188;28172;388893
|
||||||
|
;8165704708;7040;4;;
|
||||||
|
8216685;41987145;7737362423;33269896;1203;47559
|
||||||
|
436008;6945;477;977;;7
|
||||||
|
6;97402548;3;;9580589874;6786486
|
||||||
|
13;6;400120723;15;69019712;8
|
||||||
|
;4462640;489;506693;326794017;878508936
|
||||||
|
94521445;2201;5;4972;8398;43372
|
||||||
|
714440981;461560;2014;193508955;808;
|
||||||
|
62977;4;2442541;9899;68539143;2
|
||||||
|
568979113;264780;;252982;91730675;
|
||||||
|
68421336;3234;319709;20762;39793275;
|
||||||
|
478799723;96673;3203817;901;266187;378080791
|
||||||
|
1;4;87377;7;96967662;53383429
|
||||||
|
1613738;;46831;;79;70826
|
||||||
|
202688;5;248936;5810641;392138;0
|
||||||
|
4060570;45;58690883;3;4574;853291856
|
||||||
|
339;64786;5;819;90982;641
|
||||||
|
824;57;35;72936;;81741
|
||||||
|
2879184;;7050;4111618;48872334;4
|
||||||
|
63552;3;539862;74;30;8963625379
|
||||||
|
;5031509;324405811;26;22536;8912375
|
||||||
|
313723;88221;377541;616;8;42
|
||||||
|
963;2;760;44;247438711;2089
|
||||||
|
7564394;495650;3704;6538;;
|
||||||
|
69476297;87562683;7;572;273388837;8875187
|
||||||
|
105;480986332;843;;5;3
|
||||||
|
260;;6;9;409;367381751
|
||||||
|
;935937;6757276;3801;54;243322
|
||||||
|
7549;703334;2001310;56359;95;497703550
|
||||||
|
1394784;74;477;1096980;7200221;68
|
||||||
|
97985264;1327741425;;1241589;527;38246691
|
||||||
|
18;2638737715;59;978511422;2116;834579498
|
||||||
|
47;4498244;32;31192;25128;6429969
|
||||||
|
1654209;120;8500864;3;43671386;2390829
|
||||||
|
36538;26300;4677116774;39589;;619
|
||||||
|
;893;80;49883;3305161;68
|
||||||
|
7911115;83407270;8;191;1462621;5018
|
||||||
|
591039;542219339;287;;8;7
|
||||||
|
65;33786;685;530942859;19;37343359
|
||||||
|
1;;45097;9;38741663;
|
||||||
|
920;936149731;7074638;3;1;2698
|
||||||
|
366;838;12382;125213;13471967;1
|
||||||
|
489;;379562;975712;82665;163715
|
||||||
|
3;382728;;;134;60717
|
||||||
|
9;;7837;60;198;4770
|
||||||
|
234;32119;70028;38569167;1;8890501
|
||||||
|
10352;17362008;5625;;388629;66536858
|
|
BIN
static/images/charts.jpg
Normal file
BIN
static/images/charts.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 588 KiB |
@ -1,3 +1,9 @@
|
|||||||
.grad {
|
.grad {
|
||||||
background-image: linear-gradient(to right, orange , white);
|
background-image: linear-gradient(to right, orange , white);
|
||||||
}
|
}
|
||||||
|
.center {
|
||||||
|
display: block;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
width: 50%;
|
||||||
|
}
|
11
templates/graph.html
Normal file
11
templates/graph.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{% load static %}
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Bite exercise stats</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -26,19 +26,22 @@
|
|||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
<a class="nav-link" href="/logout">Wyloguj</a>
|
<a class="nav-link" href="/logout">Wyloguj</a>
|
||||||
|
<a class="nav-link" href="/oblplot/">Użyj bezpiecznego wariantu</a>
|
||||||
|
<a class="nav-link" href="/wigplot">Użyj bardziej ryzykownego wariantu</a>
|
||||||
|
<a class="nav-link" href="https://www.xtb.com/pl">Zainwestuj z Xtb</a>
|
||||||
|
<a class="nav-link" href="https://www.etoro.com/pl/">Zainwestuj z Etoro</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a class="nav-link" href="/login">Zaloguj</a>
|
<a class="nav-link" href="/login">Zaloguj</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
Dropdown
|
Edukacja
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
||||||
<a class="dropdown-item" href="#">Action</a>
|
<a class="dropdown-item" href="/view-pdf1">Informacje o stronie</a>
|
||||||
<a class="dropdown-item" href="#">Another action</a>
|
<a class="dropdown-item" href="/view-pdf-rynki/">Obligacje</a>
|
||||||
<div class="dropdown-divider"></div>
|
<a class="dropdown-item" href="/view-pdf-akcje/">Akcje</a>
|
||||||
<a class="dropdown-item" href="#">Something else here</a>
|
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
@ -48,8 +51,8 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<form class="form-inline my-2 my-lg-0">
|
<form class="form-inline my-2 my-lg-0">
|
||||||
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
|
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Szukaj">
|
||||||
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
|
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Szukaj</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
@ -57,9 +60,10 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div>
|
<div>
|
||||||
<h1 style="text-align:center">Witaj na stronie FinTech!</h1>
|
<h1 style="text-align:center">Witaj na stronie FinTech!</h1>
|
||||||
<h4>Tutaj możesz nauczyć się jak inwestować i prognozować kursy z pomocą sztucznej inteligencji.</h4>
|
<h4 style="text-align:center">Tutaj możesz nauczyć się jak inwestować i prognozować kursy z pomocą sztucznej inteligencji.</h4>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div style="flex:2"><img class="center" src="{% static 'images/charts.jpg' %}"></div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
|
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
|
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
|
||||||
|
10
templates/my_template.html
Normal file
10
templates/my_template.html
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{% load matplotlib %}
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>My Plot</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>My Plot</h1>
|
||||||
|
{% matplotlib_inline fig %}
|
||||||
|
</body>
|
||||||
|
</html>
|
13
templates/obligacjePLplot.html
Normal file
13
templates/obligacjePLplot.html
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Title</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<img class="center" src="{{ uri }}" alt="Stock Prices Prediction">
|
||||||
|
<h3>Oto wykres obligacji polskich przedstawiający zmianę ich wartości w rozbiciu miesięcznym w roku 2022 z
|
||||||
|
prognozą na kolejne 6 miesięcy. Jak widać wahania nie są duże, więc ryzyko związane z inwestycją
|
||||||
|
jest relatywnie niskie. Trzeba pamiętać jednak, że zysk nie będzie również wysoki.</h3>
|
||||||
|
</body>
|
||||||
|
</html>
|
11
templates/plot.html
Normal file
11
templates/plot.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{% extends "main.html" %}
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Title</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -29,7 +29,7 @@
|
|||||||
<form method="POST">
|
<form method="POST">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ login_form|crispy }}
|
{{ login_form|crispy }}
|
||||||
<button class="btn btn-primary" type="submit">Login</button>
|
<button class="btn btn-primary" type="submit">Zaloguj</button>
|
||||||
</form>
|
</form>
|
||||||
<p class="text-center">Nie masz konta? <a href="/register">Zarejestruj się</a>.</p>
|
<p class="text-center">Nie masz konta? <a href="/register">Zarejestruj się</a>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -7,13 +7,13 @@
|
|||||||
|
|
||||||
<!--Register-->
|
<!--Register-->
|
||||||
<div class="container py-5">
|
<div class="container py-5">
|
||||||
<h1>Register</h1>
|
<h1>Zarejestruj się</h1>
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ register_form|crispy }}
|
{{ register_form|crispy }}
|
||||||
<button class="btn btn-primary" type="submit">Register</button>
|
<button class="btn btn-primary" type="submit">Zarejestruj</button>
|
||||||
</form>
|
</form>
|
||||||
<p class="text-center">If you already have an account, <a href="/login">login</a> instead.</p>
|
<p class="text-center">Jeżeli masz już konto, <a href="/login">zaloguj się</a>. </p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
12
templates/wigplot.html
Normal file
12
templates/wigplot.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Title</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<img class="center" src="{{ uri }}" alt="Stock Prices Prediction">
|
||||||
|
<h3>Oto wykres wartości 40 największych polskich spółek na przestrzeni roku 2022 w podziale na miesiące
|
||||||
|
z prognozą na kolejne pół roku. Jak widać wahania są całkiem duże, więc można dużo zyskać ale również dużo stracić</h3>
|
||||||
|
</body>
|
||||||
|
</html>
|
21
tests/test_1.py
Normal file
21
tests/test_1.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
from django.contrib.auth.models import User
|
||||||
|
from django.http import request, HttpResponseRedirect
|
||||||
|
from django.test import TestCase
|
||||||
|
from django.urls import reverse
|
||||||
|
|
||||||
|
|
||||||
|
class LogInTest(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.credentials = {
|
||||||
|
'username': 'test123',
|
||||||
|
'password': 'Fintech123'}
|
||||||
|
User.objects.create_user(**self.credentials)
|
||||||
|
|
||||||
|
def test_login(self):
|
||||||
|
response = self.client.post('/accounts/login', self.credentials, follow=True)
|
||||||
|
self.assertFalse(response.context['user'].is_authenticated)
|
||||||
|
|
||||||
|
class ButtonTest(TestCase):
|
||||||
|
def button_test(self):
|
||||||
|
if request.POST.get('Submit') == 'Submit':
|
||||||
|
print('user clicked submit')
|
Loading…
Reference in New Issue
Block a user