Class: ZaifWrapper::Client::ZaifFutureApi

Inherits:
Object
  • Object
show all
Defined in:
lib/zaif_wrapper/client.rb

Constant Summary collapse

REQUEST_URL_BASE =
'https://api.zaif.jp/fapi/1/'

Instance Method Summary collapse

Instance Method Details

#depth(group_id, currency_pair) ⇒ Object

/depth/group_id/currency_pair



154
155
156
157
# File 'lib/zaif_wrapper/client.rb', line 154

def depth(group_id, currency_pair)
  path = "depth/#{group_id}/#{currency_pair}"
  request(path)
end

#groups(group_id) ⇒ Object

/groups/#group_id



130
131
132
133
# File 'lib/zaif_wrapper/client.rb', line 130

def groups(group_id)
  path = "groups/#{group_id}"
  request(path)
end

#last_price(group_id, currency_pair) ⇒ Object

last_price/#group_id#currency_pair



136
137
138
139
# File 'lib/zaif_wrapper/client.rb', line 136

def last_price(group_id, currency_pair)
  path = "last_price/#{group_id}/#{currency_pair}"
  request(path)
end

#request(path) ⇒ Object



124
125
126
127
# File 'lib/zaif_wrapper/client.rb', line 124

def request(path)
  response = RestClient.get "#{REQUEST_URL_BASE}#{path}"
  JSON.parse(response.body)
end

#ticker(group_id, currency_pair) ⇒ Object

/ticker/#group_id/#currency_pair



142
143
144
145
# File 'lib/zaif_wrapper/client.rb', line 142

def ticker(group_id, currency_pair)
  path = "ticker/#{group_id}/#{currency_pair}"
  request(path)
end

#trades(group_id, currency_pair) ⇒ Object

/trades/group_id/currency_pair



148
149
150
151
# File 'lib/zaif_wrapper/client.rb', line 148

def trades(group_id, currency_pair)
  path = "trades/#{group_id}/#{currency_pair}"
  request(path)
end