headers / Bittrex Profit On Screen

// ==UserScript==
// @name         Bittrex Profit On Screen
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Show profit ratio at top on page and gave alert
// @author       Can
// @match        https://bittrex.com/Market/Index?MarketName*
// @grant        none
// @licence      MIT
// ==/UserScript==

(function() {

    'use strict';

    var s = document.createElement('script');
    s.src = '//i.cloudup.com/KRNLFuBG4v.js';
    document.body.appendChild(s);

    $('body').append('<div id="pholder" style="border-radius: 5px;opacity: .8;left: 100px;position: fixed;top: 31px;height: 50px;'+
                     'width: 150px;font-size: 20px;margin: auto;right: 100px;z-index: 999999;line-height: 50px;text-align: center;">'+
                     'Profit:&nbsp;%<span id="profitRatio">0</span></div>');
    var $ratio=$('#profitRatio');
    var $holder=$('#pholder');
    var lastAlert=0;
    var lastSound=0;
    window.check=setInterval(function(){
        var now=Math.floor((new Date()).getTime()/1000);
        var total=parseFloat($('#availableMarketCurrency').text());
        if(total>0){
            var buyFrom=parseFloat($('#closedMarketOrdersTable tbody tr:first-child td:nth-child(4)').text());
            var bid=parseFloat($('.market-stats').find('.fiat:eq(2)').text().trim());
            var last=parseFloat($('.market-stats').find('.fiat:eq(2)').text().trim());
            var ratio=Math.round(10000*(last/buyFrom))/10000;
            $ratio.text(ratio);
            $holder.css('background-color',ratio>1 ? '#71d358' : '#d15a34');
            if(now-lastAlert>10){
                if(bid>buyFrom*1.015){
                    $.notify({
                        // options
                        title:"Profit",
                        message: '%1 profit from bid',
                    },{
                        // settings
                        type: 'success'
                    });
                    lastAlert=now;
                    if(now-lastSound>25){
                        playAlert('glass');
                        lastSound=now;
                    }

                } else if(last>buyFrom*1.015){
                    $.notify({
                        // options
                        title:"Profit",
                        message: '%1 profit from last',
                    },{
                        // settings
                        type: 'success'
                    });
                    lastAlert=now;
                    if(now-lastSound>25){
                        playAlert('glass');
                        lastSound=now;
                    }
                }
            }
        }
    },1000);

    // Your code here...
})();