diff options
| author | Adam Soltys <[email protected]> | 2012-11-29 04:21:30 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2012-11-29 04:21:37 -0800 |
| commit | fe4f809298e63734e450dadb045b5af6405538b4 (patch) | |
| tree | 0178c964fa1792fdecf9603cca5159eb80a1304b /public | |
| parent | cf810110ec5f8f1387619b9f8c6a35d7f7dcce61 (diff) | |
| download | coinos-server-fe4f809298e63734e450dadb045b5af6405538b4.tar.gz coinos-server-fe4f809298e63734e450dadb045b5af6405538b4.zip | |
Post exchange rates
Diffstat (limited to 'public')
| -rw-r--r-- | public/css/index.less | 2 | ||||
| -rw-r--r-- | public/js/calculator.coffee | 2 | ||||
| -rw-r--r-- | public/js/index.coffee | 24 |
3 files changed, 26 insertions, 2 deletions
diff --git a/public/css/index.less b/public/css/index.less index 35eb9420..cc31fc1b 100644 --- a/public/css/index.less +++ b/public/css/index.less @@ -9,6 +9,6 @@ footer { text-align: right; } -b.exchange { color: white; } +#ask, #bid { color: white; } div.directory img { width: 150px; height: 150px; float: left; padding-right: 20px; } div.row-fluid td.first { text-align: right; } diff --git a/public/js/calculator.coffee b/public/js/calculator.coffee index 9a66167a..78e5d91c 100644 --- a/public/js/calculator.coffee +++ b/public/js/calculator.coffee @@ -82,7 +82,7 @@ setup = -> fetchExchangeRate = -> $.ajax( - url: 'ticker?symbol=' + g.symbol, + url: "ticker?symbol=#{g.symbol}&type=ask&amount=1000", cache: false, success: (exchange) -> if exchange? diff --git a/public/js/index.coffee b/public/js/index.coffee index e69de29b..7db59a66 100644 --- a/public/js/index.coffee +++ b/public/js/index.coffee @@ -0,0 +1,24 @@ +#= require jquery-1.8.2.min.js + +$(-> + fetchExchangeRate('ask') + fetchExchangeRate('bid') +) + +fetchExchangeRate = (type) -> + commission = 0.03 + commission *= -1 if type is 'bid' + + $.ajax( + url: "ticker?symbol=virtexCAD&type=#{type}&amount=1000", + cache: false, + success: (exchange) -> + if not exchange? + exchange = '??' + + exchange = exchange - exchange * commission + $("##{type}").html(exchange.toFixed(2)) + error: -> + $("##{type}").html('??') + ) + setTimeout(fetchExchangeRate, 900000) |
