Top Level Namespace
Defined Under Namespace
Modules: Vexapion
Instance Method Summary collapse
- #balance ⇒ Object
-
#buy(price, size) ⇒ Object
puts ‘order’ puts @api.send_child_order(@pair, @type, side, price, amount) sleep 3 puts ‘get_orders’ res = @api.get_child_orders(@pair) puts res oid = res[‘child_order_id’] puts oid puts “cancel” res = @api.cancel_all_child_order(@pair) res = @api.cancel_child_order_id(@pair, oid) puts res.
- #sell(price, size) ⇒ Object
- #tick ⇒ Object
- #ticker ⇒ Object
Instance Method Details
#balance ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/vexapion/test/z-trade.rb', line 17 def balance res = @api.get_info2 funds = res['return']['funds'] avail = Hash.new avail['jpy'] = funds['jpy'] avail['btc'] = funds['btc'] avail['xem'] = funds['xem'] avail end |
#buy(price, size) ⇒ Object
puts ‘order’ puts @api.send_child_order(@pair, @type, side, price, amount) sleep 3 puts ‘get_orders’ res = @api.get_child_orders(@pair) puts res oid = res[‘child_order_id’] puts oid puts “cancel” res = @api.cancel_all_child_order(@pair) res = @api.cancel_child_order_id(@pair, oid) puts res
49 50 51 52 53 54 |
# File 'lib/vexapion/test/bf-trade.rb', line 49 def buy(price, size) puts "@api.send_child_order(@pair, @type, 'BUY', price, size)" res = @api.send_child_order(@pair, @type, 'BUY', price.to_i, size.to_f) puts res res['child_order_acceptance_id'] end |
#sell(price, size) ⇒ Object
56 57 58 59 60 61 |
# File 'lib/vexapion/test/bf-trade.rb', line 56 def sell(price, size) puts "@api.send_child_order(@pair, @type, 'SELL', price, size)" res = @api.send_child_order(@pair, @type, 'SELL', price.to_i, size.to_f) puts res res['child_order_acceptance_id'] end |
#tick ⇒ Object
63 64 65 66 67 68 |
# File 'lib/vexapion/test/bf-trade.rb', line 63 def tick res = @api.ticker(@pair) ask = res['best_ask'].to_i bid = res['best_bid'].to_i { ask: ask, bid: bid } end |
#ticker ⇒ Object
10 11 12 13 14 15 |
# File 'lib/vexapion/test/z-trade.rb', line 10 def ticker res = @api.ticker(@pair) ask = res['ask'] bid = res['bid'] { ask: ask, bid: bid } end |