new charts
This commit is contained in:
parent
6d23281d03
commit
ddea71de2d
5 changed files with 797 additions and 1 deletions
|
@ -174,7 +174,7 @@
|
|||
<a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapseTransactions"
|
||||
aria-expanded="true" aria-controls="collapseTransactions">
|
||||
<i class="bx bx-transfer"></i>
|
||||
<span>Transactions (11)</span>
|
||||
<span>Transactions (13)</span>
|
||||
</a>
|
||||
<div id="collapseTransactions" class="collapse" aria-labelledby="headingTransactions"
|
||||
data-parent="#accordionSidebar">
|
||||
|
@ -189,6 +189,8 @@
|
|||
<a class="collapse-item" href="{% url 'charts:percentmonth' %}">Monthly Percentage (Lin.)</a>
|
||||
<a class="collapse-item" href="{% url 'charts:metcalfesats' %}">Metcalfe's Law (Sats)</a>
|
||||
<a class="collapse-item" href="{% url 'charts:metcalfeusd' %}">Metcalfe's Law ($)</a>
|
||||
<a class="collapse-item" href="{% url 'charts:metcalfesats_deviation' %}">Metcalfe's Deviation (Sats)</a>
|
||||
<a class="collapse-item" href="{% url 'charts:metcalfe_deviation' %}">Metcalfe's Deviation ($)</a>
|
||||
<a class="collapse-item" href="{% url 'charts:deviation_tx' %}">Transacted Price Deviation</a>
|
||||
<a class="collapse-item" href="{% url 'charts:transactiondominance' %}">Transaction Dominance</a>
|
||||
</div>
|
||||
|
|
364
charts/templates/charts/metcalfe_deviation.html
Normal file
364
charts/templates/charts/metcalfe_deviation.html
Normal file
|
@ -0,0 +1,364 @@
|
|||
{% extends 'charts/base.html' %}
|
||||
|
||||
{% block header %}
|
||||
<title>Moneroj.net - Transaction Count</title>
|
||||
{% endblock %}
|
||||
|
||||
{% 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">Metcalfe's Model Deviation (linear chart, percentage and dollars)</h6>
|
||||
<div class="dropdown no-arrow">
|
||||
<a class="dropdown-toggle" href="#" role="button"
|
||||
onclick="$('#graph1').toggleClass('fullscreen');window.dispatchEvent(new Event('resize'));">
|
||||
<i class="bx bx-expand 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">
|
||||
|
||||
<!-- Earnings (Monthly) Card Example -->
|
||||
<div class="col-xl-6 col-md-6 mb-4">
|
||||
<div class="card border-left-new h-100 py-2">
|
||||
<div class="card-body">
|
||||
<div class="text-xs font-weight-bold text-info text-uppercase mb-1">
|
||||
Metcalfe's Model Deviation</div>
|
||||
<div class="h5 mb-0 font-weight-bold text-gray-800">$ {{ now_metcalfe }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Earnings (Monthly) Card Example -->
|
||||
<div class="col-xl-6 col-md-6 mb-4">
|
||||
<div class="card border-left-new h-100 py-2">
|
||||
<div class="card-body">
|
||||
<div class="text-xs font-weight-bold text-info text-uppercase mb-1">
|
||||
Metcalfe's Model Deviation</div>
|
||||
<div class="h5 mb-0 font-weight-bold text-gray-800">{{ now_metcalfe_percentage }} %</div>
|
||||
</div>
|
||||
</div>
|
||||
</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">
|
||||
+
|
||||
</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 diference between current XMR price (Dollar pair) and its supposed value considering its Metcalfe's Model.
|
||||
It shows both the absolute difference (Model Price minus Real Price) and the percentage difference (Model Price/Real Price minus 1)x100.<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: 'Model Deviation (BTC)',
|
||||
x: {{ dates|safe }},
|
||||
y: {{ metcalfe|safe }},
|
||||
line: {
|
||||
color: '#dd1d1d'
|
||||
,width: 2
|
||||
},
|
||||
yaxis: "y2"
|
||||
};
|
||||
|
||||
var data3_mobile = {
|
||||
type: "scatter",
|
||||
mode: "lines",
|
||||
name: 'Model Deviation (BTC)',
|
||||
x: {{ dates|safe }},
|
||||
y: {{ metcalfe|safe }},
|
||||
line: {
|
||||
color: '#dd1d1d'
|
||||
,width: 2
|
||||
},
|
||||
yaxis: "y2"
|
||||
};
|
||||
var data1 = {
|
||||
type: "scatter",
|
||||
mode: "lines",
|
||||
name: 'Model Deviation (%)',
|
||||
x: {{ dates|safe }},
|
||||
y: {{ metcalfe_percentage|safe }},
|
||||
line: {
|
||||
color: '#444444'
|
||||
,width: 2
|
||||
}
|
||||
};
|
||||
|
||||
var data1_mobile = {
|
||||
type: "scatter",
|
||||
mode: "lines",
|
||||
name: 'Model Deviation (%)',
|
||||
x: {{ dates|safe }},
|
||||
y: {{ metcalfe_percentage|safe }},
|
||||
line: {
|
||||
color: '#444444'
|
||||
,width: 2
|
||||
}
|
||||
};
|
||||
|
||||
var data = [data3, data1];
|
||||
var data_mobile = [data3_mobile, data1_mobile];
|
||||
|
||||
var layout = {
|
||||
plot_bgcolor:"#252221",
|
||||
paper_bgcolor:"#252221",
|
||||
annotations: [
|
||||
{
|
||||
xref: 'paper',
|
||||
yref: 'paper',
|
||||
x: 0.50,
|
||||
xanchor: 'auto',
|
||||
y: 0.98,
|
||||
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: "linear",
|
||||
title: {
|
||||
text: 'Percentage (%)',
|
||||
font: {
|
||||
size: 20,
|
||||
color: 'white'
|
||||
}
|
||||
},
|
||||
tickformat :",.0f"
|
||||
,nticks: 10
|
||||
,tickfont: {
|
||||
color: "#ffffff"
|
||||
,size: 12
|
||||
}
|
||||
,gridcolor: "#333333"
|
||||
},
|
||||
yaxis2: {
|
||||
type: "linear",
|
||||
title: {
|
||||
text: 'Deviation (USD)',
|
||||
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: "linear",
|
||||
tickformat :",.0f"
|
||||
,nticks: 10
|
||||
,tickfont: {
|
||||
color: "#ffffff"
|
||||
,size: 7
|
||||
}
|
||||
,gridcolor: "#444444"
|
||||
},
|
||||
yaxis2: {
|
||||
type: "linear",
|
||||
tickformat :",.0f"
|
||||
,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 %}
|
364
charts/templates/charts/metcalfesats_deviation.html
Normal file
364
charts/templates/charts/metcalfesats_deviation.html
Normal file
|
@ -0,0 +1,364 @@
|
|||
{% extends 'charts/base.html' %}
|
||||
|
||||
{% block header %}
|
||||
<title>Moneroj.net - Transaction Count</title>
|
||||
{% endblock %}
|
||||
|
||||
{% 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">Metcalfe's Model Deviation (linear chart, percentage and BTC)</h6>
|
||||
<div class="dropdown no-arrow">
|
||||
<a class="dropdown-toggle" href="#" role="button"
|
||||
onclick="$('#graph1').toggleClass('fullscreen');window.dispatchEvent(new Event('resize'));">
|
||||
<i class="bx bx-expand 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">
|
||||
|
||||
<!-- Earnings (Monthly) Card Example -->
|
||||
<div class="col-xl-6 col-md-6 mb-4">
|
||||
<div class="card border-left-new h-100 py-2">
|
||||
<div class="card-body">
|
||||
<div class="text-xs font-weight-bold text-info text-uppercase mb-1">
|
||||
Metcalfe's Model Deviation</div>
|
||||
<div class="h5 mb-0 font-weight-bold text-gray-800">{{ now_metcalfe }} BTC</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Earnings (Monthly) Card Example -->
|
||||
<div class="col-xl-6 col-md-6 mb-4">
|
||||
<div class="card border-left-new h-100 py-2">
|
||||
<div class="card-body">
|
||||
<div class="text-xs font-weight-bold text-info text-uppercase mb-1">
|
||||
Metcalfe's Model Deviation</div>
|
||||
<div class="h5 mb-0 font-weight-bold text-gray-800">{{ now_metcalfe_percentage }} %</div>
|
||||
</div>
|
||||
</div>
|
||||
</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">
|
||||
+
|
||||
</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 diference between current XMR price (BTC pair) and its supposed value considering its Metcalfe's Model.
|
||||
It shows both the absolute difference (Model Price minus Real Price) and the percentage difference (Model Price/Real Price minus 1)x100.<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: 'Model Deviation (BTC)',
|
||||
x: {{ dates|safe }},
|
||||
y: {{ metcalfe|safe }},
|
||||
line: {
|
||||
color: '#dd1d1d'
|
||||
,width: 2
|
||||
},
|
||||
yaxis: "y2"
|
||||
};
|
||||
|
||||
var data3_mobile = {
|
||||
type: "scatter",
|
||||
mode: "lines",
|
||||
name: 'Model Deviation (BTC)',
|
||||
x: {{ dates|safe }},
|
||||
y: {{ metcalfe|safe }},
|
||||
line: {
|
||||
color: '#dd1d1d'
|
||||
,width: 2
|
||||
},
|
||||
yaxis: "y2"
|
||||
};
|
||||
var data1 = {
|
||||
type: "scatter",
|
||||
mode: "lines",
|
||||
name: 'Model Deviation (%)',
|
||||
x: {{ dates|safe }},
|
||||
y: {{ metcalfe_percentage|safe }},
|
||||
line: {
|
||||
color: '#444444'
|
||||
,width: 2
|
||||
}
|
||||
};
|
||||
|
||||
var data1_mobile = {
|
||||
type: "scatter",
|
||||
mode: "lines",
|
||||
name: 'Model Deviation (%)',
|
||||
x: {{ dates|safe }},
|
||||
y: {{ metcalfe_percentage|safe }},
|
||||
line: {
|
||||
color: '#444444'
|
||||
,width: 2
|
||||
}
|
||||
};
|
||||
|
||||
var data = [data3, data1];
|
||||
var data_mobile = [data3_mobile, data1_mobile];
|
||||
|
||||
var layout = {
|
||||
plot_bgcolor:"#252221",
|
||||
paper_bgcolor:"#252221",
|
||||
annotations: [
|
||||
{
|
||||
xref: 'paper',
|
||||
yref: 'paper',
|
||||
x: 0.50,
|
||||
xanchor: 'auto',
|
||||
y: 0.98,
|
||||
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: "linear",
|
||||
title: {
|
||||
text: 'Percentage (%)',
|
||||
font: {
|
||||
size: 20,
|
||||
color: 'white'
|
||||
}
|
||||
},
|
||||
tickformat :",.0f"
|
||||
,nticks: 10
|
||||
,tickfont: {
|
||||
color: "#ffffff"
|
||||
,size: 12
|
||||
}
|
||||
,gridcolor: "#333333"
|
||||
},
|
||||
yaxis2: {
|
||||
type: "linear",
|
||||
title: {
|
||||
text: 'Deviation (BTC)',
|
||||
font: {
|
||||
size: 20,
|
||||
color: 'white'
|
||||
}
|
||||
},
|
||||
tickformat :",.4f"
|
||||
,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: "linear",
|
||||
tickformat :",.0f"
|
||||
,nticks: 10
|
||||
,tickfont: {
|
||||
color: "#ffffff"
|
||||
,size: 7
|
||||
}
|
||||
,gridcolor: "#444444"
|
||||
},
|
||||
yaxis2: {
|
||||
type: "linear",
|
||||
tickformat :",.4f"
|
||||
,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 %}
|
|
@ -88,6 +88,8 @@ urlpatterns = [
|
|||
path('p2pool_hashrate/', views.p2pool_hashrate, name='p2pool_hashrate'),
|
||||
path('p2pool_miners/', views.p2pool_miners, name='p2pool_miners'),
|
||||
path('p2pool_totalblocks/', views.p2pool_totalblocks, name='p2pool_totalblocks'),
|
||||
path('metcalfesats_deviation/', views.metcalfesats_deviation, name='metcalfesats_deviation'),
|
||||
path('metcalfe_deviation/', views.metcalfe_deviation, name='metcalfe_deviation'),
|
||||
|
||||
# URLs to useful functions on charts/views.py
|
||||
# Only admins can use these
|
||||
|
|
|
@ -3163,6 +3163,70 @@ def metcalfesats(request):
|
|||
context = {'metcalfe': metcalfe, 'dates': dates, 'maximum': maximum, 'now_metcalfe': now_metcalfe, 'color': color, 'prices': prices, 'now_price': now_price}
|
||||
return render(request, 'charts/metcalfesats.html', context)
|
||||
|
||||
def metcalfesats_deviation(request):
|
||||
if request.user.username != "Administrador" and request.user.username != "Morpheus":
|
||||
update_visitors(False)
|
||||
|
||||
dt = datetime.datetime.now(timezone.utc).timestamp()
|
||||
data = DailyData.objects.order_by('date')
|
||||
|
||||
metcalfe_percentage = []
|
||||
metcalfe = []
|
||||
dates = []
|
||||
now_metcalfe = 0
|
||||
now_metcalfe_percentage = 0
|
||||
|
||||
for item in data:
|
||||
dates.append(datetime.datetime.strftime(item.date, '%Y-%m-%d'))
|
||||
if item.xmr_metcalfebtc < 0.0007 and item.xmr_pricebtc <= 0:
|
||||
metcalfe.append('')
|
||||
metcalfe_percentage.append('')
|
||||
else:
|
||||
now_metcalfe = item.xmr_metcalfebtc - item.xmr_pricebtc
|
||||
now_metcalfe_percentage = 100*((item.xmr_metcalfebtc/item.xmr_pricebtc) - 1)
|
||||
metcalfe.append(now_metcalfe)
|
||||
metcalfe_percentage.append(now_metcalfe_percentage)
|
||||
|
||||
now_metcalfe = locale.format('%.4f', now_metcalfe, grouping=True)
|
||||
now_metcalfe_percentage = locale.format('%.0f', now_metcalfe_percentage, grouping=True)
|
||||
|
||||
dt = 'metcalfesats_deviation.html ' + locale.format('%.2f', datetime.datetime.now(timezone.utc).timestamp() - dt, grouping=True)+' seconds'
|
||||
print(dt)
|
||||
context = {'metcalfe': metcalfe, 'dates': dates, 'now_metcalfe': now_metcalfe, 'now_metcalfe_percentage': now_metcalfe_percentage, 'metcalfe_percentage': metcalfe_percentage}
|
||||
return render(request, 'charts/metcalfesats_deviation.html', context)
|
||||
|
||||
def metcalfe_deviation(request):
|
||||
if request.user.username != "Administrador" and request.user.username != "Morpheus":
|
||||
update_visitors(False)
|
||||
|
||||
dt = datetime.datetime.now(timezone.utc).timestamp()
|
||||
data = DailyData.objects.order_by('date')
|
||||
|
||||
metcalfe_percentage = []
|
||||
metcalfe = []
|
||||
dates = []
|
||||
now_metcalfe = 0
|
||||
now_metcalfe_percentage = 0
|
||||
|
||||
for item in data:
|
||||
dates.append(datetime.datetime.strftime(item.date, '%Y-%m-%d'))
|
||||
if item.xmr_metcalfeusd < 0.0007 and item.xmr_priceusd <= 0:
|
||||
metcalfe.append('')
|
||||
metcalfe_percentage.append('')
|
||||
else:
|
||||
now_metcalfe = item.xmr_metcalfeusd - item.xmr_priceusd
|
||||
now_metcalfe_percentage = 100*((item.xmr_metcalfeusd/item.xmr_priceusd) - 1)
|
||||
metcalfe.append(now_metcalfe)
|
||||
metcalfe_percentage.append(now_metcalfe_percentage)
|
||||
|
||||
now_metcalfe = locale.format('%.0f', now_metcalfe, grouping=True)
|
||||
now_metcalfe_percentage = locale.format('%.0f', now_metcalfe_percentage, grouping=True)
|
||||
|
||||
dt = 'metcalfe_deviation.html ' + locale.format('%.2f', datetime.datetime.now(timezone.utc).timestamp() - dt, grouping=True)+' seconds'
|
||||
print(dt)
|
||||
context = {'metcalfe': metcalfe, 'dates': dates, 'now_metcalfe': now_metcalfe, 'now_metcalfe_percentage': now_metcalfe_percentage, 'metcalfe_percentage': metcalfe_percentage}
|
||||
return render(request, 'charts/metcalfe_deviation.html', context)
|
||||
|
||||
def metcalfeusd(request):
|
||||
if request.user.username != "Administrador" and request.user.username != "Morpheus":
|
||||
update_visitors(False)
|
||||
|
|
Loading…
Reference in a new issue