okex-ruby-api 0.1.0 → 0.2.0
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/Gemfile.lock +1 -1
- data/README.md +23 -6
- data/lib/okex/api/markets.rb +22 -0
- data/lib/okex/api/version.rb +1 -1
- data/lib/okex/api.rb +1 -1
- metadata +2 -2
- data/lib/okex/api/futures.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afa60a5ac3bcd6673a4c8baafe0ad83345e177a257a87daf52f6320efd4dddef
|
4
|
+
data.tar.gz: e5b6c80f4fd1f9a9916055f74fcc41b724f030760e893b1fb1575d4da7dfe365
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e66a83ee46f8231a5dc18f632a908cd293f173b9ea451f5ad2acc7f0f7c54ae558b212451cdc6aae99a749421238a8a21f6c055fd542687ad2cfe78e34ef5d1d
|
7
|
+
data.tar.gz: c7b582ecdc31bd71656d4769a3b95a8228b1fc90c670ea99862318e37718284a88af4b1d5c0782bc2e429720e9e4c89b5f997af1da0d7a124eeaf1cfb9bf6a36
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -23,28 +23,45 @@ Or install it yourself as:
|
|
23
23
|
|
24
24
|
## Usage
|
25
25
|
|
26
|
-
###
|
26
|
+
### Markets
|
27
27
|
|
28
|
-
Initialize a
|
28
|
+
Initialize a markets session:
|
29
29
|
```ruby
|
30
|
-
|
30
|
+
markets = OKEX::API::Markets.new
|
31
31
|
```
|
32
32
|
|
33
33
|
Query for all current futures specs:
|
34
34
|
```ruby
|
35
|
-
|
35
|
+
markets.list(type: :futures)
|
36
|
+
```
|
37
|
+
|
38
|
+
Query for all current spot specs:
|
39
|
+
```ruby
|
40
|
+
markets.list(type: :spot)
|
36
41
|
```
|
37
42
|
|
38
43
|
Query for all current futures prices:
|
39
44
|
```ruby
|
40
|
-
|
45
|
+
markets.tickers(type: :futures)
|
46
|
+
```
|
47
|
+
|
48
|
+
Query for all current spot prices:
|
49
|
+
```ruby
|
50
|
+
markets.tickers(type: :spot)
|
41
51
|
```
|
42
52
|
|
43
53
|
Fetch a single current futures price:
|
44
54
|
```ruby
|
45
|
-
|
55
|
+
markets.ticker('BTC-USDT-220325', type: :futures)
|
46
56
|
```
|
47
57
|
|
58
|
+
Fetch a single current spot price:
|
59
|
+
```ruby
|
60
|
+
markets.ticker('BTC-USDT', type: :spot)
|
61
|
+
```
|
62
|
+
|
63
|
+
> Note: type is optional and defaults to 'spot'.
|
64
|
+
|
48
65
|
## Development
|
49
66
|
|
50
67
|
After checking out the repo, run `bin/setup` to install dependencies.
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'public'
|
4
|
+
|
5
|
+
class OKEX::API::Markets < OKEX::API::Public
|
6
|
+
|
7
|
+
def list(type: :spot)
|
8
|
+
raise ArgumentError, "type must be either 'futures' or 'spot'" unless %w(futures spot).include?(type.to_s)
|
9
|
+
send_request(:get, "/#{type.to_s}/v3/instruments", {})
|
10
|
+
end
|
11
|
+
|
12
|
+
def tickers(type: :spot)
|
13
|
+
raise ArgumentError, "type must be either 'futures' or 'spot'" unless %w(futures spot).include?(type.to_s)
|
14
|
+
send_request(:get, "/#{type.to_s}/v3/instruments/ticker", {})
|
15
|
+
end
|
16
|
+
|
17
|
+
def ticker(futures_name, type: :spot)
|
18
|
+
raise ArgumentError, "type must be either 'futures' or 'spot'" unless %w(futures spot).include?(type.to_s)
|
19
|
+
send_request(:get, "/#{type.to_s}/v3/instruments/#{futures_name}/ticker", {})
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
data/lib/okex/api/version.rb
CHANGED
data/lib/okex/api.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: okex-ruby-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- benrs44
|
@@ -61,7 +61,7 @@ files:
|
|
61
61
|
- lib/okex/api.rb
|
62
62
|
- lib/okex/api/base.rb
|
63
63
|
- lib/okex/api/config.rb
|
64
|
-
- lib/okex/api/
|
64
|
+
- lib/okex/api/markets.rb
|
65
65
|
- lib/okex/api/private.rb
|
66
66
|
- lib/okex/api/public.rb
|
67
67
|
- lib/okex/api/version.rb
|
data/lib/okex/api/futures.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'public'
|
4
|
-
|
5
|
-
class OKEX::API::Futures < OKEX::API::Public
|
6
|
-
|
7
|
-
def list
|
8
|
-
send_request(:get, '/futures/v3/instruments', {})
|
9
|
-
end
|
10
|
-
|
11
|
-
def tickers
|
12
|
-
send_request(:get, '/futures/v3/instruments/ticker', {})
|
13
|
-
end
|
14
|
-
|
15
|
-
def ticker(futures_name)
|
16
|
-
send_request(:get, "/futures/v3/instruments/#{futures_name}/ticker", {})
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|