fuly 0.0.3 → 0.0.8
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 +4 -4
- data/lib/bitfinex/api/funding.rb +22 -1
- data/lib/bitfinex/api/wallet.rb +23 -3
- data/lib/bitfinex/client.rb +2 -2
- metadata +3 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 755497829ab10c6188e897908c6879cf6cef7e5de0213afc0e445a3a444dbc80
|
|
4
|
+
data.tar.gz: 1048298344a80d207cf6d79f04b7ca13340346b27e6e4ea838afde3b926fa91a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eb981ca2762ea7d2751f27cef24ae10fd7d5e3b8e5f67cd3c59007b2c23dcca3daebd0a0cb381b33e372e801f2b52d132f9448d7279732279080a4884cb8acb2
|
|
7
|
+
data.tar.gz: 7582a3616391a4720fb1ae865ccfff7ddfc05b81aaed119fa547c466381d0361ddb203b1d7b65cc057098f717fefa6ae9b34a56d89736e82f17ba32b3626c025
|
data/lib/bitfinex/api/funding.rb
CHANGED
|
@@ -10,6 +10,7 @@ module Bitfinex
|
|
|
10
10
|
|
|
11
11
|
# 列出所有正在掛單
|
|
12
12
|
# Ratelimit: 45 req/min
|
|
13
|
+
# https://docs.bitfinex.com/reference#rest-auth-funding-offers
|
|
13
14
|
def funding_offers_all
|
|
14
15
|
res = request("auth/r/funding/offers").body
|
|
15
16
|
return JSON.parse(res)
|
|
@@ -24,6 +25,7 @@ module Bitfinex
|
|
|
24
25
|
end
|
|
25
26
|
|
|
26
27
|
# 取消指定掛單
|
|
28
|
+
# https://docs.bitfinex.com/reference#rest-auth-cancel-order
|
|
27
29
|
def funding_cancel_offer(id)
|
|
28
30
|
res = request("auth/w/funding/offer/cancel", {
|
|
29
31
|
id: id,
|
|
@@ -31,6 +33,14 @@ module Bitfinex
|
|
|
31
33
|
return JSON.parse(res)
|
|
32
34
|
end
|
|
33
35
|
|
|
36
|
+
# https://docs.bitfinex.com/reference#rest-auth-cancel-all-funding-offers
|
|
37
|
+
def funding_cancel_all_offers(currency = "USD")
|
|
38
|
+
res = request("auth/w/funding/offer/cancel/all", {
|
|
39
|
+
currency: currency,
|
|
40
|
+
}).body
|
|
41
|
+
return JSON.parse(res)
|
|
42
|
+
end
|
|
43
|
+
|
|
34
44
|
# 掛單
|
|
35
45
|
# https://docs.bitfinex.com/reference#submit-funding-offer
|
|
36
46
|
def funding_create_offer(currency, amount, rate, period)
|
|
@@ -45,6 +55,7 @@ module Bitfinex
|
|
|
45
55
|
}).body
|
|
46
56
|
end
|
|
47
57
|
|
|
58
|
+
# https://docs.bitfinex.com/v1/reference#rest-auth-offers
|
|
48
59
|
def funding_new_offer(params)
|
|
49
60
|
res = v1_request("offer/new", params)
|
|
50
61
|
res = JSON.parse(res)
|
|
@@ -54,9 +65,19 @@ module Bitfinex
|
|
|
54
65
|
# 所有正在借款列表
|
|
55
66
|
# Ratelimit: 45 req/min
|
|
56
67
|
# https://docs.bitfinex.com/reference#rest-auth-funding-credits
|
|
57
|
-
def
|
|
68
|
+
def funding_credit_all
|
|
58
69
|
res = request("auth/r/funding/credits").body
|
|
59
70
|
return JSON.parse(res)
|
|
60
71
|
end
|
|
72
|
+
|
|
73
|
+
def funding_credit(currency = "fUSD")
|
|
74
|
+
res = request("auth/r/funding/credits/#{currency}").body
|
|
75
|
+
return JSON.parse(res)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def funding_loans(currency = "fUSD")
|
|
79
|
+
res = request("auth/r/funding/loans/#{currency}").body
|
|
80
|
+
return JSON.parse(res)
|
|
81
|
+
end
|
|
61
82
|
end
|
|
62
83
|
end
|
data/lib/bitfinex/api/wallet.rb
CHANGED
|
@@ -1,25 +1,45 @@
|
|
|
1
1
|
module Bitfinex
|
|
2
2
|
module Wallet
|
|
3
3
|
# Ratelimit: 45 req/min
|
|
4
|
-
#
|
|
4
|
+
# https://docs.bitfinex.com/reference#rest-auth-movements
|
|
5
|
+
def movements
|
|
6
|
+
res = request("auth/r/movements/hist").body
|
|
7
|
+
return JSON.parse(res)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# Ratelimit: 45 req/min
|
|
5
11
|
# https://docs.bitfinex.com/reference#rest-auth-wallets
|
|
6
12
|
def wallets
|
|
7
13
|
res = request("auth/r/wallets").body
|
|
8
14
|
return JSON.parse(res)
|
|
9
15
|
end
|
|
10
16
|
|
|
17
|
+
# 45 req/min
|
|
18
|
+
# https://docs.bitfinex.com/reference#rest-auth-ledgers
|
|
19
|
+
def ledgers(currency)
|
|
20
|
+
res = request("auth/r/ledgers/#{currency}/hist", {
|
|
21
|
+
limit: 500,
|
|
22
|
+
category: 28,
|
|
23
|
+
}).body
|
|
24
|
+
return JSON.parse(res)
|
|
25
|
+
end
|
|
26
|
+
|
|
11
27
|
# Ratelimit: 45 req/min
|
|
12
|
-
|
|
28
|
+
# https://docs.bitfinex.com/reference#rest-auth-wallets-hist
|
|
29
|
+
def wallets_history(currency)
|
|
13
30
|
request("auth/r/wallets/hist", {
|
|
31
|
+
currency: currency,
|
|
14
32
|
end: (Time.now.to_f * 1000).floor,
|
|
15
33
|
}).body
|
|
16
34
|
end
|
|
17
35
|
|
|
18
36
|
# Ratelimit: 30 req/min
|
|
37
|
+
# https://docs.bitfinex.com/reference#rest-auth-calc-order-avail
|
|
19
38
|
def available_currency(currency)
|
|
20
39
|
res = request("auth/calc/order/avail", {
|
|
21
40
|
symbol: currency,
|
|
22
|
-
|
|
41
|
+
dir: 1,
|
|
42
|
+
type: "FUNDING",
|
|
23
43
|
}).body
|
|
24
44
|
res = JSON.parse(res)
|
|
25
45
|
return res[0].abs
|
data/lib/bitfinex/client.rb
CHANGED
|
@@ -16,7 +16,7 @@ module Bitfinex
|
|
|
16
16
|
|
|
17
17
|
def request(url, options = {})
|
|
18
18
|
body = options || {}
|
|
19
|
-
nonce = (Time.now.to_f * 1000).
|
|
19
|
+
nonce = ((Time.now.to_f * 1000).floor * 1000).to_s
|
|
20
20
|
payload = "/api/v2/#{url}#{nonce}#{body.to_json}"
|
|
21
21
|
sign = OpenSSL::HMAC.hexdigest("sha384", @api_secret, payload)
|
|
22
22
|
|
|
@@ -44,7 +44,7 @@ module Bitfinex
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def v1_request(url, options = {})
|
|
47
|
-
nonce = (Time.now.to_f * 1000).floor.to_s
|
|
47
|
+
nonce = ((Time.now.to_f * 1000).floor * 1000).to_s
|
|
48
48
|
url = "/v1/#{url}"
|
|
49
49
|
payload = build_payload(url, options, nonce)
|
|
50
50
|
headers = {
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fuly
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rex Chen
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-12-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: httparty
|
|
@@ -54,8 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
54
54
|
- !ruby/object:Gem::Version
|
|
55
55
|
version: '0'
|
|
56
56
|
requirements: []
|
|
57
|
-
|
|
58
|
-
rubygems_version: 2.7.7
|
|
57
|
+
rubygems_version: 3.0.3
|
|
59
58
|
signing_key:
|
|
60
59
|
specification_version: 4
|
|
61
60
|
summary: Fuly API Wrapper
|