binance_client 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +21 -19
- data/README.md +3 -2
- data/binance_client.gemspec +1 -0
- data/lib/binance_client/client.rb +1 -0
- data/lib/binance_client/models/base_model.rb +7 -0
- data/lib/binance_client/models/order_book.rb +40 -0
- data/lib/binance_client/models/order_book_entry.rb +8 -0
- data/lib/binance_client/requests/order_book_depth_request.rb +18 -0
- data/lib/binance_client/responses/order_book_depth_response.rb +14 -0
- data/lib/binance_client/version.rb +1 -1
- data/lib/binance_client.rb +6 -0
- metadata +22 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b8e52b3c3199ac128f970071e84b73cc25781a92f2206170b1513d523321631
|
4
|
+
data.tar.gz: 81f4c9e55772be4cb4ba350c764ebca822d66d541cb560a6477fe5e6ae0bd91e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfb4049818b8846b1e2bcb1913ff473b9d9a9c782aab2a7dfc9b7b6cd262a2144aa17530fc2aeccccd4314df0a77f074c5b9ffa5afad615ab269b645edcb9e09
|
7
|
+
data.tar.gz: 55054e667ceb9219fdb4098dcbd14257126d8568a463eb8fbe28692d0b545587ce30a1d1372f30141b688b5ad06402e88469f6b484079f91c028b6884b958069
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [1.1.0]
|
8
|
+
### Added
|
9
|
+
- `order_book_depth` (`/api/v3/depth`) to get a snapshot of the order book
|
10
|
+
|
7
11
|
## [1.0.0]
|
8
12
|
### Fixed
|
9
13
|
- Avoid "Signature for this request is not valid" errors by using the same timestamp
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
binance_client (1.
|
4
|
+
binance_client (1.1.0)
|
5
5
|
activesupport
|
6
6
|
api_client_base
|
7
7
|
typhoeus
|
@@ -9,15 +9,15 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (6.
|
12
|
+
activesupport (6.1.4.1)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
-
i18n (>=
|
15
|
-
minitest (
|
16
|
-
tzinfo (~>
|
17
|
-
zeitwerk (~> 2.
|
14
|
+
i18n (>= 1.6, < 2)
|
15
|
+
minitest (>= 5.1)
|
16
|
+
tzinfo (~> 2.0)
|
17
|
+
zeitwerk (~> 2.3)
|
18
18
|
addressable (2.7.0)
|
19
19
|
public_suffix (>= 2.0.2, < 5.0)
|
20
|
-
api_client_base (1.
|
20
|
+
api_client_base (1.10.0)
|
21
21
|
activesupport (>= 3.0)
|
22
22
|
gem_config (>= 0.3.1)
|
23
23
|
virtus (>= 1.0)
|
@@ -29,23 +29,22 @@ GEM
|
|
29
29
|
coderay (1.1.3)
|
30
30
|
coercible (1.0.0)
|
31
31
|
descendants_tracker (~> 0.0.1)
|
32
|
-
concurrent-ruby (1.1.
|
32
|
+
concurrent-ruby (1.1.9)
|
33
33
|
crack (0.4.3)
|
34
34
|
safe_yaml (~> 1.0.0)
|
35
35
|
descendants_tracker (0.0.4)
|
36
36
|
thread_safe (~> 0.3, >= 0.3.1)
|
37
37
|
diff-lcs (1.4.4)
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
ffi (1.13.1)
|
38
|
+
ethon (0.14.0)
|
39
|
+
ffi (>= 1.15.0)
|
40
|
+
ffi (1.15.4)
|
42
41
|
gem_config (0.3.2)
|
43
42
|
hashdiff (1.0.1)
|
44
|
-
i18n (1.8.
|
43
|
+
i18n (1.8.10)
|
45
44
|
concurrent-ruby (~> 1.0)
|
46
45
|
ice_nine (0.11.2)
|
47
46
|
method_source (1.0.0)
|
48
|
-
minitest (5.14.
|
47
|
+
minitest (5.14.4)
|
49
48
|
pry (0.13.1)
|
50
49
|
coderay (~> 1.1)
|
51
50
|
method_source (~> 1.0)
|
@@ -63,6 +62,9 @@ GEM
|
|
63
62
|
rspec-expectations (3.9.2)
|
64
63
|
diff-lcs (>= 1.2.0, < 2.0)
|
65
64
|
rspec-support (~> 3.9.0)
|
65
|
+
rspec-its (1.3.0)
|
66
|
+
rspec-core (>= 3.0.0)
|
67
|
+
rspec-expectations (>= 3.0.0)
|
66
68
|
rspec-mocks (3.9.1)
|
67
69
|
diff-lcs (>= 1.2.0, < 2.0)
|
68
70
|
rspec-support (~> 3.9.0)
|
@@ -71,14 +73,13 @@ GEM
|
|
71
73
|
thread_safe (0.3.6)
|
72
74
|
typhoeus (1.4.0)
|
73
75
|
ethon (>= 0.9.0)
|
74
|
-
tzinfo (
|
75
|
-
|
76
|
+
tzinfo (2.0.4)
|
77
|
+
concurrent-ruby (~> 1.0)
|
76
78
|
vcr (6.0.0)
|
77
|
-
virtus (
|
79
|
+
virtus (2.0.0)
|
78
80
|
axiom-types (~> 0.1)
|
79
81
|
coercible (~> 1.0)
|
80
82
|
descendants_tracker (~> 0.0, >= 0.0.3)
|
81
|
-
equalizer (~> 0.0, >= 0.0.9)
|
82
83
|
webmock (3.9.1)
|
83
84
|
addressable (>= 2.3.6)
|
84
85
|
crack (>= 0.3.2)
|
@@ -93,8 +94,9 @@ DEPENDENCIES
|
|
93
94
|
pry-byebug
|
94
95
|
rake (~> 12.0)
|
95
96
|
rspec (~> 3.0)
|
97
|
+
rspec-its
|
96
98
|
vcr
|
97
99
|
webmock
|
98
100
|
|
99
101
|
BUNDLED WITH
|
100
|
-
2.
|
102
|
+
2.2.24
|
data/README.md
CHANGED
@@ -21,8 +21,8 @@ Or install it yourself as:
|
|
21
21
|
## Authenticate
|
22
22
|
```
|
23
23
|
client = BinanceClient.new(
|
24
|
-
|
25
|
-
|
24
|
+
api_key: "your-api-key",
|
25
|
+
api_secret: "your-api-secret"
|
26
26
|
)
|
27
27
|
```
|
28
28
|
|
@@ -36,6 +36,7 @@ client.system_status
|
|
36
36
|
client.account_snapshot
|
37
37
|
client.get_all
|
38
38
|
client.book_ticker(symbol: "BTCETH")
|
39
|
+
client.order_book_depth(symbol: "BTCUSDT", limit: 100)
|
39
40
|
```
|
40
41
|
|
41
42
|
## Responses
|
data/binance_client.gemspec
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
module BinanceClient
|
2
|
+
class OrderBook < BaseModel
|
3
|
+
|
4
|
+
attribute :body, Hash
|
5
|
+
attribute(:last_update_id, Integer, {
|
6
|
+
lazy: true,
|
7
|
+
default: :default_last_update_id,
|
8
|
+
})
|
9
|
+
attribute(:bids, Array[BinanceClient::OrderBookEntry], {
|
10
|
+
lazy: true,
|
11
|
+
default: :default_bids,
|
12
|
+
})
|
13
|
+
attribute(:asks, Array[BinanceClient::OrderBookEntry], {
|
14
|
+
lazy: true,
|
15
|
+
default: :default_asks,
|
16
|
+
})
|
17
|
+
|
18
|
+
def default_last_update_id
|
19
|
+
body["lastUpdateId"]
|
20
|
+
end
|
21
|
+
|
22
|
+
def default_bids
|
23
|
+
_entries_from body["bids"]
|
24
|
+
end
|
25
|
+
|
26
|
+
def default_asks
|
27
|
+
_entries_from body["asks"]
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def _entries_from(array)
|
33
|
+
array.map do |raw_entry|
|
34
|
+
price, quantity = raw_entry
|
35
|
+
OrderBookEntry.new(price: price, quantity: quantity)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module BinanceClient
|
2
|
+
class OrderBookDepthRequest < BaseRequest
|
3
|
+
|
4
|
+
attribute :symbol, String
|
5
|
+
attribute :limit, Integer
|
6
|
+
|
7
|
+
def path
|
8
|
+
"/api/v3/depth"
|
9
|
+
end
|
10
|
+
|
11
|
+
def params
|
12
|
+
h = {symbol: symbol}
|
13
|
+
h[:limit] = limit if not limit.nil?
|
14
|
+
h.to_query
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
data/lib/binance_client.rb
CHANGED
@@ -7,16 +7,22 @@ require "openssl"
|
|
7
7
|
|
8
8
|
require "binance_client/client"
|
9
9
|
|
10
|
+
require "binance_client/models/base_model"
|
11
|
+
require "binance_client/models/order_book_entry"
|
12
|
+
require "binance_client/models/order_book"
|
13
|
+
|
10
14
|
require "binance_client/requests/base_request"
|
11
15
|
require "binance_client/responses/base_response"
|
12
16
|
require "binance_client/requests/system_status_request"
|
13
17
|
require "binance_client/requests/account_snapshot_request"
|
14
18
|
require "binance_client/requests/get_all_request"
|
15
19
|
require "binance_client/requests/book_ticker_request"
|
20
|
+
require "binance_client/requests/order_book_depth_request"
|
16
21
|
require "binance_client/responses/system_status_response"
|
17
22
|
require "binance_client/responses/account_snapshot_response"
|
18
23
|
require "binance_client/responses/get_all_response"
|
19
24
|
require "binance_client/responses/book_ticker_response"
|
25
|
+
require "binance_client/responses/order_book_depth_response"
|
20
26
|
|
21
27
|
module BinanceClient
|
22
28
|
class Error < StandardError; end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: binance_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AJ Villalobos
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: api_client_base
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec-its
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
description: Ruby wrapper for Binance API
|
84
98
|
email:
|
85
99
|
- hi@ajvillalobos.com
|
@@ -102,15 +116,20 @@ files:
|
|
102
116
|
- binance_client.gemspec
|
103
117
|
- lib/binance_client.rb
|
104
118
|
- lib/binance_client/client.rb
|
119
|
+
- lib/binance_client/models/base_model.rb
|
120
|
+
- lib/binance_client/models/order_book.rb
|
121
|
+
- lib/binance_client/models/order_book_entry.rb
|
105
122
|
- lib/binance_client/requests/account_snapshot_request.rb
|
106
123
|
- lib/binance_client/requests/base_request.rb
|
107
124
|
- lib/binance_client/requests/book_ticker_request.rb
|
108
125
|
- lib/binance_client/requests/get_all_request.rb
|
126
|
+
- lib/binance_client/requests/order_book_depth_request.rb
|
109
127
|
- lib/binance_client/requests/system_status_request.rb
|
110
128
|
- lib/binance_client/responses/account_snapshot_response.rb
|
111
129
|
- lib/binance_client/responses/base_response.rb
|
112
130
|
- lib/binance_client/responses/book_ticker_response.rb
|
113
131
|
- lib/binance_client/responses/get_all_response.rb
|
132
|
+
- lib/binance_client/responses/order_book_depth_response.rb
|
114
133
|
- lib/binance_client/responses/system_status_response.rb
|
115
134
|
- lib/binance_client/version.rb
|
116
135
|
homepage: https://github.com/bloom-solutions/binance_client-ruby
|
@@ -135,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
154
|
- !ruby/object:Gem::Version
|
136
155
|
version: '0'
|
137
156
|
requirements: []
|
138
|
-
rubygems_version: 3.
|
157
|
+
rubygems_version: 3.1.6
|
139
158
|
signing_key:
|
140
159
|
specification_version: 4
|
141
160
|
summary: Ruby wrapper for Binance API
|