three new charts - marketcap

This commit is contained in:
anon 2022-06-12 11:56:20 -03:00
parent 3477e3d024
commit 1e2a00e8c1
7 changed files with 1282 additions and 23 deletions

View file

@ -138,16 +138,19 @@
<li class="nav-item">
<a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapseMarketcap"
aria-expanded="true" aria-controls="collapseMarketcap">
<i class="fas fa-dollar-sign"></i>
<span>Marketcap (3)</span>
<i class="fas fa-award"></i>
<span>Marketcap (6)</span>
</a>
<div id="collapseMarketcap" class="collapse" aria-labelledby="headingMarketcap"
data-parent="#accordionSidebar">
<div class="py-2 collapse-inner rounded">
<h6 class="collapse-header text-dark">Charts:</h6>
<a class="collapse-item" href="{% url 'monerojnet:dominance' %}">Dominance</a>
<a class="collapse-item" href="{% url 'monerojnet:rank' %}">Coinmarketcap Rank</a>
<a class="collapse-item" href="{% url 'monerojnet:marketcap' %}">Marketcap</a>
<a class="collapse-item" href="{% url 'monerojnet:dominance' %}">Monero's Dominance</a>
<a class="collapse-item" href="{% url 'monerojnet:monerodominance' %}">Monero Privacy Dominance</a>
<a class="collapse-item" href="{% url 'monerojnet:privacydominance' %}">Total Privacy Dominance</a>
<a class="collapse-item" href="{% url 'monerojnet:rank' %}">Monero's CMC Rank</a>
<a class="collapse-item" href="{% url 'monerojnet:marketcap' %}">Privacy Coins' Marketcap</a>
<a class="collapse-item" href="{% url 'monerojnet:privacymarketcap' %}">Total Privacy Marketcap</a>
</div>
</div>
</li>

View file

@ -0,0 +1,316 @@
{% 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">Monero's Dominance Over Other 'Privacy' Coins (%)</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">
<!-- 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="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-info text-uppercase mb-1">
Current Dominance</div>
<div class="h5 mb-0 font-weight-bold text-gray-800">{{ now_dominance }}</div>
</div>
<div class="col-auto">
<i class="fas fa-check fa-2x text-gray-300"></i>
</div>
</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="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-info text-uppercase mb-1">
Highest Dominance</div>
<div class="h5 mb-0 font-weight-bold text-gray-800">{{ top_dominance }}</div>
</div>
<div class="col-auto">
<i class="fa fa-rocket fa-2x text-gray-300"></i>
</div>
</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">
<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">&times;</span>
</button>
</div>
<div class="modal-body">
This chart shows Monero's dominance over the privacy cryptocurrency market, judging by total marketcap value 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 data1 = {
type: "scatter",
mode: "lines",
name: 'Price',
x: {{ dates|safe }},
y: {{ xmr_dominance|safe }},
line: {
color: '#dd1d1d'
,width: 3
}
};
var data1_mobile = {
type: "scatter",
mode: "lines",
name: 'Price',
x: {{ dates|safe }},
y: {{ xmr_dominance|safe }},
line: {
color: '#dd1d1d'
,width: 3
}
};
var data = [data1];
var data_mobile = [data1_mobile];
var layout = {
plot_bgcolor:"#252221",
paper_bgcolor:"#252221",
annotations: [
{
xref: 'paper',
yref: 'paper',
x: 0.50,
xanchor: 'auto',
y: 0.02,
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: 'Dominance (%)',
font: {
size: 20,
color: 'white'
}
},
tickformat :",.1f"
,nticks: 8
,tickfont: {
color: "#ffffff"
,size: 12
}
,gridcolor: "#333333"
},
xaxis: {
hoverformat: "%Y-%m-%d",
showgrid: true,
type: 'date',
nticks: 10
,tickfont: {
color: "#dddddd"
,size: 13
}
,gridcolor: "#333333"
,range: ['2014-05-01', '2023-08-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 :",.1f"
,nticks: 8
,tickfont: {
color: "#ffffff"
,size: 7
}
,gridcolor: "#444444"
},
xaxis: {
hoverformat: "%Y",
showgrid: true,
type: 'date',
nticks: 10
,tickfont: {
color: "#dddddd"
,size: 7
}
,gridcolor: "#444444"
,range: ['2014-05-01', '2023-08-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 %}

View file

@ -0,0 +1,368 @@
{% 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">Total Dominance of Privacy Coins Over the Cryptocurrency Market (%)</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 pb-0 pt-0 pl-0 pr-0" style="height: 100px;">
<div id="graph" style="height: 100%; width:100%;"></div>
</div>
</div>
<br>
</div>
</div>
<!-- Content Row -->
<div class="row">
<!-- Earnings (Monthly) Card Example -->
<div class="col-xl-3 col-md-6 mb-4">
<div class="card border-left-new h-100 py-2">
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-info text-uppercase mb-1">
Latest Privacy Marketcap</div>
<div class="h5 mb-0 font-weight-bold text-gray-800">{{ now_marketcap }}</div>
</div>
<div class="col-auto">
<i class="fas fa-check fa-2x text-gray-300"></i>
</div>
</div>
</div>
</div>
</div>
<!-- Earnings (Monthly) Card Example -->
<div class="col-xl-3 col-md-6 mb-4">
<div class="card border-left-new h-100 py-2">
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-info text-uppercase mb-1">
Highest Privacy Marketcap</div>
<div class="h5 mb-0 font-weight-bold text-gray-800">{{ top_marketcap }}</div>
</div>
<div class="col-auto">
<i class="fas fa-rocket fa-2x text-gray-300"></i>
</div>
</div>
</div>
</div>
</div>
<!-- Earnings (Monthly) Card Example -->
<div class="col-xl-3 col-md-6 mb-4">
<div class="card border-left-new h-100 py-2">
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-info text-uppercase mb-1">
Latest Privacy Dominance</div>
<div class="h5 mb-0 font-weight-bold text-gray-800">{{ now_dominance }}</div>
</div>
<div class="col-auto">
<i class="fas fa-check fa-2x text-gray-300"></i>
</div>
</div>
</div>
</div>
</div>
<!-- Earnings (Monthly) Card Example -->
<div class="col-xl-3 col-md-6 mb-4">
<div class="card border-left-new h-100 py-2">
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-info text-uppercase mb-1">
Top Privacy Dominance</div>
<div class="h5 mb-0 font-weight-bold text-gray-800">{{ top_dominance }}</div>
</div>
<div class="col-auto">
<i class="fas fa-rocket fa-2x text-gray-300"></i>
</div>
</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">
<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">&times;</span>
</button>
</div>
<div class="modal-body">
This chart shows the total marketcap of the most important privacy coins combined and its dominance.<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: 'Privacy Dominance',
x: {{ dates|safe }},
y: {{ dominances|safe }},
line: {
color: '#dd1d1d'
,width: 3
}
};
var data3_mobile = {
type: "scatter",
mode: "lines",
name: 'Privacy Dominance',
x: {{ dates|safe }},
y: {{ dominances|safe }},
line: {
color: '#dd1d1d'
,width: 3
}
};
var data = [data3];
var data_mobile = [data3_mobile];
var layout = {
plot_bgcolor:"#252221",
paper_bgcolor:"#252221",
annotations: [
{
xref: 'paper',
yref: 'paper',
x: 0.50,
xanchor: 'auto',
y: 0.02,
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.98,
y: 0.02,
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: 'Privacy Dominance (%)',
font: {
size: 20,
color: 'white'
}
},
tickformat :",.2f"
,nticks: 10
,tickfont: {
color: "#ffffff"
,size: 12
}
,gridcolor: "#333333"
},
yaxis2: {
type: "log",
title: {
text: 'Dominance (%)',
font: {
size: 20,
color: 'white'
}
},
tickformat :",.2f"
,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-04-14', '2024-01-01']
,zeroline: true
},
margin: {
l: 120,
r: 60,
b: 35,
t: 10,
pad: 4
}
};
var layout_mobile = {
plot_bgcolor:"black",
paper_bgcolor:"black",
separators: ",.",
hoverlabel: {
namelength: -1
},
legend: {
x: 0.98,
y: 0.05,
bgcolor: '#000000',
bordercolor: '#5f5f5f',
borderwidth: 1,
font: {
color: 'white',
size: 5
},
traceorder: 'normal',
xanchor: 'auto',
yanchor: 'auto'
},
showlegend: false,
yaxis: {
type: "log",
tickformat :",.2f"
,nticks: 10
,tickfont: {
color: "#ffffff"
,size: 7
}
,gridcolor: "#444444"
},
xaxis: {
hoverformat: "%Y-%m-%d",
showgrid: true,
type: 'date',
nticks: 10
,tickfont: {
color: "#dddddd"
,size: 13
}
,gridcolor: "#333333"
,range: ['2014-04-14', '2024-01-01']
,zeroline: true
},
margin: {
l: 40,
r: 0,
b: 35,
t: 10,
pad: 0
}
};
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 %}

View file

@ -0,0 +1,374 @@
{% 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">Total Marketcap of Privacy Coins (USD)</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 pb-0 pt-0 pl-0 pr-0" style="height: 100px;">
<div id="graph" style="height: 100%; width:100%;"></div>
</div>
</div>
<br>
</div>
</div>
<!-- Content Row -->
<div class="row">
<!-- Earnings (Monthly) Card Example -->
<div class="col-xl-3 col-md-6 mb-4">
<div class="card border-left-new h-100 py-2">
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-info text-uppercase mb-1">
Latest Privacy Marketcap</div>
<div class="h5 mb-0 font-weight-bold text-gray-800">{{ now_marketcap }}</div>
</div>
<div class="col-auto">
<i class="fas fa-check fa-2x text-gray-300"></i>
</div>
</div>
</div>
</div>
</div>
<!-- Earnings (Monthly) Card Example -->
<div class="col-xl-3 col-md-6 mb-4">
<div class="card border-left-new h-100 py-2">
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-info text-uppercase mb-1">
Highest Privacy Marketcap</div>
<div class="h5 mb-0 font-weight-bold text-gray-800">{{ top_marketcap }}</div>
</div>
<div class="col-auto">
<i class="fas fa-rocket fa-2x text-gray-300"></i>
</div>
</div>
</div>
</div>
</div>
<!-- Earnings (Monthly) Card Example -->
<div class="col-xl-3 col-md-6 mb-4">
<div class="card border-left-new h-100 py-2">
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-info text-uppercase mb-1">
Latest Privacy Dominance</div>
<div class="h5 mb-0 font-weight-bold text-gray-800">{{ now_dominance }}</div>
</div>
<div class="col-auto">
<i class="fas fa-rocket fa-2x text-gray-300"></i>
</div>
</div>
</div>
</div>
</div>
<!-- Earnings (Monthly) Card Example -->
<div class="col-xl-3 col-md-6 mb-4">
<div class="card border-left-new h-100 py-2">
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-info text-uppercase mb-1">
Top Privacy Dominance</div>
<div class="h5 mb-0 font-weight-bold text-gray-800">{{ top_dominance }}</div>
</div>
<div class="col-auto">
<i class="fas fa-check fa-2x text-gray-300"></i>
</div>
</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">
<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">&times;</span>
</button>
</div>
<div class="modal-body">
This chart shows the total marketcap of the most important privacy coins compared to Monero's Marketcap.<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: 'Monero Marketcap',
x: {{ dates|safe }},
y: {{ xmr_marketcaps|safe }},
line: {
color: '#555555'
,width: 1
},
};
var data3_mobile = {
type: "scatter",
mode: "lines",
name: 'Monero Marketcap',
x: {{ dates|safe }},
y: {{ xmr_marketcaps|safe }},
line: {
color: '#555555'
,width: 1
},
};
var data2 = {
type: "scatter",
mode: "lines",
name: 'Total Privacy Marketcap',
x: {{ dates|safe }},
y: {{ marketcaps|safe }},
line: {
color: '#dd1d1d'
,width: 3
},
};
var data2_mobile = {
type: "scatter",
mode: "lines",
name: 'Total Privacy Marketcap',
x: {{ dates|safe }},
y: {{ marketcaps|safe }},
line: {
color: '#dd1d1d'
,width: 3
},
};
var data = [data3, data2];
var data_mobile = [data3_mobile, data2_mobile];
var layout = {
plot_bgcolor:"#252221",
paper_bgcolor:"#252221",
annotations: [
{
xref: 'paper',
yref: 'paper',
x: 0.50,
xanchor: 'auto',
y: 0.02,
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.98,
y: 0.02,
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: 'Marketcap (USD)',
font: {
size: 20,
color: 'white'
}
},
tickformat :",.0f"
,nticks: 10
,tickfont: {
color: "#ffffff"
,size: 12
}
,gridcolor: "#333333"
},
xaxis: {
hoverformat: "%Y-%m-%d",
showgrid: true,
type: 'date',
nticks: 10
,tickfont: {
color: "#dddddd"
,size: 13
}
,gridcolor: "#333333"
,range: ['2014-04-14', '2024-01-01']
,zeroline: true
},
margin: {
l: 120,
r: 60,
b: 35,
t: 10,
pad: 4
}
};
var layout_mobile = {
plot_bgcolor:"black",
paper_bgcolor:"black",
separators: ",.",
hoverlabel: {
namelength: -1
},
legend: {
x: 0.98,
y: 0.05,
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"
},
xaxis: {
hoverformat: "%Y-%m-%d",
showgrid: true,
type: 'date',
nticks: 10
,tickfont: {
color: "#dddddd"
,size: 13
}
,gridcolor: "#333333"
,range: ['2014-04-14', '2024-01-01']
,zeroline: true
},
margin: {
l: 40,
r: 0,
b: 35,
t: 10,
pad: 0
}
};
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 %}

View file

@ -14,7 +14,7 @@
<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">Coinmarketcap Rank</h6>
<h6 class="m-0 text-light">Monero's Coinmarketcap Rank</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button"
onclick="$('#graph1').toggleClass('fullscreen');window.dispatchEvent(new Event('resize'));">

View file

@ -71,6 +71,9 @@ urlpatterns = [
path('artigos/', views.artigos, name='artigos'),
path('articles/', views.articles, name='articles'),
path('tail_emission/', views.tail_emission, name='tail_emission'),
path('privacymarketcap/', views.privacymarketcap, name='privacymarketcap'),
path('privacydominance/', views.privacydominance, name='privacydominance'),
path('monerodominance/', views.monerodominance, name='monerodominance'),
# URLs to useful functions on monerojnet/views.py
# Only admins can use these
@ -81,6 +84,7 @@ urlpatterns = [
path('populate_database/', views.populate_database, name='populate_database'),
path('importer/', views.importer, name='importer'),
path('reset/<str:symbol>/', views.reset, name='reset'),
path('update/<str:date_from>/<str:date_to>/', views.update_database_admin, name='update'),
# URLs to old functions in case they need to be restablished
# Everyone can use these, but they are hidden

View file

@ -643,6 +643,17 @@ def populate_database(request):
context = {'message': message}
return render(request, 'monerojnet/maintenance.html', context)
# Update database with between certain dates
# Only authorized users can do this
@login_required
def update_database_admin(request, date_from, date_to):
update_database(date_from, date_to)
message = 'Database updated from ' + str(date_from) + ' to ' + str(date_to)
context = {'message': message}
return render(request, 'monerojnet/maintenance.html', context)
###########################################
# Other useful functions
###########################################
@ -738,7 +749,7 @@ def get_latest_price():
with open("settings.json") as file:
data = json.load(file)
url = data["metrics_provider"][0]["price_url"]
url = data["metrics_provider"][0]["price_url_old"]
parameters = {
'convert':'USD',
}
@ -754,6 +765,7 @@ def get_latest_price():
response = session.get(url, params=parameters)
data = json.loads(response.text)
print('getting latest data')
print(data)
try:
if data['data']['XMR']['cmc_rank']:
print('new data received')
@ -772,7 +784,7 @@ def get_latest_price():
# Get latest dominance value and update
def update_dominance(data):
if not(data):
#print('error updating dominance')
print('error updating dominance')
return False
else:
dominance = Dominance()
@ -796,8 +808,9 @@ def update_dominance(data):
wks.update_value(cell, dominance.dominance)
cell = 'A' + str(k + 3)
wks.update_value(cell, dominance.date)
print('spreadsheet updated')
else:
#print('spreadsheet with the latest data already')
print('spreadsheet already with the latest data')
return False
#print('updated')
@ -807,6 +820,7 @@ def update_dominance(data):
def update_rank():
data = get_latest_price()
if not(data):
print('error updating rank')
return False
else:
rank = Rank()
@ -830,9 +844,9 @@ def update_rank():
wks.update_value(cell, rank.rank)
cell = 'A' + str(k + 3)
wks.update_value(cell, rank.date)
#print('spreadsheet updated')
print('spreadsheet updated')
else:
#print('spreadsheet with the latest data already')
print('spreadsheet already with the latest data')
return data
#print('updated')
@ -876,14 +890,18 @@ def check_new_social(symbol):
return True
# Update database DailyData with most recent coin data
def update_database(date_request=None):
if not(date_request):
date_request = date.today()
def update_database(date_from=None, date_to=None):
if not(date_from) or not(date_to):
date_to = date.today()
date_from = date_to - timedelta(5)
else:
date_request = datetime.datetime.strptime(date_request, '%Y-%m-%d')
date_from = datetime.datetime.strptime(date_from, '%Y-%m-%d')
date_to = datetime.datetime.strptime(date_to, '%Y-%m-%d')
for count in range(5, 0, -1):
date_aux = date_request - timedelta(count)
count = 0
date_aux = date_from
while date_aux < date_to:
date_aux = date_from + timedelta(count)
date_aux2 = date_aux - timedelta(1)
print('updating data for ' + str(date_aux))
try:
@ -921,13 +939,10 @@ def update_database(date_request=None):
data.greyline = 0
data.color = 0
data.date = coin_xmr.date
if data.pricebtc == 0:
data.pricebtc = coin_xmr.pricebtc
if data.priceusd == 0:
data.priceusd = coin_xmr.priceusd
if data.stocktoflow == 0:
supply = int(coin_xmr.supply)*10**12
reward = (2**64 -1 - supply) >> 19
@ -935,12 +950,10 @@ def update_database(date_request=None):
reward = 0.6*(10**12)
inflation = 100*reward*720*365/supply
data.stocktoflow = (100/(inflation))**1.65
if data.color == 0:
v0 = 0.002
delta = (0.015 - 0.002)/(6*365)
data.color = 30*coin_xmr.pricebtc/(int(coin_xmr.id)*delta + v0)
data.save()
try:
@ -1087,6 +1100,7 @@ def update_database(date_request=None):
data.save()
except:
return count
count += 1
return count
@ -4086,6 +4100,186 @@ def tail_emission(request):
context = {'inflationxmr': inflationxmr, 'finflationxmr': finflationxmr, 'now_xmr': now_xmr, 'dates': dates}
return render(request, 'monerojnet/tail_emission.html', context)
def privacymarketcap(request):
dt = datetime.datetime.now(timezone.utc).timestamp()
data = DailyData.objects.order_by('date')
dates = []
marketcaps = []
xmr_marketcaps = []
now_marketcap = 0
now_dominance = 0
top_marketcap = 0
top_dominance = 0
for item in data:
marketcap = 0
dominance = 0
dates.append(datetime.datetime.strftime(item.date, '%Y-%m-%d'))
if item.zcash_marketcap > 1000000:
marketcap += item.zcash_marketcap
if item.dash_marketcap > 1000000:
marketcap += item.dash_marketcap
if item.grin_marketcap > 1000000:
marketcap += item.grin_marketcap
if item.xmr_marketcap > 1000000:
marketcap += item.xmr_marketcap
try:
xmr_dominance = Dominance.objects.get(date=item.date)
dominance = marketcap*xmr_dominance.dominance/item.xmr_marketcap
except:
dominance = 0
xmr_marketcaps.append(item.xmr_marketcap)
else:
xmr_marketcaps.append('')
now_marketcap = marketcap
now_dominance = dominance
if now_marketcap > top_marketcap:
top_marketcap = now_marketcap
if now_dominance > top_dominance:
top_dominance = now_dominance
if marketcap > 3000000:
marketcaps.append(marketcap)
else:
marketcaps.append('')
now_marketcap = '$'+locale.format('%.0f', now_marketcap, grouping=True)
now_dominance = locale.format('%.2f', now_dominance, grouping=True) + '%'
top_marketcap = '$'+locale.format('%.0f', top_marketcap, grouping=True)
top_dominance = locale.format('%.2f', top_dominance, grouping=True) + '%'
dt = 'privacymarketcap.html ' + locale.format('%.2f', datetime.datetime.now(timezone.utc).timestamp() - dt, grouping=True)+' seconds'
print(dt)
context = {'marketcaps': marketcaps, 'now_marketcap': now_marketcap, 'now_dominance': now_dominance, 'top_marketcap': top_marketcap, 'top_dominance': top_dominance, 'dates': dates, 'xmr_marketcaps': xmr_marketcaps}
return render(request, 'monerojnet/privacymarketcap.html', context)
def privacydominance(request):
dt = datetime.datetime.now(timezone.utc).timestamp()
data = DailyData.objects.order_by('date')
dates = []
marketcaps = []
dominances = []
now_marketcap = 0
now_dominance = 0
top_marketcap = 0
top_dominance = 0
for item in data:
marketcap = 0
dominance = 0
dates.append(datetime.datetime.strftime(item.date, '%Y-%m-%d'))
if item.zcash_marketcap > 1000000:
marketcap += item.zcash_marketcap
if item.dash_marketcap > 1000000:
marketcap += item.dash_marketcap
if item.grin_marketcap > 1000000:
marketcap += item.grin_marketcap
if item.xmr_marketcap > 1000000:
marketcap += item.xmr_marketcap
print(item.date)
try:
xmr_dominance = Dominance.objects.get(date=item.date)
dominance = marketcap*xmr_dominance.dominance/item.xmr_marketcap
except:
dominance = 0
now_marketcap = marketcap
now_dominance = dominance
if now_marketcap > top_marketcap:
top_marketcap = now_marketcap
if now_dominance > top_dominance:
top_dominance = now_dominance
if marketcap > 3000000:
marketcaps.append(marketcap)
else:
marketcaps.append('')
if dominance > 0:
dominances.append(dominance)
else:
dominances.append('')
now_marketcap = '$'+locale.format('%.0f', now_marketcap, grouping=True)
now_dominance = locale.format('%.2f', now_dominance, grouping=True) + '%'
top_marketcap = '$'+locale.format('%.0f', top_marketcap, grouping=True)
top_dominance = locale.format('%.2f', top_dominance, grouping=True) + '%'
dt = 'privacymarketcap.html ' + locale.format('%.2f', datetime.datetime.now(timezone.utc).timestamp() - dt, grouping=True)+' seconds'
print(dt)
context = {'marketcaps': marketcaps, 'dominances':dominances, 'now_marketcap': now_marketcap, 'now_dominance': now_dominance, 'top_marketcap': top_marketcap, 'top_dominance': top_dominance, 'dates': dates}
return render(request, 'monerojnet/privacydominance.html', context)
def monerodominance(request):
dt = datetime.datetime.now(timezone.utc).timestamp()
data = DailyData.objects.order_by('date')
dates = []
marketcaps = []
xmr_dominance = []
now_marketcap = 0
now_dominance = 0
top_marketcap = 0
top_dominance = 0
for item in data:
marketcap = 0
dominance = 0
dates.append(datetime.datetime.strftime(item.date, '%Y-%m-%d'))
if item.zcash_marketcap > 1000000:
marketcap += item.zcash_marketcap
if item.dash_marketcap > 1000000:
marketcap += item.dash_marketcap
if item.grin_marketcap > 1000000:
marketcap += item.grin_marketcap
if item.xmr_marketcap > 1000000:
marketcap += item.xmr_marketcap
print(item.date)
dominance = 100*item.xmr_marketcap/marketcap
now_marketcap = marketcap
now_dominance = dominance
if now_marketcap > top_marketcap:
top_marketcap = now_marketcap
if now_dominance > top_dominance:
top_dominance = now_dominance
if marketcap > 3000000:
marketcaps.append(marketcap)
else:
marketcaps.append('')
if dominance > 0:
xmr_dominance.append(dominance)
else:
xmr_dominance.append('')
now_marketcap = '$'+locale.format('%.0f', now_marketcap, grouping=True)
now_dominance = locale.format('%.2f', now_dominance, grouping=True) + '%'
top_marketcap = '$'+locale.format('%.0f', top_marketcap, grouping=True)
top_dominance = locale.format('%.2f', top_dominance, grouping=True) + '%'
dt = 'privacymarketcap.html ' + locale.format('%.2f', datetime.datetime.now(timezone.utc).timestamp() - dt, grouping=True)+' seconds'
print(dt)
context = {'marketcaps': marketcaps, 'xmr_dominance': xmr_dominance, 'now_marketcap': now_marketcap, 'now_dominance': now_dominance, 'top_marketcap': top_marketcap, 'top_dominance': top_dominance, 'dates': dates}
return render(request, 'monerojnet/monerodominance.html', context)
###########################################
# Previous functions / Older versions
###########################################