blob: 2a8a6b5a7c9ae8352db9958b65c82b0960363fca (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#= 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",
success: (exchange) ->
if not exchange?
exchange = '??'
exchange = exchange - exchange * commission
$("##{type}").html(exchange.toFixed(2))
error: ->
$("##{type}").html('??')
)
setTimeout(fetchExchangeRate, 900000)
|