Skip to content

Instantly share code, notes, and snippets.

@leoschweizer
leoschweizer / gdax-ltc.rb
Created January 16, 2018 15:31 — forked from Skeyelab/gdax-ltc.rb
GDAX Spot Price - LTC
require 'net/http'
require 'json'
require 'uri'
SCHEDULER.every '5s', allow_overlapping: false do
uri = URI.parse('https://api.coinbase.com/v2/prices/LTC-EUR/spot')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri.request_uri)
class Dashing.Btcprice extends Dashing.Widget
@accessor 'value', Dashing.AnimatedValue
@accessor 'btcprice', ->
if @get('value')
price = parseFloat(@get('value'))
class Dashing.Ethprice extends Dashing.Widget
@accessor 'value', Dashing.AnimatedValue
@accessor 'ethprice', ->
if @get('value')
price = parseFloat(@get('value'))