new chart - price deviation
This commit is contained in:
parent
93424cffe0
commit
ce336e9744
6 changed files with 845 additions and 6 deletions
|
@ -110,7 +110,7 @@
|
|||
<a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapsePrice"
|
||||
aria-expanded="true" aria-controls="collapsePrice">
|
||||
<i class="fas fa-dollar-sign"></i>
|
||||
<span>Price (15)</span>
|
||||
<span>Price (16)</span>
|
||||
</a>
|
||||
<div id="collapsePrice" class="collapse" aria-labelledby="headingPrice"
|
||||
data-parent="#accordionSidebar">
|
||||
|
@ -132,6 +132,7 @@
|
|||
<a class="collapse-item" href="{% url 'monerojnet:powerlaw' %}">Power Law</a>
|
||||
<a class="collapse-item" href="{% url 'monerojnet:thermocap' %}">Thermocap Multiple</a>
|
||||
<a class="collapse-item" href="{% url 'monerojnet:sharpe' %}">Sharpe Ratio</a>
|
||||
<a class="collapse-item" href="{% url 'monerojnet:deviation' %}">Price Deviation</a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
|
359
monerojnet/templates/monerojnet/deviation.html
Normal file
359
monerojnet/templates/monerojnet/deviation.html
Normal file
|
@ -0,0 +1,359 @@
|
|||
{% extends 'monerojnet/base.html' %}
|
||||
{% block content %}
|
||||
|
||||
<!-- Content Wrapper -->
|
||||
<div id="content-wrapper" style="background-color:rgb(48, 44, 41)">
|
||||
|
||||
<!-- Main Content -->
|
||||
<div id="content">
|
||||
|
||||
<!-- Begin Page Content -->
|
||||
<div class="container-fluid"><br>
|
||||
<div class="row">
|
||||
<div class="col-xl-12 col-lg-12">
|
||||
<div class="card" id="graph1">
|
||||
<div
|
||||
class="card-header py-3 d-flex flex-row align-items-center justify-content-between text-white">
|
||||
<h6 class="m-0 text-light">Price Deviation from 6 Months Average</h6>
|
||||
<div class="dropdown no-arrow">
|
||||
<a class="dropdown-toggle" href="#" role="button"
|
||||
onclick="$('#graph1').toggleClass('fullscreen');window.dispatchEvent(new Event('resize'));">
|
||||
<i class="fas fa-arrows-alt fa-sm fa-fw text-gray-400"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body" style="height: 100px;">
|
||||
<div id="graph" style="height: 100%;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Content Row -->
|
||||
<div class="row">
|
||||
<div class="col-xl-11 col-md-6 mb-4">
|
||||
<div class="alert alert-dark" role="alert">
|
||||
Not financial advice.
|
||||
For information about the chart, click the button >
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-1">
|
||||
<button type="button" class="btn btn-dark btn-block" data-toggle="modal" href="#"
|
||||
data-target="#id_Modal">
|
||||
<div class="col-auto">
|
||||
<i class="fa fa-info-circle fa-2x "></i>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- /.container-fluid -->
|
||||
|
||||
</div>
|
||||
<!-- End of Main Content -->
|
||||
|
||||
</div>
|
||||
<!-- End of Content Wrapper -->
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="id_Modal" tabindex="-1" role="dialog" aria-labelledby="Modal" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="Modal">Help about the chart</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Cancelar">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
This chart shows the average deviation percentage from the 180 days simple average and also the total deviation in dollars.<br>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Fim do Modal -->
|
||||
|
||||
|
||||
<!-- Page level plugins -->
|
||||
<script>
|
||||
var data3 = {
|
||||
type: "scatter",
|
||||
mode: "lines",
|
||||
name: 'Deviation (Dollars)',
|
||||
x: {{ dates|safe }},
|
||||
y: {{ deviation_price|safe }},
|
||||
line: {
|
||||
color: '#33ff66'
|
||||
,width: 2
|
||||
},
|
||||
yaxis: "y2"
|
||||
};
|
||||
|
||||
var data3_mobile = {
|
||||
type: "scatter",
|
||||
mode: "lines",
|
||||
name: 'Deviation (Dollars)',
|
||||
x: {{ dates|safe }},
|
||||
y: {{ deviation_price|safe }},
|
||||
line: {
|
||||
color: '#33ff66'
|
||||
,width: 2
|
||||
},
|
||||
yaxis: "y2"
|
||||
};
|
||||
|
||||
var data2 = {
|
||||
type: "scatter",
|
||||
mode: "lines",
|
||||
name: 'Deviation (Percentage)',
|
||||
x: {{ dates|safe }},
|
||||
y: {{ deviation_percentage|safe }},
|
||||
line: {
|
||||
color: '#3366ff'
|
||||
,width: 2
|
||||
},
|
||||
yaxis: "y2"
|
||||
};
|
||||
|
||||
var data2_mobile = {
|
||||
type: "scatter",
|
||||
mode: "lines",
|
||||
name: 'Deviation (Percentage)',
|
||||
x: {{ dates|safe }},
|
||||
y: {{ deviation_percentage|safe }},
|
||||
line: {
|
||||
color: '#3366ff'
|
||||
,width: 2
|
||||
},
|
||||
yaxis: "y2"
|
||||
};
|
||||
|
||||
var data1 = {
|
||||
type: "scatter",
|
||||
mode: "lines",
|
||||
name: 'Price',
|
||||
x: {{ dates|safe }},
|
||||
y: {{ pricexmr|safe }},
|
||||
line: {
|
||||
color: '#666666'
|
||||
,width: 1
|
||||
}
|
||||
};
|
||||
|
||||
var data1_mobile = {
|
||||
type: "scatter",
|
||||
mode: "lines",
|
||||
name: 'Price',
|
||||
x: {{ dates|safe }},
|
||||
y: {{ pricexmr|safe }},
|
||||
line: {
|
||||
color: '#666666'
|
||||
,width: 1
|
||||
}
|
||||
};
|
||||
|
||||
var data = [data2, data3, data1];
|
||||
var data_mobile = [data2_mobile, data3_mobile, data1_mobile];
|
||||
|
||||
var layout = {
|
||||
plot_bgcolor:"#252221",
|
||||
paper_bgcolor:"#252221",
|
||||
annotations: [
|
||||
{
|
||||
xref: 'paper',
|
||||
yref: 'paper',
|
||||
x: 0.02,
|
||||
xanchor: 'auto',
|
||||
y: 0.80,
|
||||
yanchor: 'auto',
|
||||
text: 'Moneroj<br>https://www.moneroj.net',
|
||||
showarrow: false,
|
||||
borderwidth: 1,
|
||||
bordercolor: '#5f5f5f',
|
||||
bgcolor: '#333333',
|
||||
borderpad: 5,
|
||||
align: 'center',
|
||||
font: {
|
||||
color: "white",
|
||||
size: 12
|
||||
}
|
||||
}],
|
||||
separators: ",.",
|
||||
legend: {
|
||||
x: 0.02,
|
||||
y: 0.98,
|
||||
bgcolor: '#333333',
|
||||
bordercolor: '#5f5f5f',
|
||||
borderwidth: 1,
|
||||
font: {
|
||||
color: 'white',
|
||||
size: 12
|
||||
},
|
||||
traceorder: 'normal',
|
||||
xanchor: 'auto',
|
||||
yanchor: 'auto'
|
||||
},
|
||||
hoverlabel: {
|
||||
namelength: -1
|
||||
},
|
||||
yaxis: {
|
||||
type: "log",
|
||||
title: {
|
||||
text: 'Price (USD)',
|
||||
font: {
|
||||
size: 20,
|
||||
color: 'white'
|
||||
}
|
||||
},
|
||||
tickformat :",.2f"
|
||||
,nticks: 10
|
||||
,tickfont: {
|
||||
color: "#ffffff"
|
||||
,size: 12
|
||||
}
|
||||
,gridcolor: "#333333"
|
||||
},
|
||||
yaxis2: {
|
||||
type: "linear",
|
||||
title: {
|
||||
text: 'Deviation',
|
||||
font: {
|
||||
size: 20,
|
||||
color: 'white'
|
||||
}
|
||||
},
|
||||
tickformat :",.0f"
|
||||
,nticks: 10
|
||||
,tickfont: {
|
||||
color: "#ffffff"
|
||||
,size: 12
|
||||
}
|
||||
,gridcolor: "#252221"
|
||||
,side: "right"
|
||||
,overlaying: 'y'
|
||||
},
|
||||
xaxis: {
|
||||
hoverformat: "%Y-%m-%d",
|
||||
showgrid: true,
|
||||
type: 'date',
|
||||
nticks: 10
|
||||
,tickfont: {
|
||||
color: "#dddddd"
|
||||
,size: 13
|
||||
}
|
||||
,gridcolor: "#333333"
|
||||
,range: ['2014-05-01', '2023-01-01']
|
||||
,zeroline: true
|
||||
},
|
||||
margin: {
|
||||
l: 120,
|
||||
r: 120,
|
||||
b: 35,
|
||||
t: 10,
|
||||
pad: 10
|
||||
}
|
||||
};
|
||||
|
||||
var layout_mobile = {
|
||||
plot_bgcolor:"black",
|
||||
paper_bgcolor:"black",
|
||||
separators: ",.",
|
||||
hoverlabel: {
|
||||
namelength: -1
|
||||
},
|
||||
legend: {
|
||||
x: 0.02,
|
||||
y: 0.98,
|
||||
bgcolor: '#000000',
|
||||
bordercolor: '#5f5f5f',
|
||||
borderwidth: 1,
|
||||
font: {
|
||||
color: 'white',
|
||||
size: 5
|
||||
},
|
||||
traceorder: 'normal',
|
||||
xanchor: 'auto',
|
||||
yanchor: 'auto'
|
||||
},
|
||||
showlegend: false,
|
||||
yaxis: {
|
||||
type: "log",
|
||||
tickformat :",.0f"
|
||||
,nticks: 10
|
||||
,tickfont: {
|
||||
color: "#ffffff"
|
||||
,size: 7
|
||||
}
|
||||
,gridcolor: "#444444"
|
||||
},
|
||||
yaxis2: {
|
||||
type: "linear",
|
||||
tickformat :",.2f"
|
||||
,nticks: 10
|
||||
,tickfont: {
|
||||
color: "white"
|
||||
}
|
||||
,gridcolor: "#252221"
|
||||
,side: "right"
|
||||
,overlaying: 'y'
|
||||
},
|
||||
xaxis: {
|
||||
hoverformat: "%Y",
|
||||
showgrid: true,
|
||||
type: 'date',
|
||||
nticks: 10
|
||||
,tickfont: {
|
||||
color: "#dddddd"
|
||||
,size: 7
|
||||
}
|
||||
,gridcolor: "#444444"
|
||||
,range: ['2014-05-01', '2023-01-01']
|
||||
,zeroline: true
|
||||
},
|
||||
margin: {
|
||||
l: 40,
|
||||
r: 100,
|
||||
b: 35,
|
||||
t: 10,
|
||||
pad: 10
|
||||
}
|
||||
};
|
||||
|
||||
function findBootstrapEnvironment() {
|
||||
let envs = ['xs', 'sm', 'md', 'lg', 'xl'];
|
||||
|
||||
let el = document.createElement('div');
|
||||
document.body.appendChild(el);
|
||||
|
||||
let curEnv = envs.shift();
|
||||
|
||||
for (let env of envs.reverse()) {
|
||||
el.classList.add(`d-${env}-none`);
|
||||
|
||||
if (window.getComputedStyle(el).display === 'none') {
|
||||
curEnv = env;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
document.body.removeChild(el);
|
||||
return curEnv;
|
||||
|
||||
}
|
||||
env_size = findBootstrapEnvironment();
|
||||
if (env_size == "xs") {
|
||||
document.getElementById("graph1").style.height="350px";
|
||||
Plotly.newPlot('graph', data_mobile, layout_mobile, {responsive: true, modeBarButtonsToRemove: ['toImage', 'hoverCompareCartesian', 'hoverClosest2d', 'toggleSpikelines', 'lasso2d', 'select2d', 'hoverClosestCartesian'], displaylogo: false});
|
||||
}
|
||||
else {
|
||||
document.getElementById("graph1").style.height="700px";
|
||||
Plotly.newPlot('graph', data, layout, {responsive: true, modeBarButtonsToRemove: ['toImage', 'hoverCompareCartesian', 'hoverClosest2d', 'toggleSpikelines', 'lasso2d', 'select2d', 'hoverClosestCartesian'], displaylogo: false});
|
||||
}
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
359
monerojnet/templates/monerojnet/deviation_tx.html
Normal file
359
monerojnet/templates/monerojnet/deviation_tx.html
Normal file
|
@ -0,0 +1,359 @@
|
|||
{% extends 'monerojnet/base.html' %}
|
||||
{% block content %}
|
||||
|
||||
<!-- Content Wrapper -->
|
||||
<div id="content-wrapper" style="background-color:rgb(48, 44, 41)">
|
||||
|
||||
<!-- Main Content -->
|
||||
<div id="content">
|
||||
|
||||
<!-- Begin Page Content -->
|
||||
<div class="container-fluid"><br>
|
||||
<div class="row">
|
||||
<div class="col-xl-12 col-lg-12">
|
||||
<div class="card" id="graph1">
|
||||
<div
|
||||
class="card-header py-3 d-flex flex-row align-items-center justify-content-between text-white">
|
||||
<h6 class="m-0 text-light">Price Deviation from 6 Months Average</h6>
|
||||
<div class="dropdown no-arrow">
|
||||
<a class="dropdown-toggle" href="#" role="button"
|
||||
onclick="$('#graph1').toggleClass('fullscreen');window.dispatchEvent(new Event('resize'));">
|
||||
<i class="fas fa-arrows-alt fa-sm fa-fw text-gray-400"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body" style="height: 100px;">
|
||||
<div id="graph" style="height: 100%;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Content Row -->
|
||||
<div class="row">
|
||||
<div class="col-xl-11 col-md-6 mb-4">
|
||||
<div class="alert alert-dark" role="alert">
|
||||
Not financial advice.
|
||||
For information about the chart, click the button >
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-1">
|
||||
<button type="button" class="btn btn-dark btn-block" data-toggle="modal" href="#"
|
||||
data-target="#id_Modal">
|
||||
<div class="col-auto">
|
||||
<i class="fa fa-info-circle fa-2x "></i>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- /.container-fluid -->
|
||||
|
||||
</div>
|
||||
<!-- End of Main Content -->
|
||||
|
||||
</div>
|
||||
<!-- End of Content Wrapper -->
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="id_Modal" tabindex="-1" role="dialog" aria-labelledby="Modal" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="Modal">Help about the chart</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Cancelar">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
This chart shows the average deviation percentage from the 180 days simple average and also the total deviation in dollars.<br>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Fim do Modal -->
|
||||
|
||||
|
||||
<!-- Page level plugins -->
|
||||
<script>
|
||||
var data3 = {
|
||||
type: "scatter",
|
||||
mode: "lines",
|
||||
name: 'Deviation (Dollars)',
|
||||
x: {{ dates|safe }},
|
||||
y: {{ deviation_price|safe }},
|
||||
line: {
|
||||
color: '#33ff66'
|
||||
,width: 2
|
||||
},
|
||||
yaxis: "y2"
|
||||
};
|
||||
|
||||
var data3_mobile = {
|
||||
type: "scatter",
|
||||
mode: "lines",
|
||||
name: 'Deviation (Dollars)',
|
||||
x: {{ dates|safe }},
|
||||
y: {{ deviation_price|safe }},
|
||||
line: {
|
||||
color: '#33ff66'
|
||||
,width: 2
|
||||
},
|
||||
yaxis: "y2"
|
||||
};
|
||||
|
||||
var data2 = {
|
||||
type: "scatter",
|
||||
mode: "lines",
|
||||
name: 'Deviation (Percentage)',
|
||||
x: {{ dates|safe }},
|
||||
y: {{ deviation_percentage|safe }},
|
||||
line: {
|
||||
color: '#3366ff'
|
||||
,width: 2
|
||||
},
|
||||
yaxis: "y2"
|
||||
};
|
||||
|
||||
var data2_mobile = {
|
||||
type: "scatter",
|
||||
mode: "lines",
|
||||
name: 'Deviation (Percentage)',
|
||||
x: {{ dates|safe }},
|
||||
y: {{ deviation_percentage|safe }},
|
||||
line: {
|
||||
color: '#3366ff'
|
||||
,width: 2
|
||||
},
|
||||
yaxis: "y2"
|
||||
};
|
||||
|
||||
var data1 = {
|
||||
type: "scatter",
|
||||
mode: "lines",
|
||||
name: 'Price',
|
||||
x: {{ dates|safe }},
|
||||
y: {{ pricexmr|safe }},
|
||||
line: {
|
||||
color: '#666666'
|
||||
,width: 1
|
||||
}
|
||||
};
|
||||
|
||||
var data1_mobile = {
|
||||
type: "scatter",
|
||||
mode: "lines",
|
||||
name: 'Price',
|
||||
x: {{ dates|safe }},
|
||||
y: {{ pricexmr|safe }},
|
||||
line: {
|
||||
color: '#666666'
|
||||
,width: 1
|
||||
}
|
||||
};
|
||||
|
||||
var data = [data2, data3, data1];
|
||||
var data_mobile = [data2_mobile, data3_mobile, data1_mobile];
|
||||
|
||||
var layout = {
|
||||
plot_bgcolor:"#252221",
|
||||
paper_bgcolor:"#252221",
|
||||
annotations: [
|
||||
{
|
||||
xref: 'paper',
|
||||
yref: 'paper',
|
||||
x: 0.02,
|
||||
xanchor: 'auto',
|
||||
y: 0.80,
|
||||
yanchor: 'auto',
|
||||
text: 'Moneroj<br>https://www.moneroj.net',
|
||||
showarrow: false,
|
||||
borderwidth: 1,
|
||||
bordercolor: '#5f5f5f',
|
||||
bgcolor: '#333333',
|
||||
borderpad: 5,
|
||||
align: 'center',
|
||||
font: {
|
||||
color: "white",
|
||||
size: 12
|
||||
}
|
||||
}],
|
||||
separators: ",.",
|
||||
legend: {
|
||||
x: 0.02,
|
||||
y: 0.98,
|
||||
bgcolor: '#333333',
|
||||
bordercolor: '#5f5f5f',
|
||||
borderwidth: 1,
|
||||
font: {
|
||||
color: 'white',
|
||||
size: 12
|
||||
},
|
||||
traceorder: 'normal',
|
||||
xanchor: 'auto',
|
||||
yanchor: 'auto'
|
||||
},
|
||||
hoverlabel: {
|
||||
namelength: -1
|
||||
},
|
||||
yaxis: {
|
||||
type: "log",
|
||||
title: {
|
||||
text: 'Price (USD)',
|
||||
font: {
|
||||
size: 20,
|
||||
color: 'white'
|
||||
}
|
||||
},
|
||||
tickformat :",.2f"
|
||||
,nticks: 10
|
||||
,tickfont: {
|
||||
color: "#ffffff"
|
||||
,size: 12
|
||||
}
|
||||
,gridcolor: "#333333"
|
||||
},
|
||||
yaxis2: {
|
||||
type: "linear",
|
||||
title: {
|
||||
text: 'Deviation',
|
||||
font: {
|
||||
size: 20,
|
||||
color: 'white'
|
||||
}
|
||||
},
|
||||
tickformat :",.0f"
|
||||
,nticks: 10
|
||||
,tickfont: {
|
||||
color: "#ffffff"
|
||||
,size: 12
|
||||
}
|
||||
,gridcolor: "#252221"
|
||||
,side: "right"
|
||||
,overlaying: 'y'
|
||||
},
|
||||
xaxis: {
|
||||
hoverformat: "%Y-%m-%d",
|
||||
showgrid: true,
|
||||
type: 'date',
|
||||
nticks: 10
|
||||
,tickfont: {
|
||||
color: "#dddddd"
|
||||
,size: 13
|
||||
}
|
||||
,gridcolor: "#333333"
|
||||
,range: ['2014-05-01', '2023-01-01']
|
||||
,zeroline: true
|
||||
},
|
||||
margin: {
|
||||
l: 120,
|
||||
r: 120,
|
||||
b: 35,
|
||||
t: 10,
|
||||
pad: 10
|
||||
}
|
||||
};
|
||||
|
||||
var layout_mobile = {
|
||||
plot_bgcolor:"black",
|
||||
paper_bgcolor:"black",
|
||||
separators: ",.",
|
||||
hoverlabel: {
|
||||
namelength: -1
|
||||
},
|
||||
legend: {
|
||||
x: 0.02,
|
||||
y: 0.98,
|
||||
bgcolor: '#000000',
|
||||
bordercolor: '#5f5f5f',
|
||||
borderwidth: 1,
|
||||
font: {
|
||||
color: 'white',
|
||||
size: 5
|
||||
},
|
||||
traceorder: 'normal',
|
||||
xanchor: 'auto',
|
||||
yanchor: 'auto'
|
||||
},
|
||||
showlegend: false,
|
||||
yaxis: {
|
||||
type: "log",
|
||||
tickformat :",.0f"
|
||||
,nticks: 10
|
||||
,tickfont: {
|
||||
color: "#ffffff"
|
||||
,size: 7
|
||||
}
|
||||
,gridcolor: "#444444"
|
||||
},
|
||||
yaxis2: {
|
||||
type: "linear",
|
||||
tickformat :",.2f"
|
||||
,nticks: 10
|
||||
,tickfont: {
|
||||
color: "white"
|
||||
}
|
||||
,gridcolor: "#252221"
|
||||
,side: "right"
|
||||
,overlaying: 'y'
|
||||
},
|
||||
xaxis: {
|
||||
hoverformat: "%Y",
|
||||
showgrid: true,
|
||||
type: 'date',
|
||||
nticks: 10
|
||||
,tickfont: {
|
||||
color: "#dddddd"
|
||||
,size: 7
|
||||
}
|
||||
,gridcolor: "#444444"
|
||||
,range: ['2014-05-01', '2023-01-01']
|
||||
,zeroline: true
|
||||
},
|
||||
margin: {
|
||||
l: 40,
|
||||
r: 100,
|
||||
b: 35,
|
||||
t: 10,
|
||||
pad: 10
|
||||
}
|
||||
};
|
||||
|
||||
function findBootstrapEnvironment() {
|
||||
let envs = ['xs', 'sm', 'md', 'lg', 'xl'];
|
||||
|
||||
let el = document.createElement('div');
|
||||
document.body.appendChild(el);
|
||||
|
||||
let curEnv = envs.shift();
|
||||
|
||||
for (let env of envs.reverse()) {
|
||||
el.classList.add(`d-${env}-none`);
|
||||
|
||||
if (window.getComputedStyle(el).display === 'none') {
|
||||
curEnv = env;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
document.body.removeChild(el);
|
||||
return curEnv;
|
||||
|
||||
}
|
||||
env_size = findBootstrapEnvironment();
|
||||
if (env_size == "xs") {
|
||||
document.getElementById("graph1").style.height="350px";
|
||||
Plotly.newPlot('graph', data_mobile, layout_mobile, {responsive: true, modeBarButtonsToRemove: ['toImage', 'hoverCompareCartesian', 'hoverClosest2d', 'toggleSpikelines', 'lasso2d', 'select2d', 'hoverClosestCartesian'], displaylogo: false});
|
||||
}
|
||||
else {
|
||||
document.getElementById("graph1").style.height="700px";
|
||||
Plotly.newPlot('graph', data, layout, {responsive: true, modeBarButtonsToRemove: ['toImage', 'hoverCompareCartesian', 'hoverClosest2d', 'toggleSpikelines', 'lasso2d', 'select2d', 'hoverClosestCartesian'], displaylogo: false});
|
||||
}
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
|
@ -284,7 +284,7 @@
|
|||
,size: 13
|
||||
}
|
||||
,gridcolor: "#333333"
|
||||
,range: ['2014-04-10', '2023-01-01']
|
||||
,range: ['2014-04-10', '2023-06-01']
|
||||
,zeroline: true
|
||||
},
|
||||
margin: {
|
||||
|
@ -338,7 +338,7 @@
|
|||
,size: 7
|
||||
}
|
||||
,gridcolor: "#444444"
|
||||
,range: ['2014-04-10', '2023-01-01']
|
||||
,range: ['2014-04-10', '2023-06-01']
|
||||
,zeroline: true
|
||||
},
|
||||
margin: {
|
||||
|
|
|
@ -80,6 +80,7 @@ urlpatterns = [
|
|||
path('blockchainsize/', views.blockchainsize, name='blockchainsize'),
|
||||
path('difficulty/', views.difficulty, name='difficulty'),
|
||||
path('transmonth/', views.transmonth, name='transmonth'),
|
||||
path('deviation/', views.deviation, name='deviation'),
|
||||
|
||||
# URLs to useful functions on monerojnet/views.py
|
||||
# Only admins can use these
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from ctypes import sizeof
|
||||
from os import readlink
|
||||
from django.shortcuts import render
|
||||
from django.http import HttpResponseRedirect
|
||||
|
@ -2514,6 +2515,127 @@ def transmonth(request):
|
|||
context = {'transactions': transactions, 'dates': dates, 'maximum': maximum, 'now_transactions': now_transactions, 'pricexmr': pricexmr}
|
||||
return render(request, 'monerojnet/transmonth.html', context)
|
||||
|
||||
def deviation(request):
|
||||
dt = datetime.datetime.now(timezone.utc).timestamp()
|
||||
symbol = 'xmr'
|
||||
pricexmr = []
|
||||
dates = []
|
||||
|
||||
coins = Coin.objects.order_by('date').filter(name=symbol)
|
||||
for coin in coins:
|
||||
if coin.priceusd > 0.001:
|
||||
pricexmr.append(coin.priceusd)
|
||||
else:
|
||||
pricexmr.append(0.20)
|
||||
|
||||
coin.date = datetime.datetime.strftime(coin.date, '%Y-%m-%d')
|
||||
dates.append(coin.date)
|
||||
|
||||
n = 180
|
||||
median_long_price = pd.Series(pricexmr).rolling(window=n).mean().iloc[n-1:].values
|
||||
m_long_price = []
|
||||
for i in range(n):
|
||||
m_long_price.append(0)
|
||||
for item in median_long_price:
|
||||
m_long_price.append(float(item))
|
||||
|
||||
n = 3
|
||||
median_short_price = pd.Series(pricexmr).rolling(window=n).mean().iloc[n-1:].values
|
||||
m_short_price = []
|
||||
for i in range(n):
|
||||
m_short_price.append(0)
|
||||
for item in median_short_price:
|
||||
m_short_price.append(float(item))
|
||||
|
||||
deviation_percentage = []
|
||||
deviation_price = []
|
||||
for count in range(0, len(m_short_price)):
|
||||
if float(m_long_price[count]) < 0.001:
|
||||
deviation_price.append('')
|
||||
deviation_percentage.append('')
|
||||
else:
|
||||
deviation_price.append((float(m_short_price[count])-float(m_long_price[count]))/(1))
|
||||
deviation_percentage.append(100*(float(m_short_price[count])-float(m_long_price[count]))/(float(m_long_price[count])))
|
||||
|
||||
dt = 'deviation.html ' + locale.format('%.2f', datetime.datetime.now(timezone.utc).timestamp() - dt, grouping=True)+' seconds'
|
||||
print(dt)
|
||||
context = {'deviation_percentage': deviation_percentage, 'deviation_price': deviation_price, 'dates': dates, 'pricexmr': pricexmr}
|
||||
return render(request, 'monerojnet/deviation.html', context)
|
||||
|
||||
def deviation_tx(request):
|
||||
dt = datetime.datetime.now(timezone.utc).timestamp()
|
||||
symbol = 'xmr'
|
||||
transactions = []
|
||||
pricexmr = []
|
||||
dates = []
|
||||
now_transactions = 0
|
||||
maximum = 0
|
||||
|
||||
coins = Coin.objects.order_by('date').filter(name=symbol)
|
||||
for coin in coins:
|
||||
transactions.append(coin.transactions)
|
||||
now_transactions = coin.transactions
|
||||
if now_transactions > maximum:
|
||||
maximum = now_transactions
|
||||
|
||||
if coin.priceusd > 0.001:
|
||||
pricexmr.append(coin.priceusd)
|
||||
else:
|
||||
pricexmr.append(0.20)
|
||||
|
||||
coin.date = datetime.datetime.strftime(coin.date, '%Y-%m-%d')
|
||||
dates.append(coin.date)
|
||||
|
||||
now_transactions = int(now_transactions)
|
||||
maximum = int(maximum)
|
||||
|
||||
n = 180
|
||||
median_long = pd.Series(transactions).rolling(window=n).mean().iloc[n-1:].values
|
||||
m_long = []
|
||||
for i in range(n):
|
||||
m_long.append(0)
|
||||
for item in median_long:
|
||||
m_long.append(float(item))
|
||||
|
||||
n = 1
|
||||
median_short = pd.Series(transactions).rolling(window=n).mean().iloc[n-1:].values
|
||||
m_short = []
|
||||
for i in range(n):
|
||||
m_short.append(0)
|
||||
for item in median_short:
|
||||
m_short.append(float(item))
|
||||
|
||||
n = 180
|
||||
median_long_price = pd.Series(pricexmr).rolling(window=n).mean().iloc[n-1:].values
|
||||
m_long_price = []
|
||||
for i in range(n):
|
||||
m_long_price.append(0)
|
||||
for item in median_long_price:
|
||||
m_long_price.append(float(item))
|
||||
|
||||
n = 3
|
||||
median_short_price = pd.Series(pricexmr).rolling(window=n).mean().iloc[n-1:].values
|
||||
m_short_price = []
|
||||
for i in range(n):
|
||||
m_short_price.append(0)
|
||||
for item in median_short_price:
|
||||
m_short_price.append(float(item))
|
||||
|
||||
deviation_percentage = []
|
||||
deviation_price = []
|
||||
for count in range(0, len(m_short)):
|
||||
if float(m_long[count]) < 0.001 or float(m_long_price[count]) < 0.001:
|
||||
deviation_price.append('')
|
||||
deviation_percentage.append('')
|
||||
else:
|
||||
deviation_price.append((float(m_short_price[count])-float(m_long_price[count]))/(1))
|
||||
deviation_percentage.append(100*(float(m_short_price[count])-float(m_long_price[count]))/(float(m_long_price[count])))
|
||||
|
||||
dt = 'deviation_tx.html ' + locale.format('%.2f', datetime.datetime.now(timezone.utc).timestamp() - dt, grouping=True)+' seconds'
|
||||
print(dt)
|
||||
context = {'m_long_price': m_long_price, 'deviation_percentage': deviation_percentage, 'deviation_price': deviation_price, 'transactions': transactions, 'dates': dates, 'maximum': maximum, 'now_transactions': now_transactions, 'pricexmr': pricexmr}
|
||||
return render(request, 'monerojnet/deviation_tx.html', context)
|
||||
|
||||
def percentage(request):
|
||||
dt = datetime.datetime.now(timezone.utc).timestamp()
|
||||
data = DailyData.objects.order_by('date')
|
||||
|
@ -3239,9 +3361,6 @@ def sfmodel(request):
|
|||
|
||||
update = True
|
||||
symbol = 'xmr'
|
||||
coins = Coin.objects.filter(name=symbol).order_by('date')
|
||||
for coin in coins:
|
||||
print(coin.date)
|
||||
|
||||
today = datetime.datetime.strftime(date.today(), '%Y-%m-%d')
|
||||
yesterday = date.today() - timedelta(1)
|
||||
|
|
Loading…
Reference in a new issue