Sha256: 694bee73bbfefb09d79a48925b341cd5790cab1c783b7a3d339c472b6f979439
Contents?: true
Size: 1.61 KB
Versions: 1
Compression:
Stored size: 1.61 KB
Contents
module HexTokenBot module ChannelClient class HexClient attr_accessor :client def initialize(options = {}) client_options = { access_key: HexTokenBot.tran_channels['hex']['access_key'], secret_key: HexTokenBot.tran_channels['hex']['secret_key'], endpoint: HexTokenBot.tran_channels['hex']['endpoint'], timeout: HexTokenBot.tran_channels['hex']['timeout'] } @client = PeatioAPI::Client.new client_options.merge(options) end def get_market_order_book(market_code, asks_limit = nil , bids_limit = nil) rep = client.get '/api/v2/order_book', market: market_code rep end def get_order_newest(market_code) rep = client.get '/api/v2/trades', market: market_code if rep.class == Array and !rep.empty? count = rep.size rep[count - 1] else [] end end def send_order(side, market_code, price, volume) rep = client.post '/api/v2/orders', market: market_code, price: price, side: side, volume: volume rep end #orders: [{side: 'buy', volume: '0.15', price: '2955.0'}, {side: 'sell', volume: '0.16', price: '2956'}] def send_orders_multi(orders, market_code) rep = client.post '/api/v2/orders/multi', market: market_code, orders: orders rep end def send_order_buy(market_code, price, volume) send_order('buy', market_code, price, volume) end def send_order_sell(market_code, price, volume) send_order('sell', market_code, price, volume) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hex_token_bot-0.1.0 | lib/hex_token_bot/channel_client/hex_client.rb |