binance-ruby 1.2.2 → 1.2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/binance-ruby.rb +1 -0
- data/lib/binance/api/account.rb +30 -0
- data/lib/binance/api/request.rb +3 -3
- data/lib/binance/api/trade.rb +27 -0
- data/lib/binance/api/version.rb +1 -1
- metadata +4 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7aeec9cb5b5ae2a051736b1476f4f72576afb66f73034ddfc49ca19f8688a67
|
4
|
+
data.tar.gz: 1071ac47ada9058de034ca589ff513c2e9fdece3ff5bfba7200b720ac5d9a8c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59d15089228fff6d726b87f48fc691564cd8863d7c7476f9999b55bc03b5d789d419c479eb371031d670fd71014cd4a213d186674fbcb96cc7d7e174c2f59987
|
7
|
+
data.tar.gz: cefe98e599a4ca202ce0f6f99ff1904dc4e1b91562819d2af84a3ed715c664968ec2ede3841e6fe230c373cd59f3cb173f4994bfd0e192781d094e841d477267
|
data/lib/binance-ruby.rb
CHANGED
@@ -12,6 +12,7 @@ require "binance/api/margin/account"
|
|
12
12
|
require "binance/api/margin/order"
|
13
13
|
require "binance/api/order"
|
14
14
|
require "binance/api/request"
|
15
|
+
require "binance/api/trade"
|
15
16
|
require "binance/api/user_data_stream"
|
16
17
|
require "binance/api/version"
|
17
18
|
require "binance/websocket"
|
data/lib/binance/api/account.rb
CHANGED
@@ -27,6 +27,36 @@ module Binance
|
|
27
27
|
params: params.delete_if { |key, value| value.nil? },
|
28
28
|
security_type: :user_data, api_key: api_key, api_secret_key: api_secret_key)
|
29
29
|
end
|
30
|
+
|
31
|
+
# @note have not tested this for binance.us yet.
|
32
|
+
def withdraw!(coin: nil, withdrawOrderId: nil, network: nil, address: nil, addressTag: nil, amount: nil,
|
33
|
+
transactionFeeFlag: false, name: nil, recvWindow: nil, api_key: nil, api_secret_key: nil)
|
34
|
+
raise Error.new(message: "amount is required") if amount.nil?
|
35
|
+
raise Error.new(message: "coin is required") if coin.nil?
|
36
|
+
raise Error.new(message: "address is required") if address.nil?
|
37
|
+
timestamp = Configuration.timestamp
|
38
|
+
params = {
|
39
|
+
coin: coin, withdrawOrderId: withdrawOrderId, network: network, address: address, timestamp: timestamp,
|
40
|
+
addressTag: addressTag, amount: amount, transactionFeeFlag: transactionFeeFlag,
|
41
|
+
name: name, recvWindow: recvWindow,
|
42
|
+
}
|
43
|
+
Request.send!(api_key_type: :withdrawals, path: "/sapi/v1/capital/withdraw/apply",
|
44
|
+
params: params.delete_if { |key, value| value.nil? }, method: :post,
|
45
|
+
security_type: :user_data, api_key: api_key, api_secret_key: api_secret_key)
|
46
|
+
end
|
47
|
+
|
48
|
+
# If both startTime and endTime are sent, time between startTime and endTime must be less than 90 days.
|
49
|
+
def withdraw_history!(coin: nil, status: nil, offset: nil, limit: nil, startTime: nil, endTime: nil,
|
50
|
+
recvWindow: nil, api_key: nil, api_secret_key: nil)
|
51
|
+
timestamp = Configuration.timestamp
|
52
|
+
params = {
|
53
|
+
coin: coin, status: status, offset: offset, limit: limit, startTime: startTime,
|
54
|
+
endTime: endTime, recvWindow: recvWindow, timestamp: timestamp,
|
55
|
+
}
|
56
|
+
Request.send!(api_key_type: :withdrawals, path: "/sapi/v1/capital/withdraw/history",
|
57
|
+
params: params.delete_if { |key, value| value.nil? }, method: :get,
|
58
|
+
security_type: :user_data, api_key: api_key, api_secret_key: api_secret_key)
|
59
|
+
end
|
30
60
|
end
|
31
61
|
end
|
32
62
|
end
|
data/lib/binance/api/request.rb
CHANGED
@@ -19,11 +19,11 @@ module Binance
|
|
19
19
|
when :get
|
20
20
|
response = get(path, headers: all_headers, query: params)
|
21
21
|
when :post
|
22
|
-
response = post(path,
|
22
|
+
response = post(path, query: params, headers: all_headers)
|
23
23
|
when :put
|
24
|
-
response = put(path,
|
24
|
+
response = put(path, query: params, headers: all_headers)
|
25
25
|
when :delete
|
26
|
-
response = delete(path,
|
26
|
+
response = delete(path, query: params, headers: all_headers)
|
27
27
|
else
|
28
28
|
raise Error.new(message: "invalid http method used: #{method}")
|
29
29
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Binance
|
2
|
+
module Api
|
3
|
+
class Trade
|
4
|
+
class << self
|
5
|
+
def get_bnb_burn_status!(recvWindow: nil, api_key: nil, api_secret_key: nil)
|
6
|
+
timestamp = Configuration.timestamp
|
7
|
+
params = { recvWindow: recvWindow, timestamp: timestamp }
|
8
|
+
Request.send!(api_key_type: :read_info, path: "/sapi/v1/bnbBurn",
|
9
|
+
params: params.delete_if { |key, value| value.nil? },
|
10
|
+
security_type: :user_data, tld: Configuration.tld, api_key: api_key,
|
11
|
+
api_secret_key: api_secret_key)
|
12
|
+
end
|
13
|
+
|
14
|
+
def toggle_bnb_burn!(spot_bnb_burn: true, interest_bnb_burn: false, recvWindow: nil, api_key: nil,
|
15
|
+
api_secret_key: nil)
|
16
|
+
timestamp = Configuration.timestamp
|
17
|
+
params = { spotBNBBurn: spot_bnb_burn, interestBNBBurn: interest_bnb_burn,
|
18
|
+
recvWindow: recvWindow, timestamp: timestamp }
|
19
|
+
Request.send!(api_key_type: :read_info, path: "/sapi/v1/bnbBurn", method: :post,
|
20
|
+
params: params.delete_if { |key, value| value.nil? },
|
21
|
+
security_type: :user_data, tld: Configuration.tld, api_key: api_key,
|
22
|
+
api_secret_key: api_secret_key)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/binance/api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: binance-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jake Peterson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: codecov
|
@@ -182,9 +182,6 @@ dependencies:
|
|
182
182
|
name: activesupport
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
|
-
- - "~>"
|
186
|
-
- !ruby/object:Gem::Version
|
187
|
-
version: '5.1'
|
188
185
|
- - ">="
|
189
186
|
- !ruby/object:Gem::Version
|
190
187
|
version: 5.1.0
|
@@ -192,9 +189,6 @@ dependencies:
|
|
192
189
|
prerelease: false
|
193
190
|
version_requirements: !ruby/object:Gem::Requirement
|
194
191
|
requirements:
|
195
|
-
- - "~>"
|
196
|
-
- !ruby/object:Gem::Version
|
197
|
-
version: '5.1'
|
198
192
|
- - ">="
|
199
193
|
- !ruby/object:Gem::Version
|
200
194
|
version: 5.1.0
|
@@ -216,6 +210,7 @@ files:
|
|
216
210
|
- lib/binance/api/market_stream.rb
|
217
211
|
- lib/binance/api/order.rb
|
218
212
|
- lib/binance/api/request.rb
|
213
|
+
- lib/binance/api/trade.rb
|
219
214
|
- lib/binance/api/user_data_stream.rb
|
220
215
|
- lib/binance/api/version.rb
|
221
216
|
- lib/binance/websocket.rb
|
@@ -242,5 +237,5 @@ requirements: []
|
|
242
237
|
rubygems_version: 3.1.6
|
243
238
|
signing_key:
|
244
239
|
specification_version: 4
|
245
|
-
summary: binance-ruby-1.2.
|
240
|
+
summary: binance-ruby-1.2.10
|
246
241
|
test_files: []
|