/
public.rb
43 lines (36 loc) · 1.08 KB
/
public.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# frozen_string_literal: true
module Bitflyer
module HTTP
module Public
class Client
def initialize
@connection = Connection.new(nil, nil)
end
def health
@connection.get('/v1/gethealth').body
end
def markets
@connection.get('/v1/markets').body
end
def board(product_code: 'BTC_JPY')
@connection.get('/v1/board', product_code: product_code).body
end
def ticker(product_code: 'BTC_JPY')
@connection.get('/v1/ticker', product_code: product_code).body
end
def executions(product_code: 'BTC_JPY', count: nil, before: nil, after: nil)
query = {
product_code: product_code,
count: count,
before: before,
after: after
}.delete_if { |_, v| v.nil? }
@connection.get('/v1/executions', query).body
end
def chats(from_date: (Time.now - (5 * 24 * 60 * 60)))
@connection.get('/v1/getchats', from_date: from_date).body
end
end
end
end
end