bitmex-api 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0f89040dcc8d33b64ff27a79b2a433ab570998496db0dda35adaf6dd372e332
4
- data.tar.gz: 23ecfb049409b70f4d0a9f88e0f37080db15efc42072cc99697dc151c52d261f
3
+ metadata.gz: cbbaf029bcd6fbb70b9a1890f1c0b22bf21e3ec23092dd39d584ebd79b8de2f0
4
+ data.tar.gz: ee2b4d48711fa63618c859a08a2ab5026097c32c26d468752f0db7cadc82ec7f
5
5
  SHA512:
6
- metadata.gz: 4386ca4e4cf6ed29a679caaf7c3e95468d3f0e669e4731bb567556359b564d938e3036664b9018cba861d98ff655b62742747d22b7f4d36a36932f2a0df4a1d2
7
- data.tar.gz: daa0fb13249d538a99c75f503258e4088921f600166d253400b9b6e76d8024d8a680422f3e0f2cc5cb3e9e2a7ce52fb812eeaf7edc4839027bb164fdfc6d67a4
6
+ metadata.gz: fe7911b8cbf14ed395470c6d0648974f58fd88a4c466bbd3e3116f7e288252824d119bf77d909158d7bd4b67ecc5377bbcc569eca7f33c088763a8eab745ce11
7
+ data.tar.gz: 88a68b130ea052d4cd0986a9b75694b3e71cb8777625843d42f8a58b3325def6382a057757107af3eea8b991042a428cda1bcd01ed698861994235caa4224594
@@ -1 +1 @@
1
- 2.5.3
1
+ 2.6.3
@@ -3,14 +3,14 @@ sudo: false
3
3
  language: ruby
4
4
  cache: bundler
5
5
  rvm:
6
- - 2.5.3
6
+ - 2.6.3
7
7
 
8
8
  env:
9
9
  global:
10
10
  - CC_TEST_REPORTER_ID=62a2cea238cf89f14f968d9a91fe41af7a11f414f6cc9194df7abc7887e61f6e
11
11
 
12
12
  before_install:
13
- - gem install bundler -v 1.17.1
13
+ - gem install bundler
14
14
  - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
15
15
  - chmod +x ./cc-test-reporter
16
16
 
@@ -5,6 +5,13 @@
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.1.3] - 2019-07-03
9
+ ### Changed
10
+ - update Ruby to 2.6.3
11
+ - update all gems
12
+ ### Fixed
13
+ - query params for filtering in GET requests
14
+
8
15
  ## [0.1.2] - 2019-04-17
9
16
  ### Changed
10
17
  - update gems
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bitmex-api (0.1.2)
4
+ bitmex-api (0.1.3)
5
5
  eventmachine
6
6
  faye-websocket
7
7
  hashie
@@ -24,19 +24,19 @@ GEM
24
24
  descendants_tracker (0.0.4)
25
25
  thread_safe (~> 0.3, >= 0.3.1)
26
26
  diff-lcs (1.3)
27
- docile (1.3.1)
28
- dotenv (2.7.2)
27
+ docile (1.3.2)
28
+ dotenv (2.7.4)
29
29
  equalizer (0.0.11)
30
30
  eventmachine (1.2.7)
31
- faye-websocket (0.10.7)
31
+ faye-websocket (0.10.9)
32
32
  eventmachine (>= 0.12.0)
33
33
  websocket-driver (>= 0.5.1)
34
34
  hashie (3.6.0)
35
- httparty (0.16.4)
35
+ httparty (0.17.0)
36
36
  mime-types (~> 3.0)
37
37
  multi_xml (>= 0.5.2)
38
38
  ice_nine (0.11.2)
39
- jaro_winkler (1.5.2)
39
+ jaro_winkler (1.5.3)
40
40
  json (2.2.0)
41
41
  kwalify (0.7.2)
42
42
  method_source (0.9.2)
@@ -45,7 +45,7 @@ GEM
45
45
  mime-types-data (3.2019.0331)
46
46
  multi_xml (0.6.0)
47
47
  parallel (1.17.0)
48
- parser (2.6.2.1)
48
+ parser (2.6.3.0)
49
49
  ast (~> 2.4.0)
50
50
  pry (0.12.2)
51
51
  coderay (~> 1.1.0)
@@ -56,7 +56,7 @@ GEM
56
56
  psych (3.1.0)
57
57
  rainbow (3.0.0)
58
58
  rake (12.3.2)
59
- reek (5.3.2)
59
+ reek (5.4.0)
60
60
  codeclimate-engine-rb (~> 0.4.0)
61
61
  kwalify (~> 0.7.0)
62
62
  parser (>= 2.5.0.0, < 2.7, != 2.5.1.1)
@@ -66,40 +66,39 @@ GEM
66
66
  rspec-core (~> 3.8.0)
67
67
  rspec-expectations (~> 3.8.0)
68
68
  rspec-mocks (~> 3.8.0)
69
- rspec-core (3.8.0)
69
+ rspec-core (3.8.2)
70
70
  rspec-support (~> 3.8.0)
71
- rspec-expectations (3.8.2)
71
+ rspec-expectations (3.8.4)
72
72
  diff-lcs (>= 1.2.0, < 2.0)
73
73
  rspec-support (~> 3.8.0)
74
- rspec-mocks (3.8.0)
74
+ rspec-mocks (3.8.1)
75
75
  diff-lcs (>= 1.2.0, < 2.0)
76
76
  rspec-support (~> 3.8.0)
77
- rspec-support (3.8.0)
78
- rubocop (0.67.2)
77
+ rspec-support (3.8.2)
78
+ rubocop (0.72.0)
79
79
  jaro_winkler (~> 1.5.1)
80
80
  parallel (~> 1.10)
81
- parser (>= 2.5, != 2.5.1.1)
82
- psych (>= 3.1.0)
81
+ parser (>= 2.6)
83
82
  rainbow (>= 2.2.2, < 4.0)
84
83
  ruby-progressbar (~> 1.7)
85
- unicode-display_width (>= 1.4.0, < 1.6)
86
- ruby-progressbar (1.10.0)
87
- simplecov (0.16.1)
84
+ unicode-display_width (>= 1.4.0, < 1.7)
85
+ ruby-progressbar (1.10.1)
86
+ simplecov (0.17.0)
88
87
  docile (~> 1.1)
89
88
  json (>= 1.8, < 3)
90
89
  simplecov-html (~> 0.10.0)
91
90
  simplecov-html (0.10.2)
92
91
  thread_safe (0.3.6)
93
- unicode-display_width (1.5.0)
92
+ unicode-display_width (1.6.0)
94
93
  virtus (1.0.5)
95
94
  axiom-types (~> 0.1)
96
95
  coercible (~> 1.0)
97
96
  descendants_tracker (~> 0.0, >= 0.0.3)
98
97
  equalizer (~> 0.0, >= 0.0.9)
99
- websocket-driver (0.7.0)
98
+ websocket-driver (0.7.1)
100
99
  websocket-extensions (>= 0.1.0)
101
- websocket-extensions (0.1.3)
102
- yard (0.9.19)
100
+ websocket-extensions (0.1.4)
101
+ yard (0.9.20)
103
102
 
104
103
  PLATFORMS
105
104
  ruby
@@ -118,4 +117,4 @@ DEPENDENCIES
118
117
  simplecov
119
118
 
120
119
  BUNDLED WITH
121
- 1.17.1
120
+ 2.0.2
data/TODOs.org CHANGED
@@ -18,6 +18,11 @@
18
18
  CLOSED: [2019-01-29 Tue] SCHEDULED: <2019-01-29 Tue>
19
19
  ** refactoring: use class methods when working with multiple entities
20
20
  ** bug: {"error":{"message":"Signature not valid.","name":"HTTPError"}} in user#executions
21
+ ** DONE bug: handle query in websocket and skip in POST/PUT/DELETE operations
22
+ CLOSED: [2019-07-03 Wed 18:06]
23
+ :LOGBOOK:
24
+ CLOCK: [2019-07-03 Wed 17:55]--[2019-07-03 Wed 18:06] => 0:11
25
+ :END:
21
26
  ** DONE liquidation, leaderboard, insurance, instrument, funding, execution, chat, announcement
22
27
  CLOSED: [2019-01-30 Wed] SCHEDULED: <2019-01-30 Wed>
23
28
  ** DONE refactoring: extract websocket common logic
@@ -33,3 +38,9 @@
33
38
  CLOSED: [2019-02-13 Wed] SCHEDULED: <2019-02-13 Wed>
34
39
  ** DONE release 0.1.1
35
40
  CLOSED: [2019-03-06 Wed] SCHEDULED: <2019-03-06 Wed>
41
+ ** TODO bitmex-api-ruby maintenance
42
+ SCHEDULED: <2019-08-02 Fri +1m>
43
+ :PROPERTIES:
44
+ :LAST_REPEAT: [2019-07-03 Wed 18:52]
45
+ :END:
46
+ - State "DONE" from "TODO" [2019-07-03 Wed 18:52]
@@ -28,22 +28,26 @@ module Bitmex
28
28
  TESTNET_HOST = 'testnet.bitmex.com'.freeze
29
29
  MAINNET_HOST = 'www.bitmex.com'.freeze
30
30
 
31
- def self.signature(api_secret, verb, path, expires, params)
32
- params = '' if params.nil?
33
- params = params.to_s unless params.is_a? String
31
+ def self.signature(api_secret, verb, path, expires, body, query)
32
+ body = '' if body.nil?
33
+ body = body.to_s unless body.is_a? String
34
34
 
35
- data = verb + path + expires.to_s + params
35
+ if query != nil && query.is_a?(Hash) && !query.empty?
36
+ path += "?#{URI.encode_www_form(query)}"
37
+ end
38
+
39
+ data = verb + path + expires.to_s + body
36
40
  OpenSSL::HMAC.hexdigest 'SHA256', api_secret, data
37
41
  end
38
42
 
39
- def self.headers(api_key, api_secret, verb, path, body)
43
+ def self.headers(api_key, api_secret, verb, path, body, query)
40
44
  return {} unless api_key || api_secret
41
45
 
42
46
  expires = Time.now.utc.to_i + 60
43
47
  {
44
48
  'api-expires' => expires.to_s,
45
49
  'api-key' => api_key,
46
- 'api-signature' => Bitmex.signature(api_secret, verb, path, expires, body)
50
+ 'api-signature' => Bitmex.signature(api_secret, verb, path, expires, body, query)
47
51
  }
48
52
  end
49
53
  end
@@ -29,7 +29,7 @@ module Bitmex
29
29
 
30
30
  options = {}
31
31
  options[:query] = params unless params.empty?
32
- options[:headers] = rest_headers 'GET', path, '' if auth
32
+ options[:headers] = rest_headers 'GET', path, '', params if auth
33
33
 
34
34
  response = self.class.get "#{domain_url}#{path}", options
35
35
  block_given? ? yield(response) : response_handler(response)
@@ -40,7 +40,7 @@ module Bitmex
40
40
 
41
41
  options = {}
42
42
  options[:body] = body
43
- options[:headers] = rest_headers 'PUT', path, body, json: json if auth
43
+ options[:headers] = rest_headers 'PUT', path, body, nil, json: json if auth
44
44
 
45
45
  response = self.class.put "#{domain_url}#{path}", options
46
46
  block_given? ? yield(response) : response_handler(response)
@@ -51,7 +51,7 @@ module Bitmex
51
51
 
52
52
  options = {}
53
53
  options[:body] = body
54
- options[:headers] = rest_headers 'POST', path, body, json: json if auth
54
+ options[:headers] = rest_headers 'POST', path, body, nil, json: json if auth
55
55
 
56
56
  response = self.class.post "#{domain_url}#{path}", options
57
57
  block_given? ? yield(response) : response_handler(response)
@@ -62,7 +62,7 @@ module Bitmex
62
62
 
63
63
  options = {}
64
64
  options[:body] = body
65
- options[:headers] = rest_headers 'DELETE', path, body, json: json if auth
65
+ options[:headers] = rest_headers 'DELETE', path, body, nil, json: json if auth
66
66
 
67
67
  response = self.class.delete "#{domain_url}#{path}", options
68
68
  block_given? ? yield(response) : response_handler(response)
@@ -72,8 +72,8 @@ module Bitmex
72
72
  "/api/v1/#{resource}/#{action}"
73
73
  end
74
74
 
75
- def rest_headers(verb, path, body, json: true)
76
- headers = headers verb, path, body
75
+ def rest_headers(verb, path, body, query, json: true)
76
+ headers = headers verb, path, body, query
77
77
  if json
78
78
  headers['Content-Type'] = 'application/json'
79
79
  else
@@ -82,8 +82,8 @@ module Bitmex
82
82
  headers
83
83
  end
84
84
 
85
- def headers(verb, path, body)
86
- Bitmex.headers api_key, api_secret, verb, path, body
85
+ def headers(verb, path, body, query)
86
+ Bitmex.headers api_key, api_secret, verb, path, body, query
87
87
  end
88
88
 
89
89
  def response_handler(response)
@@ -1,3 +1,3 @@
1
1
  module Bitmex
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
@@ -97,7 +97,7 @@ module Bitmex
97
97
  end
98
98
 
99
99
  def headers
100
- Bitmex.headers api_key, api_secret, 'GET', '/realtime', ''
100
+ Bitmex.headers api_key, api_secret, 'GET', '/realtime', '', ''
101
101
  end
102
102
 
103
103
  # def authenticate
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitmex-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iulian Costan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-17 00:00:00.000000000 Z
11
+ date: 2019-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eventmachine
@@ -270,8 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
270
  - !ruby/object:Gem::Version
271
271
  version: '0'
272
272
  requirements: []
273
- rubyforge_project:
274
- rubygems_version: 2.7.6
273
+ rubygems_version: 3.0.4
275
274
  signing_key:
276
275
  specification_version: 4
277
276
  summary: Fully-featured, idiomatic Ruby library for BitMEX API