ftx-api 0.2.7 → 0.2.8
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 -1
- data/Gemfile.lock +2 -2
- data/README.md +38 -7
- data/lib/ftx/api/base.rb +2 -2
- data/lib/ftx/api/funding.rb +15 -0
- data/lib/ftx/api/futures.rb +8 -0
- data/lib/ftx/api/version.rb +1 -1
- data/lib/ftx/api.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 034ffdddca45eba8aefa59494ee718e329324b637f50585412eea9500a17011f
|
4
|
+
data.tar.gz: 6a19fc208851effb64df469a145d6ac76a94ea3ad6b2b4c338f07d99b7de57dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e04b01cdc2240f3a69d8f3f7d2751d02f932fca080ee118918444a63b33b498cef423a090eaeeb5537244cb0513107a82e88ab9dc120f0e738df1c6465359d06
|
7
|
+
data.tar.gz: e8edc6cceb16276c0803185f1f025256e5b419d880dffc8487f53a1195e1b715b00cccc391be790229b8ba49d3c403fb1e2e03e1a54a6848654c39a9abb0190d
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -23,7 +23,7 @@ Or install it yourself as:
|
|
23
23
|
|
24
24
|
## Usage
|
25
25
|
|
26
|
-
### Markets
|
26
|
+
### Markets (public)
|
27
27
|
|
28
28
|
Initialize a markets session:
|
29
29
|
```ruby
|
@@ -51,9 +51,9 @@ markets.historic('BTC/USD', resolution: 86400*30)
|
|
51
51
|
```
|
52
52
|
*Check the [FTX API docs](https://docs.ftx.com/?python#get-historical-prices) for additional parameters such as start_time and end_time*
|
53
53
|
|
54
|
-
Note: resolution is in seconds so 86,400 would be the number of seconds in a day. As a default, the API responds with 12 months of historical prices.
|
54
|
+
> Note: resolution is in seconds so 86,400 would be the number of seconds in a day. As a default, the API responds with 12 months of historical prices.
|
55
55
|
|
56
|
-
### Futures
|
56
|
+
### Futures (public)
|
57
57
|
|
58
58
|
Initialize a futures session:
|
59
59
|
```ruby
|
@@ -70,6 +70,18 @@ Fetch a single market price:
|
|
70
70
|
futures.get('BTC-PERP')
|
71
71
|
```
|
72
72
|
|
73
|
+
Fetch stats for a future:
|
74
|
+
```ruby
|
75
|
+
futures.stats('BTC-PERP')
|
76
|
+
```
|
77
|
+
|
78
|
+
Fetch all or one funding rates:
|
79
|
+
```ruby
|
80
|
+
futures.funding_rates(future: 'BTC-PERP')
|
81
|
+
```
|
82
|
+
|
83
|
+
> Note: future is optional, start_time and end_time are also accepted per the FTX API docs
|
84
|
+
|
73
85
|
### Account
|
74
86
|
|
75
87
|
Initialize an account session:
|
@@ -153,15 +165,15 @@ args = {
|
|
153
165
|
orders.create(args)
|
154
166
|
```
|
155
167
|
|
156
|
-
Note: the create order method is not included as a test, because I have not been able to find FTX test keys and it seems a bit ridiculous to execute a live order for testing.
|
168
|
+
> Note: the create order method is not included as a test, because I have not been able to find FTX test keys and it seems a bit ridiculous to execute a live order for testing.
|
157
169
|
|
158
170
|
*Check the [FTX API docs](https://docs.ftx.com/#orders) for all parameters*
|
159
171
|
|
160
172
|
### Fills
|
161
173
|
|
162
|
-
Initialize
|
174
|
+
Initialize a fills session:
|
163
175
|
```ruby
|
164
|
-
fills = FXT::API::
|
176
|
+
fills = FXT::API::Fills.new(key: 'YOUR FTX KEY', secret: 'YOUR FTX SECRET')
|
165
177
|
```
|
166
178
|
|
167
179
|
Query for all fills:
|
@@ -174,7 +186,26 @@ or
|
|
174
186
|
fills.list(market: 'BTC/USD')
|
175
187
|
```
|
176
188
|
|
177
|
-
Note: market is optional
|
189
|
+
> Note: market is optional
|
190
|
+
|
191
|
+
### Funding
|
192
|
+
|
193
|
+
Initialize a funding session:
|
194
|
+
```ruby
|
195
|
+
funding = FXT::API::Funding.new(key: 'YOUR FTX KEY', secret: 'YOUR FTX SECRET')
|
196
|
+
```
|
197
|
+
|
198
|
+
Query for all or one funding payments:
|
199
|
+
```ruby
|
200
|
+
funding.payments(future: 'BTC-PERP')
|
201
|
+
```
|
202
|
+
|
203
|
+
Query for all or one funding rates:
|
204
|
+
```ruby
|
205
|
+
funding.rates(future: 'BTC-PERP')
|
206
|
+
```
|
207
|
+
|
208
|
+
> Note: future is optional, start_time and end_time are also accepted per the FTX API docs
|
178
209
|
|
179
210
|
### Convert Coins
|
180
211
|
|
data/lib/ftx/api/base.rb
CHANGED
@@ -11,8 +11,8 @@ class FTX::API::Base
|
|
11
11
|
|
12
12
|
def initialize(args = {})
|
13
13
|
@config = FTX::API::Config.new(args.dig(:config))
|
14
|
-
@key = args.
|
15
|
-
@secret = args.
|
14
|
+
@key = args.fetch(:key, ENV['FTX_KEY'])
|
15
|
+
@secret = args.fetch(:secret, ENV['FTX_SECRET'])
|
16
16
|
end
|
17
17
|
|
18
18
|
protected
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'private'
|
4
|
+
|
5
|
+
class FTX::API::Funding < FTX::API::Private
|
6
|
+
|
7
|
+
def payments(query = {})
|
8
|
+
send_request(:get, '/funding_payments', query)
|
9
|
+
end
|
10
|
+
|
11
|
+
def rates(query = {})
|
12
|
+
send_request(:get, '/funding_rates', query)
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
data/lib/ftx/api/futures.rb
CHANGED
@@ -11,5 +11,13 @@ class FTX::API::Futures < FTX::API::Public
|
|
11
11
|
def get(futures_name)
|
12
12
|
send_request(:get, "/futures/#{futures_name}", {})
|
13
13
|
end
|
14
|
+
|
15
|
+
def stats(futures_name)
|
16
|
+
send_request(:get, "/futures/#{futures_name}/stats", {})
|
17
|
+
end
|
18
|
+
|
19
|
+
def funding_rates(query = {})
|
20
|
+
send_request(:get, '/funding_rates', query)
|
21
|
+
end
|
14
22
|
|
15
23
|
end
|
data/lib/ftx/api/version.rb
CHANGED
data/lib/ftx/api.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ftx-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- benrs44
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -65,6 +65,7 @@ files:
|
|
65
65
|
- lib/ftx/api/config.rb
|
66
66
|
- lib/ftx/api/convert.rb
|
67
67
|
- lib/ftx/api/fills.rb
|
68
|
+
- lib/ftx/api/funding.rb
|
68
69
|
- lib/ftx/api/futures.rb
|
69
70
|
- lib/ftx/api/markets.rb
|
70
71
|
- lib/ftx/api/orders.rb
|