huobi_client 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 738bf1b91127f89188c95a3f40f7e1c294cbe53b
4
- data.tar.gz: bfee8289ea561f460d4711f0601968e43dcdcfc4
3
+ metadata.gz: 21fcbb5ba72a6a814ab0d1005350a1770acef76a
4
+ data.tar.gz: 634bdb2f30073ef7cf7fe55823fe0e05cc78c817
5
5
  SHA512:
6
- metadata.gz: 65dd614091858e09a4b0014a9d1fc59f71ed9d081dfccda49e17bafe8c8a4375d3ab482c7dd5db40bb174166b76bbc0865ce64640364d78a6b536825da475d9e
7
- data.tar.gz: b2d63e1f23d8baaae33329cd90ad502e9a945bad5dc5d85640067dbd7e0ad7939bf9b9e92a9d412c64f414b2f09a636df4643b507662cfb48de394cf033f1d9c
6
+ metadata.gz: f79dae9b68f11a79633e214ff096ac40e969251a7d5e17a0729d00e44cb3ff0cb9606ca62ccc2f733062f95650990e43ff4e6c1708f5479a5b6e2d67e557ed42
7
+ data.tar.gz: cd74093847d5f7d6d3b951bc33db433950178b3d5fb094f65b766c8c472b7700393740611fb4ec0bf40bd081ab4b742de7a185b4f2825e504cd7d6f49dacaaf4
data/.gitignore CHANGED
@@ -9,3 +9,6 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+
13
+ /bin/detect
14
+ *.gem
@@ -75,7 +75,7 @@ module HuobiClient
75
75
  end
76
76
 
77
77
  # 交易API
78
- def place(account_id:, symbol:, type:, amount:, price: nil, source: 'api') # Pro站下单
78
+ def place(account_id: @account_id, symbol:, type:, amount:, price: nil, source: 'api') # Pro站下单
79
79
  # types
80
80
  # buy-market:市价买,
81
81
  # sell-market:市价卖,
@@ -86,7 +86,7 @@ module HuobiClient
86
86
  post '/v1/order/orders/place', fun_params(__method__, binding).transform_keys {|key| key.to_s.sub('_', '-')}
87
87
  end
88
88
 
89
- def hadax_place(account_id:, symbol:, type:, amount:, price: nil, source: 'api') # HADAX站下单
89
+ def hadax_place(account_id: @account_id, symbol:, type:, amount:, price: nil, source: 'api') # HADAX站下单
90
90
  post '/v1/hadax/order/orders/place', fun_params(__method__, binding).transform_keys {|key| key.to_s.sub('_', '-')}
91
91
  end
92
92
 
@@ -98,21 +98,21 @@ module HuobiClient
98
98
  post '/v1/order/orders/batchcancel', fun_params(__method__, binding).transform_keys {|key| key.to_s.sub('_', '-')}
99
99
  end
100
100
 
101
- def order_detail # 查询某个订单详情
102
- get "/v1/order/orders/#{options[:order_id]}"
101
+ def order_detail(order_id:) # 查询某个订单详情
102
+ get "/v1/order/orders/#{order_id}"
103
103
  end
104
104
 
105
- def match_results # 查询某个订单的成交明细
106
- get "/v1/order/orders/#{options[:order_id]}/matchresults"
105
+ def match_results(order_id:) # 查询某个订单的成交明细
106
+ get "/v1/order/orders/#{order_id}/matchresults"
107
107
  end
108
108
 
109
- def orders(symbol:, states:, types: nil, start_date: nil, end_date: nil, from: nil, direct: nil, size: nil) # 查询当前委托、历史委托
109
+ def orders(symbol: nil, states:, types: nil, start_date: nil, end_date: nil, from: nil, direct: nil, size: nil) # 查询当前委托、历史委托
110
110
  # direct false string 查询方向 prev 向前,next 向后
111
111
  # states true string 查询的订单状态组合,使用','分割 pre-submitted 准备提交, submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销
112
112
  get '/v1/order/orders', fun_params(__method__, binding).transform_keys {|key| key.to_s.sub('_', '-')}
113
113
  end
114
114
 
115
- def all_match_results(symbol:, states:, types: nil, start_date: nil, end_date: nil, from: nil, direct: nil, size: nil) # 查询当前成交、历史成交
115
+ def all_match_results(symbol: nil, states:, types: nil, start_date: nil, end_date: nil, from: nil, direct: nil, size: nil) # 查询当前成交、历史成交
116
116
  get '/v1/order/matchresults', fun_params(__method__, binding).transform_keys {|key| key.to_s.sub('_', '-')}
117
117
  end
118
118
 
@@ -130,8 +130,8 @@ module HuobiClient
130
130
  post '/v1/margin/orders', fun_params(__method__, binding)
131
131
  end
132
132
 
133
- def margin_repay(amount:) # 归还借贷
134
- post "/v1/margin/orders/#{options[order_id]}/repay", fun_params(__method__, binding)
133
+ def margin_repay(amount:, order_id:) # 归还借贷
134
+ post "/v1/margin/orders/#{order_id}/repay", fun_params(__method__, binding)
135
135
  end
136
136
 
137
137
  def loan_orders(symbol:, states: nil, start_date: nil, end_date: nil, from: nil, direct: nil, size: nil) # 借贷订单
@@ -28,6 +28,7 @@ module HuobiClient
28
28
 
29
29
  def connect(method, path, options)
30
30
  options.compact!
31
+ options.transform_keys! { |key| key.to_s }
31
32
  params = {
32
33
  AccessKeyId: @access,
33
34
  SignatureMethod: 'HmacSHA256',
@@ -13,6 +13,7 @@ module HuobiClient
13
13
  @success = false
14
14
 
15
15
  begin
16
+ @body = JSON.parse(@body) unless @body.is_a? Hash
16
17
  @body = @body.with_indifferent_access if @body.is_a? Hash
17
18
  rescue => e
18
19
  p e.message
@@ -1,3 +1,3 @@
1
1
  module HuobiClient
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: huobi_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vcinly
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-03 00:00:00.000000000 Z
11
+ date: 2018-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday