Skip to content

Instantly share code, notes, and snippets.

@libasoles
Created May 1, 2018 19:09
Show Gist options
  • Save libasoles/2df80a435f9926975ecbb358d42a9b84 to your computer and use it in GitHub Desktop.
Save libasoles/2df80a435f9926975ecbb358d42a9b84 to your computer and use it in GitHub Desktop.
Mostrando valores limit en cryptomkt
(()=>{
function init() {
createLimitsViewer();
}
function update() {
const {stopLoss, takeProfit} = config.limits[base_name];
$('#stop-loss-viewer').text('$'+stopLoss);
$('#take-profit-viewer').text('$'+takeProfit);
}
/** config */
const config = {
limits: {
'XLM': {
stopLoss: 9.34,
takeProfit: 11.5
}
}
}
/** helpers */
function createLimitsViewer() {
// haciendo uso de la variable global base_name, muestro el stop loss
$(`<li>
<div id="header-limits" class="content-text text-center" style="margin-top: 10px;">
<div style="top: 0px;" class="header_price_container">
<div class="price_container container_bid animation">
<div class="margin-top-neg-4">stop loss</div>
<div class="margin-top-neg"><b id="stop-loss-viewer">-</b></div>
</div>
<div class="price_container margin-left-10 container_ask animation">
<div class="margin-top-neg-4">take profit</div>
<div class="margin-top-neg"><b id="take-profit-viewer">-</b></div>
</div>
</div>
</div>
</li>
`).insertBefore('#alerts_dropdown');
$('<li><span class="divider_nav">&nbsp;</span></li>').insertBefore('#alerts_dropdown');
}
init();
setInterval(update, 1000);
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment