BitShares Forum

Main => General Discussion => Topic started by: AtomicBounce on August 31, 2014, 01:29:37 am

Title: Tip on keeping track on the current BTSX valuation on BTC38 for BTSX/BTC traders
Post by: AtomicBounce on August 31, 2014, 01:29:37 am
Hello,

With nearly 90% of the market volume, the BTSX/CNY trading pair on BTC38 is quite important to keep track of.

A site similar to BitcoinWisdom for the BTSX/CNY trading pair on BTC38 can be found here:
http://www.sosobtc.com/kline/btsx/btc38.html

If you are usually trading in BTC markets and not in CNY markets, it is kinda annoying to have to manually convert CNY prices to BTC prices to get a grasp of the current valuation of BTSX in China. I wrote a small script that automates this process. You can simply copy it into the URL bar while you are on sosobtc.com and press enter to execute it. After executing this script, a second price is shown on the site giving the always up-to-date BTSX value in BTC (using the current Huobi BTC/CNY ticker value for the conversion).

Code: [Select]
$('head').append('<style>.dark #sidebar #priceinbtc.green {color: #0F0;} .dark #sidebar #priceinbtc.red {color: #F00;};</style>');$('#price').after('<div id="priceinbtc" style="text-align:center;font-size: 18px;font-weight: bold;height: 40px;line-height: 40px;"></div>');function updateBTCPrice(){console.log('updateBTCPrice');var ticker=$('#ticker_huobi_btc').text();var huobi_btc_cny_ticker_val=ticker.substring(ticker.indexOf('¥')+1);var val = $('#trades .row:nth-of-type(1) .p').text()/huobi_btc_cny_ticker_val;$('#priceinbtc').text(Math.round(val * 10000000) / 10000000);$('#priceinbtc').attr('class',$('#trades .row:nth-of-type(1) .p').attr('class'));};updateBTCPrice();$('#trades').bind('DOMNodeInserted', updateBTCPrice);$('ul.nav-item-list.clearfix').bind('DOMSubtreeModified', updateBTCPrice);

EDIT: pasting the command to the URL bar seems not to work in firefox. Instead, you can open the javascript console by pressing F12 and execute the command there (without the leading 'javascript:').

Just wanted to share in case it is useful to someone else!

Cheers
Title: Re: Tip on keeping track on the current BTSX valuation on BTC38 for BTSX/BTC traders
Post by: jsidhu on September 01, 2014, 06:41:05 pm
 +5%
Title: Re: Tip on keeping track on the current BTSX valuation on BTC38 for BTSX/BTC traders
Post by: AtomicBounce on September 02, 2014, 08:57:21 am
BTW you can make this change permanent using a browser plugin like for example Greasemonkey.
Title: Re: Tip on keeping track on the current BTSX valuation on BTC38 for BTSX/BTC traders
Post by: roadscape on September 28, 2014, 04:26:53 am
Thanks for this! You can also just create a bookmark with the js code in the URL field.
Title: Re: Tip on keeping track on the current BTSX valuation on BTC38 for BTSX/BTC traders
Post by: AtomicBounce on September 28, 2014, 10:17:37 pm
Thanks for your comment :). I just improved the script a bit, it now also updates the price when the Huobi BTC/USD ticker value changes (not only when new trades in the BTC/BTSX market happen).

I am using Tampermonkey now with Chrome to run the script, working fine.
Title: Re: Tip on keeping track on the current BTSX valuation on BTC38 for BTSX/BTC traders
Post by: roadscape on September 29, 2014, 12:20:02 am
Thanks for your comment :). I just improved the script a bit, it now also updates the price when the Huobi BTC/USD ticker value changes (not only when new trades in the BTC/BTSX market happen).

I am using Tampermonkey now with Chrome to run the script, working fine.

Great! I installed Tampermonkey, way better than the bookmarklet approach :)

Also, if anyone is interested, this code cleans up Bter.com interfaces:
Code: [Select]
$('.leftbar, .footer, .topspace, .top_up, .top_dn, #box, .backToTop').hide();
$('.header').css('height','auto');
$('#divMyTradeHistoryList').attr('style', 'max-height: auto');