fixing loading time for charts

This commit is contained in:
anon 2022-06-05 15:36:57 -03:00
parent a286c73fa1
commit 4d720aa64d
19 changed files with 1961 additions and 721 deletions

View file

@ -52,5 +52,45 @@ class Sfmodel(models.Model):
stocktoflow = models.FloatField()
greyline = models.FloatField()
def __str__(self):
return self.date
class DailyData(models.Model):
date = models.DateField()
btc_usd = models.FloatField()
btc_ntv = models.FloatField()
xmr_usd = models.FloatField()
xmr_ntv = models.FloatField()
xmr_transacpercentage = models.FloatField()
xmr_priceusd = models.FloatField()
xmr_pricebtc = models.FloatField()
btc_inflation = models.FloatField()
xmr_inflation = models.FloatField()
dash_inflation = models.FloatField()
grin_inflation = models.FloatField()
zcash_inflation = models.FloatField()
btc_supply = models.IntegerField()
xmr_supply = models.IntegerField()
btc_return = models.FloatField()
xmr_return = models.FloatField()
btc_minerrevntv = models.FloatField()
xmr_minerrevntv = models.FloatField()
btc_minerrevusd = models.FloatField()
xmr_minerrevusd = models.FloatField()
btc_minerfeesntv = models.FloatField()
xmr_minerfeesntv = models.FloatField()
btc_minerfeesusd = models.FloatField()
xmr_minerfeesusd = models.FloatField()
btc_transcostntv = models.FloatField()
xmr_transcostntv = models.FloatField()
btc_transcostusd = models.FloatField()
xmr_transcostusd = models.FloatField()
btc_commitntv = models.FloatField()
xmr_commitntv = models.FloatField()
btc_commitusd = models.FloatField()
xmr_commitusd = models.FloatField()
xmr_metcalfebtc = models.FloatField()
xmr_metcalfeusd = models.FloatField()
def __str__(self):
return self.date

View file

@ -124,8 +124,8 @@
Fractal</a>
<a class="collapse-item" href="{% url 'monerojnet:golden' %}">Golden Ratio Multiplier</a>
<a class="collapse-item" href="{% url 'monerojnet:competitors' %}">Performance ($)</a>
<a class="collapse-item" href="{% url 'monerojnet:competitorssats' %}">Performance (Sats, log)</a>
<a class="collapse-item" href="{% url 'monerojnet:competitorssatslin' %}">Performance (Sats, lin.)</a>
<a class="collapse-item" href="{% url 'monerojnet:competitorssats' %}">Performance (Sats, Log.)</a>
<a class="collapse-item" href="{% url 'monerojnet:competitorssatslin' %}">Performance (Sats, Lin.)</a>
<a class="collapse-item" href="{% url 'monerojnet:inflationreturn' %}">Return vs. Inflation</a>
<a class="collapse-item" href="{% url 'monerojnet:bitcoin' %}">Comparison to Bitcoin</a>
<a class="collapse-item" href="{% url 'monerojnet:powerlaw' %}">Power Law</a>
@ -177,7 +177,7 @@
<a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapseIssuance"
aria-expanded="true" aria-controls="collapseIssuance">
<i class="fas fa-chart-area"></i>
<span>Issuance (6)</span>
<span>Issuance (7)</span>
</a>
<div id="collapseIssuance" class="collapse" aria-labelledby="headingIssuance"
data-parent="#accordionSidebar">
@ -186,6 +186,7 @@
<a class="collapse-item" href="{% url 'monerojnet:coins' %}">Coins in Circulation</a>
<a class="collapse-item" href="{% url 'monerojnet:extracoins' %}">Supply Difference</a>
<a class="collapse-item" href="{% url 'monerojnet:inflation' %}">Annual Inflation</a>
<a class="collapse-item" href="{% url 'monerojnet:tail_emission' %}">Tail Emission</a>
<a class="collapse-item" href="{% url 'monerojnet:compinflation' %}">Competitors' Inflation</a>
<a class="collapse-item" href="{% url 'monerojnet:dailyemission' %}">Daily Emission ($)</a>
<a class="collapse-item" href="{% url 'monerojnet:dailyemissionntv' %}">Daily Emission (Ntv.)</a>

View file

@ -67,8 +67,6 @@
</div>
</div>
</div>
<!-- /.container-fluid -->

View file

@ -226,7 +226,7 @@
color: 'white'
}
},
tickformat :",.2f"
tickformat :",.5f"
,nticks: 10
,tickfont: {
color: "#ffffff"
@ -280,7 +280,7 @@
showlegend: false,
yaxis: {
type: "log",
tickformat :",.2f"
tickformat :",.5f"
,nticks: 10
,tickfont: {
color: "#ffffff"

View file

@ -227,7 +227,7 @@
color: 'white'
}
},
tickformat :",.2f"
tickformat :",.3f"
,nticks: 10
,tickfont: {
color: "#ffffff"
@ -281,7 +281,7 @@
showlegend: false,
yaxis: {
type: "log",
tickformat :",.2f"
tickformat :",.3f"
,nticks: 10
,tickfont: {
color: "#ffffff"

View file

@ -127,7 +127,7 @@
mode: "lines",
name: 'Monero Daily Emission',
x: {{ dates|safe }},
y: {{ costxmr|safe }},
y: {{ emissionxmr|safe }},
line: {
color: '#dd1d1d'
,width: 2
@ -139,7 +139,7 @@
mode: "lines",
name: 'Monero Daily Emission',
x: {{ dates|safe }},
y: {{ costxmr|safe }},
y: {{ emissionxmr|safe }},
line: {
color: '#dd1d1d'
,width: 2
@ -151,7 +151,7 @@
mode: "lines",
name: 'Bitcoin Daily Emission',
x: {{ dates|safe }},
y: {{ costbtc|safe }},
y: {{ emissionbtc|safe }},
line: {
color: '#ffd311'
,width: 2
@ -163,7 +163,7 @@
mode: "lines",
name: 'Bitcoin Daily Emission',
x: {{ dates|safe }},
y: {{ costbtc|safe }},
y: {{ emissionxmr|safe }},
line: {
color: '#ffd311'
,width: 2

View file

@ -318,9 +318,7 @@
<p class="description">Monero
est la pointe de la lance en matière d'intimité. Sa technologie de
pointe en a fait le choix optimal pour la plupart des pirates
informatiques. Il existe une loi économique qui dit
les gens préfèrent se débarrasser du mauvais argent
et détenir le meilleur argent. C'est ce à quoi nous assistons, Bitcoin
informatiques. C'est ce à quoi nous assistons, Bitcoin
est abandonné au profit de Monero,
la seule véritable option de confidentialité.
</p>

View file

@ -238,8 +238,7 @@
<div class="icon-box">
<div class="icon"><i class="fab fa-monero"></i></div>
<h4 class="title"><a href="https://analyticsindiamag.com/monero-cryptocurrency-hackers/" target="_blank">Hackers prefer Monero over Bitcoin</a></h4>
<p class="description">Monero is the tip of the spear in privacy. Its cutting edge technology made it the optimal choice for most hackers. There is an economics law that states
people prefer to get rid of bad money and hold the best money. That's what we are witnessing, Bitcoin is being abandoned in favour of Monero,
<p class="description">Monero is the tip of the spear in privacy. Its cutting edge technology made it the optimal choice for most hackers. That's what we are witnessing, Bitcoin is being abandoned in favour of Monero,
the only true privacy option.
</p>
</div>

View file

@ -241,7 +241,7 @@
,size: 13
}
,gridcolor: "#333333"
,range: ['2010-06-14', '2024-01-01']
,range: ['2011-02-14', '2024-01-01']
,zeroline: true
},
margin: {
@ -295,7 +295,7 @@
,size: 7
}
,gridcolor: "#444444"
,range: ['2010-06-14', '2024-01-01']
,range: ['2011-02-14', '2024-01-01']
,zeroline: true
},
margin: {

View file

@ -185,7 +185,7 @@
var data2 = {
type: "scatter",
mode: "lines",
name: 'Buy Zone',
name: 'Neutral Line',
x: {{ counter|safe }},
y: {{ line2|safe }},
line: {
@ -198,7 +198,7 @@
var data2_mobile = {
type: "scatter",
mode: "lines",
name: 'Buy Zone',
name: 'Neutral Line',
x: {{ counter|safe }},
y: {{ line2|safe }},
line: {
@ -414,18 +414,25 @@ var layout_mobile = {
,gridcolor: "#444444"
},
xaxis: {
hoverformat: "%Y",
showgrid: true,
type: 'date',
nticks: 10
,tickfont: {
color: "#dddddd"
,size: 7
type: "log",
title: {
text: 'Year',
font: {
family: 'Nunito, monospace',
size: 14,
color: '#7f7f7f'
}
,gridcolor: "#444444"
,range: ['2009-12-20', '2026-01-10']
,zeroline: true
},
nticks: 20,
tickvals: {{ dates|safe }},
ticktext: {{ years|safe }},
showgrid: true,
gridcolor: "#444444",
tickfont: {
color: "#dddddd"
,size: 13
},
},
margin: {
l: 40,
r: 0,

View file

@ -245,7 +245,6 @@
<div class="icon"><i class="fab fa-monero"></i></div>
<h4 class="title"><a href="https://analyticsindiamag.com/monero-cryptocurrency-hackers/" target="_blank">Hackers preferem Monero a Bitcoin</a></h4>
<p class="description">Monero é a ponta da lança em privacidade. Sua tecnologia de o tornou a escolha ideal para a maioria dos hackers.
Existe uma lei econômica que diz que as pessoas preferem se livrar do dinheiro ruim e ficar com o melhor dinheiro.
Isso é o que estamos testemunhando, o Bitcoin está sendo abandonado em favor do Monero, a única opção de privacidade verdadeira.
</p>
</div>

View file

@ -127,7 +127,7 @@
var data1 = {
type: "scatter",
mode: "lines",
name: 'Buy',
name: 'Oversold',
x: {{ dates|safe }},
y: {{ buy|safe }},
line: {
@ -139,7 +139,7 @@
var data1_mobile = {
type: "scatter",
mode: "lines",
name: 'Buy',
name: 'Oversold',
x: {{ dates|safe }},
y: {{ buy|safe }},
line: {
@ -151,7 +151,7 @@
var data2 = {
type: "scatter",
mode: "lines",
name: 'Sell',
name: 'Overbought',
x: {{ dates|safe }},
y: {{ sell|safe }},
line: {
@ -163,7 +163,7 @@
var data2_mobile = {
type: "scatter",
mode: "lines",
name: 'Sell',
name: 'Overbought',
x: {{ dates|safe }},
y: {{ sell|safe }},
line: {

View file

@ -0,0 +1,300 @@
{% 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 Tail Emission</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-12 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 Monero Annualized Inflation (%)</div>
<div class="h5 mb-0 font-weight-bold text-gray-800">{{ now_xmr }}</div>
</div>
<div class="col-auto">
<i class="fab fa-monero 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 Tail Emission. Tail emission is the residual inflation rate after block rewards gets to a perpetual state of 0.6 XMR per block. <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 data4 = {
type: "scatter",
mode: "lines",
name: 'Monero Future Inflation',
x: {{ dates|safe }},
y: {{ finflationxmr|safe }},
line: {
color: '#dd1d1d'
,width: 3
}
};
var data4_mobile = {
type: "scatter",
mode: "lines",
name: 'Monero Future Inflation',
x: {{ dates|safe }},
y: {{ finflationxmr|safe }},
line: {
color: '#dd1d1d'
,width: 3
}
};
var data = [data4];
var data_mobile = [data4_mobile];
var layout = {
plot_bgcolor:"#252221",
paper_bgcolor:"#252221",
annotations: [
{
xref: 'paper',
yref: 'paper',
x: 0.02,
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: 1,
y: 0.95,
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: 'Annual Inflation (%)',
font: {
size: 20,
color: 'white'
}
},
tickformat :",.2f"
,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: ['2022-06-01', '2622-06-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: "linear",
tickformat :",.2f"
,nticks: 10
,tickfont: {
color: "#ffffff"
,size: 7
}
,gridcolor: "#444444"
},
xaxis: {
hoverformat: "%Y",
showgrid: true,
type: 'date',
nticks: 10
,tickfont: {
color: "#dddddd"
,size: 7
}
,gridcolor: "#444444"
,range: ['2022-06-01', '2622-06-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

@ -113,7 +113,7 @@
var data2 = {
type: "scatter",
mode: "lines",
name: 'Buy line',
name: 'Neutral line',
x: {{ dates|safe }},
y: {{ calories2|safe }},
line: {
@ -126,7 +126,7 @@
var data2_mobile = {
type: "scatter",
mode: "lines",
name: 'Buy line',
name: 'Neutral line',
x: {{ dates|safe }},
y: {{ calories2|safe }},
line: {

View file

@ -121,29 +121,6 @@
<!-- Page level plugins -->
<script>
var data1 = {
type: "scatter",
mode: "lines",
name: 'Simulation: Monero Tx Cost at BTC prices',
x: {{ dates|safe }},
y: {{ costxmr2|safe }},
line: {
color: '#444444'
,width: 1
}
};
var data1_mobile = {
type: "scatter",
mode: "lines",
name: 'Simulation: Monero Tx Cost at BTC prices',
x: {{ dates|safe }},
y: {{ costxmr2|safe }},
line: {
color: '#444444'
,width: 1
}
};
var data2 = {
type: "scatter",
mode: "lines",
@ -192,8 +169,8 @@
}
};
var data = [data1, data3, data2];
var data_mobile = [data1_mobile, data3_mobile, data2_mobile];
var data = [data3, data2];
var data_mobile = [data3_mobile, data2_mobile];
var layout = {
plot_bgcolor:"#252221",

View file

@ -3,8 +3,10 @@ from django.urls import path
from . import views
urlpatterns = [
# Página inicial
url(r'^$', views.index, name='index'),
# Pages URLs
# Everyone can use these
path('', views.index, name='index'),
path('pricelog/', views.pricelog, name='pricelog'),
path('movingaverage/', views.movingaverage, name='movingaverage'),
path('pricelin/', views.pricelin, name='pricelin'),
@ -68,6 +70,7 @@ urlpatterns = [
path('marketcap/', views.marketcap, name='marketcap'),
path('artigos/', views.artigos, name='artigos'),
path('articles/', views.articles, name='articles'),
path('tail_emission/', views.tail_emission, name='tail_emission'),
# URLs to useful functions on monerojnet/views.py
# Only admins can use these
@ -75,6 +78,7 @@ urlpatterns = [
path('get_complete_history/<str:symbol>/', views.get_history, name='get_complete_history'),
path('load_dominance/<str:symbol>/', views.load_dominance, name='load_dominance'),
path('load_rank/<str:symbol>/', views.load_rank, name='load_rank'),
path('populate_database/', views.populate_database, name='populate_database'),
path('importer/', views.importer, name='importer'),
path('reset/<str:symbol>/', views.reset, name='reset'),

File diff suppressed because it is too large Load diff

View file

@ -29,7 +29,7 @@ STATICFILES_DIRS = [
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = ''
SECRET_KEY = 'erwqrerqerqe24242442erwewrew324234423234243sdffsdfsdfds324243234234dsffdssfd'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

View file

@ -1,15 +1,7 @@
Charts that have to be changed
transcost.html 17.95 seconds
marketcap.html 26.06 seconds
bitcoin.html 15.61 seconds
marketcap.html 11.83 seconds
minerrevcap.html 15.37 seconds
minerrev.html 18.77 seconds
minerrevntv.html 18.68 seconds
minerfees.html 17.46 seconds
minerfeesntv.html 16.88 seconds
commit.html 15.27 seconds
commitntv.html 19.87 seconds
social.html 15.10 seconds
social6.html 15.24 seconds
social7.html 15.23 seconds
@ -18,17 +10,26 @@ social2.html 27.54 seconds
social3.html 15.11 seconds
social5.html 6.82 seconds
pricesats.html 5.61 seconds
transcostntv.html 15.63 seconds
percentage.html 12.20 seconds
metcalfesats.html 14.21 seconds
metcalfeusd.html 14.13 seconds
coins.html 15.35 seconds
extracoins.html 20.84 seconds
inflation.html 17.76 seconds
compinflation.html 28.91 seconds
dailyemission.html 19.64 seconds
dailyemissionntv.html 16.54 seconds
sfmodel.html 15.81 seconds
percentage.html 12.20 seconds >>>>>>> done
commit.html 15.27 seconds >>>>>>> done
commitntv.html 19.87 seconds >>>>>>> done
minerfees.html 17.46 seconds >>>>>>> done
minerfeesntv.html 16.88 seconds >>>>>>> done
minerrev.html 18.77 seconds >>>>>>> done
minerrevntv.html 18.68 seconds >>>>>>> done
metcalfesats.html 14.21 seconds >>>>>>> done
metcalfeusd.html 14.13 seconds >>>>>>> done
transcostntv.html 15.63 seconds >>>>>>> done
transcost.html 17.95 seconds >>>>>>> done
coins.html 15.35 seconds >>>>>>> done
extracoins.html 20.84 seconds >>>>>>> done
inflation.html 17.76 seconds >>>>>>> done
compinflation.html 28.91 seconds >>>>>>> done
dailyemission.html 19.64 seconds >>>>>>> done
dailyemissionntv.html 16.54 seconds >>>>>>> done
sfmodel.html 15.81 seconds >>>>>>> done
sfmodellin.html 0.14 seconds >>>>>>> done
bitcoin.html 15.61 seconds >>>>>>> done
Charts that wont be changed
@ -48,7 +49,6 @@ thermocap.html 0.08 seconds
sharpe.html 0.10 seconds
dominance.html 3.10 seconds
rank.html 2.13 seconds
sfmodellin.html 0.14 seconds
sfmultiple.html 0.12 seconds
hashrate.html 0.12 seconds
hashprice.html 0.16 seconds
@ -58,3 +58,27 @@ coincards.html 1.81 seconds
merchants.html 1.72 seconds
merchants_increase.html 1.68 seconds
merchants_percentage.html 1.76 seconds
tail_emission.html 0.55 seconds
How it became
sfmodel.html 0.05 seconds
sfmodellin.html 0.04 seconds
dailyemission.html 0.04 seconds
dailyemissionntv.html 0.04 seconds
compinflation.html 0.06 seconds
bitcoin.html 0.17 seconds
inflation.html 0.06 seconds
coins.html 0.13 seconds
extracoins.html 0.12 seconds
transcost.html 0.09 seconds
transcostntv.html 0.10 seconds
metcalfesats.html 0.09 seconds
metcalfeusd.html 0.17 seconds
minerrev.html 0.10 seconds
minerrevntv.html 0.10 seconds
minerfeesntv.html 0.10 seconds
minerfees.html 0.13 seconds
commitntv.html 0.12 seconds
commit.html 0.09 seconds
percentage.html 0.09 seconds