Class: HexTokenBot::ChannelClient::BterClient

Inherits:
Object
  • Object
show all
Defined in:
lib/hex_token_bot/channel_client/bter_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ BterClient

Returns a new instance of BterClient.



6
7
8
# File 'lib/hex_token_bot/channel_client/bter_client.rb', line 6

def initialize(options = {})
  @client = HexTokenBot::ChannelApi::Bter::Public.new
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



4
5
6
# File 'lib/hex_token_bot/channel_client/bter_client.rb', line 4

def client
  @client
end

Instance Method Details

#get_market_order_book(market_code, asks_limit = nil, bids_limit = nil) ⇒ Object



11
12
13
14
# File 'lib/hex_token_bot/channel_client/bter_client.rb', line 11

def get_market_order_book(market_code, asks_limit = nil , bids_limit = nil)
  rep = @client.order_book(market_code)
  rep
end

#get_order_newest(market_code) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/hex_token_bot/channel_client/bter_client.rb', line 16

def get_order_newest(market_code)
  rep = @client.trade_history(market_code)
  if !rep.empty? and !rep[:data].nil?
    count = rep[:data].size
    rep[:data][count - 1]
  else
    []
  end
end