Sha256: d632c19bbf236329504d0c1206c59f1bb81b549694ba22a677dae8275d3b72a3
Contents?: true
Size: 835 Bytes
Versions: 1
Compression:
Stored size: 835 Bytes
Contents
require_relative 'net' require_relative 'mapper' require 'bigdecimal/util' module Bitstampede class Client attr_accessor :key attr_accessor :secret def initialize end def balance mapper.map_balance(net.post("balance")) end def orders mapper.map_orders(net.post("open_orders")) end def buy!(amount, price) trade!("buy", amount, price) end def sell!(amount, price) trade!("sell", amount, price) end def cancel(id) mapper.map_cancel(net.post("cancel_order", { id: id.to_s })) end private def net @net ||= Net.new(self) end def mapper @mapper ||= Mapper.new end def trade!(type, amount, price) mapper.map_order(net.post(type, { price: price.to_digits, amount: amount.to_digits })) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bitstampede-0.1.0 | lib/bitstampede/client.rb |