Files
purple-explorer/views/market.pug
T
2020-12-20 18:13:24 -07:00

254 lines
12 KiB
Plaintext

extends layout
block content
include ./includes/common.pug
- var theadClasses = [];
if settings.display.table_header_bgcolor != null && settings.display.table_header_bgcolor != ''
- theadClasses.push('thead-' + settings.display.table_header_bgcolor);
script.
$(document).ready(function() {
$('.order-table').dataTable({
info: false,
paging: false,
searching: false,
ordering: false,
scrollY: '250px',
autowidth: true,
responsive: true
});
$('.market-toggle').tooltip({
animation: true,
delay: { hide: 500 }
});
});
.col-xs-12.col-md-12
if settings.markets.enabled.length > 1
.row
.col-md-12.cardSpacer
.card.card-default.border-0
.card-header
strong #{settings.locale.menu_markets}
.card-body
ul.nav.nav-pills
each mkt in settings.markets.enabled
if settings.market_names[mkt] != null
if market == mkt
li.nav-item
a.nav-link.active(href='/markets/' + mkt) #{settings.market_names[mkt]}
else
li.nav-item
a.nav-link(href='/markets/' + mkt) #{settings.market_names[mkt]}
block market_view
script.
$(document).ready(function() {
var jqplot = null;
var chartData = !{(marketdata.data.chartdata == 'null' || marketdata.data.chartdata == '' || marketdata.data.chartdata == '[]' ? 'null' : marketdata.data.chartdata)};
if (chartData != null && chartData.length > 0 ) {
jqplot = $.jqplot('chart', [chartData], {
seriesDefaults: {
yaxis: 'y2axis'
},
axes: {
xaxis: {
renderer: $.jqplot.DateAxisRenderer,
tickOptions: { formatString: '%R' },
tickInterval: '2 hours'
},
y2axis: {
tickOptions: { formatString: '%.8f' },
}
},
series: [
{
renderer: $.jqplot.OHLCRenderer,
rendererOptions: {
candleStick: true,
upBodyColor: '#2aa3a3',
downBodyColor: '#e2595b',
fillUpBody: true,
fillDownBody: true
}
}
],
highlighter: {
show: true,
showMarker: false,
tooltipAxes: 'xy',
yvalues: 4,
formatString: '<table class="jqplot-highlighter"> \
<tr><td>time:</td><td>%s</td></tr> \
<tr><td>open:</td><td>%s</td></tr> \
<tr><td>hi:</td><td>%s</td></tr> \
<tr><td>low:</td><td>%s</td></tr> \
<tr><td>close:</td><td>%s</td></tr></table>'
}
});
}
$(window).resize(function () {
if (jqplot != null)
jqplot.replot( { resetAxes: false } );
});
});
.row
.col-md-12.cardSpacer
.card.card-default.border-0
.card-header
strong #{marketdata.market_name} - #{marketdata.coin}/#{marketdata.exchange} - #{settings.locale.mkt_hours}
if marketdata.data.chartdata == 'null' || marketdata.data.chartdata == '' || marketdata.data.chartdata == '[]'
span.fas.fa-chart-line.float-right.view-chart-disabled.iquidus.market-toggle(style='cursor: pointer;', data-toggle='tooltip', data-placement='bottom', title=settings.locale.mkt_no_chart)
table.table.table-bordered.right-border-0.summary-table
thead(class=theadClasses)
tr
if marketdata.data.summary.high != null
th #{settings.locale.mkt_high}
if marketdata.data.summary.low != null
th #{settings.locale.mkt_low}
if marketdata.data.summary.volume != null
th #{settings.locale.mkt_volume}
if marketdata.data.summary.volume_btc != null
th.d-none.d-xl-table-cell #{settings.locale.mkt_volume}
span.small (#{marketdata.exchange})
if marketdata.data.summary.bid != null
th.d-none.d-md-table-cell #{settings.locale.mkt_top_bid}
if marketdata.data.summary.ask != null
th.d-none.d-md-table-cell #{settings.locale.mkt_top_ask}
if marketdata.data.summary.last != null
th.d-none.d-xl-table-cell #{settings.locale.mkt_last}
if marketdata.data.summary.prev != null
th.d-none.d-xl-table-cell #{settings.locale.mkt_yesterday}
if marketdata.data.summary.change != null || (marketdata.data.summary.last != null && marketdata.data.summary.prev != null)
th.d-none.d-xl-table-cell #{settings.locale.mkt_change}
tbody
tr
if marketdata.data.summary.high != null
td #{parseFloat(marketdata.data.summary.high).toFixed(8)}
if marketdata.data.summary.low != null
td #{parseFloat(marketdata.data.summary.low).toFixed(8)}
if marketdata.data.summary.volume != null
td #{parseFloat(marketdata.data.summary.volume).toFixed(8)}
if marketdata.data.summary.volume_btc != null
td.d-none.d-xl-table-cell #{parseFloat(marketdata.data.summary.volume_btc).toFixed(8)}
if marketdata.data.summary.bid != null
td.d-none.d-md-table-cell #{parseFloat(marketdata.data.summary.bid).toFixed(8)}
if marketdata.data.summary.ask != null
td.d-none.d-md-table-cell #{parseFloat(marketdata.data.summary.ask).toFixed(8)}
if marketdata.data.summary.last != null
td.d-none.d-xl-table-cell #{parseFloat(marketdata.data.summary.last).toFixed(8)}
if marketdata.data.summary.prev != null
td.d-none.d-xl-table-cell #{parseFloat(marketdata.data.summary.prev).toFixed(8)}
if marketdata.data.summary.change != null || (marketdata.data.summary.last != null && marketdata.data.summary.prev != null)
if marketdata.data.summary.change != null
if marketdata.data.summary.change == '' || marketdata.data.summary.change == '-'
td.d-none.d-xl-table-cell.font-weight-bold 0.00 %
else
- var price_change = parseFloat(marketdata.data.summary.change).toFixed(2);
else
- var price_change = (100 - ((parseFloat(marketdata.data.summary.prev) / parseFloat(marketdata.data.summary.last)) * 100)).toFixed(2);
if price_change >= 0
td.d-none.d-xl-table-cell.text-success.font-weight-bold +#{price_change} %
else
td.d-none.d-xl-table-cell.text-danger.font-weight-bold #{price_change} %
if marketdata.data.chartdata != 'null' && marketdata.data.chartdata != '' && marketdata.data.chartdata != '[]'
#marketChart.row
.col-md-12.cardSpacer
.card.card-default.border-0
.card-header
strong #{marketdata.market_name} - #{marketdata.coin}/#{marketdata.exchange} - #{settings.locale.mkt_hours}
.card-body
div#chart(style='width: 100%; height: 300px;')
.row
.col-md-6.col-xs-12.cardSpacer
.card.card-default.border-0.wrapper-border-0(class=theadClasses)
.card-header(style='border-bottom-width:1px;')
strong #{settings.locale.mkt_buy_orders}
table.table.table-striped.table-bordered.order-table
thead(class=theadClasses)
tr
th #{settings.locale.mkt_price}
span.small (#{marketdata.exchange})
th #{settings.locale.mkt_amount}
span.small (#{marketdata.coin})
th.d-none.d-sm-table-cell #{settings.locale.mkt_total}
span.small (#{marketdata.exchange})
tbody
each buy in marketdata.data.buys
tr
td.text-success.font-weight-bold
=parseFloat(buy.price).toFixed(8)
td
=parseFloat(buy.quantity).toFixed(8)
td.d-none.d-sm-table-cell
if buy.total != null
=parseFloat(buy.total).toFixed(8)
else
=parseFloat(parseFloat(buy.price).toFixed(8) * parseFloat(buy.quantity).toFixed(8)).toFixed(8)
.col-md-6.col-xs-12.cardSpacer
.card.card-default.border-0.wrapper-border-0(class=theadClasses)
.card-header(style='border-bottom-width:1px;')
strong #{settings.locale.mkt_sell_orders}
table.table.table-striped.table-bordered.order-table
thead(class=theadClasses)
tr
th #{settings.locale.mkt_price}
span.small (#{marketdata.exchange})
th #{settings.locale.mkt_amount}
span.small (#{marketdata.coin})
th.d-none.d-sm-table-cell #{settings.locale.mkt_total}
span.small (#{marketdata.exchange})
tbody
each sell in marketdata.data.sells
tr
td.text-danger.font-weight-bold
=parseFloat(sell.price).toFixed(8)
td
=parseFloat(sell.quantity).toFixed(8)
td.d-none.d-sm-table-cell
if sell.total != null
=parseFloat(sell.total).toFixed(8)
else
=parseFloat(parseFloat(sell.price).toFixed(8) * parseFloat(sell.quantity).toFixed(8)).toFixed(8)
.row
.col-md-12
.card.card-default.border-0
.card-header
strong #{settings.locale.mkt_trade_history}
table#history-table.table.table-hover.table-bordered.table-striped.table-paging.right-border-0(cellspacing='0')
thead(class=theadClasses)
tr
th #{settings.locale.mkt_price}
span.small (#{marketdata.exchange})
th #{settings.locale.mkt_amount}
span.small (#{marketdata.coin})
th #{settings.locale.mkt_total}
span.small (#{marketdata.exchange})
th.d-none.d-lg-table-cell #{settings.locale.mkt_time_stamp}
tbody
each order in marketdata.data.history
if order.ordertype != null
if order.ordertype.toUpperCase() == 'BUY'
tr
td.text-success.font-weight-bold
=parseFloat(order.price).toFixed(8)
td
=parseFloat(order.quantity).toFixed(8)
td
if order.total != null
=parseFloat(order.total).toFixed(8)
else
=parseFloat(parseFloat(order.price).toFixed(8) * parseFloat(order.quantity).toFixed(8)).toFixed(8)
td.d-none.d-lg-table-cell
=format_unixtime(new Date(order.timestamp), true)
else
tr
td.text-danger.font-weight-bold
=parseFloat(order.price).toFixed(8)
td
=parseFloat(order.quantity).toFixed(8)
td
if order.total != null
=parseFloat(order.total).toFixed(8)
else
=parseFloat(parseFloat(order.price).toFixed(8) * parseFloat(order.quantity).toFixed(8)).toFixed(8)
td.d-none.d-lg-table-cell
=format_unixtime(new Date(order.timestamp), true)