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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be471f1211cee30497ce74db4b05da88d05345bc8ada1966d26495db15f18890
4
- data.tar.gz: e7ee23d92d2cf4782b2fcdbdf2c09232460ccafaeb0de6b09bf686bdb3cf4e55
3
+ metadata.gz: 034ffdddca45eba8aefa59494ee718e329324b637f50585412eea9500a17011f
4
+ data.tar.gz: 6a19fc208851effb64df469a145d6ac76a94ea3ad6b2b4c338f07d99b7de57dd
5
5
  SHA512:
6
- metadata.gz: 552a6ed552f1b7ac7fa6063feb2698dd06d6693f38b20cee6fb07cf9bd6eb9b45ac8b3a7db2b1c5210c9dbc5eda695e638508785dce980045f8eadd57d337f68
7
- data.tar.gz: 4c4f43ce73556ef89af1139f665ba24cb39d83837db32e4461054d8fef9aba8bfa2c6a0801827e92c3dba303814d5aab359443dd37e22df18acccf20b8adb8c4
6
+ metadata.gz: e04b01cdc2240f3a69d8f3f7d2751d02f932fca080ee118918444a63b33b498cef423a090eaeeb5537244cb0513107a82e88ab9dc120f0e738df1c6465359d06
7
+ data.tar.gz: e8edc6cceb16276c0803185f1f025256e5b419d880dffc8487f53a1195e1b715b00cccc391be790229b8ba49d3c403fb1e2e03e1a54a6848654c39a9abb0190d
data/CHANGELOG.md CHANGED
@@ -25,4 +25,7 @@
25
25
  - Implement Fills endpoint including tests
26
26
 
27
27
  ## [0.2.7] - 2021-10-06
28
- - Implement orders get_by_client_id endpoint
28
+ - Implement orders get_by_client_id endpoint
29
+
30
+ ## [0.2.8] - 2021-10-18
31
+ - Implement funding endpoints
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ftx-api (0.2.7)
4
+ ftx-api (0.2.8)
5
5
  httparty (~> 0.19)
6
6
  openssl (~> 2.2)
7
7
 
@@ -69,4 +69,4 @@ DEPENDENCIES
69
69
  simplecov (< 0.18)
70
70
 
71
71
  BUNDLED WITH
72
- 2.2.27
72
+ 2.2.29
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 an fills session:
174
+ Initialize a fills session:
163
175
  ```ruby
164
- fills = FXT::API::Orders.new(key: 'YOUR FTX KEY', secret: 'YOUR FTX SECRET')
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.dig(:key)
15
- @secret = args.dig(:secret)
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
@@ -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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module FTX
4
4
  module API
5
- VERSION = "0.2.7"
5
+ VERSION = "0.2.8"
6
6
  end
7
7
  end
data/lib/ftx/api.rb CHANGED
@@ -8,4 +8,5 @@ require_relative "api/account"
8
8
  require_relative "api/wallet"
9
9
  require_relative "api/orders"
10
10
  require_relative "api/fills"
11
+ require_relative "api/funding"
11
12
  require_relative "api/convert"
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.7
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-06 00:00:00.000000000 Z
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