luno 0.2.6 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Gemfile.lock +38 -40
- data/lib/luno/markets.rb +11 -1
- data/lib/luno/orders.rb +70 -0
- data/lib/luno/other_data.rb +2 -2
- data/lib/luno/version.rb +1 -1
- data/luno.gemspec +10 -10
- metadata +23 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f00f1f9e35506b4fa82dc15967f212fce73ea7e93cdae4e0547266bd68fae42d
|
4
|
+
data.tar.gz: ae6d80c7d75420f0e1449e6cf3c993272d8c4d9bdcee00f641ee18f184cf0794
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3a3f2b9b84599d48cb751b3afd50a0c8e0587b6951e8a22a5d00f5b791f66d889279a80e4b929bf767974b58e06b7c635fdd57dc6d5674baae9a8cbe24b6f1c
|
7
|
+
data.tar.gz: 1cc1646d212753de58ee615ab43c33b70785217fae74d517596ee10272981c3be646f4e0df901a8cb74896629b41c08a1fd3a5a1ed876e24514cfcd6be878956
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.0
|
1
|
+
3.1.0
|
data/Gemfile.lock
CHANGED
@@ -1,39 +1,38 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
luno (0.2.
|
5
|
-
active_attr (~> 0.15.
|
4
|
+
luno (0.2.10)
|
5
|
+
active_attr (~> 0.15.4)
|
6
6
|
httparty (~> 0.20.0)
|
7
|
-
nokogiri (~> 1.
|
7
|
+
nokogiri (~> 1.13.1)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
actionpack (
|
13
|
-
actionview (=
|
14
|
-
activesupport (=
|
15
|
-
rack (~> 2.0, >= 2.0
|
12
|
+
actionpack (7.0.1)
|
13
|
+
actionview (= 7.0.1)
|
14
|
+
activesupport (= 7.0.1)
|
15
|
+
rack (~> 2.0, >= 2.2.0)
|
16
16
|
rack-test (>= 0.6.3)
|
17
17
|
rails-dom-testing (~> 2.0)
|
18
18
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
19
|
-
actionview (
|
20
|
-
activesupport (=
|
19
|
+
actionview (7.0.1)
|
20
|
+
activesupport (= 7.0.1)
|
21
21
|
builder (~> 3.1)
|
22
22
|
erubi (~> 1.4)
|
23
23
|
rails-dom-testing (~> 2.0)
|
24
24
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
25
|
-
active_attr (0.15.
|
26
|
-
actionpack (>= 3.0.2, < 7.
|
27
|
-
activemodel (>= 3.0.2, < 7.
|
28
|
-
activesupport (>= 3.0.2, < 7.
|
29
|
-
activemodel (
|
30
|
-
activesupport (=
|
31
|
-
activesupport (
|
25
|
+
active_attr (0.15.4)
|
26
|
+
actionpack (>= 3.0.2, < 7.1)
|
27
|
+
activemodel (>= 3.0.2, < 7.1)
|
28
|
+
activesupport (>= 3.0.2, < 7.1)
|
29
|
+
activemodel (7.0.1)
|
30
|
+
activesupport (= 7.0.1)
|
31
|
+
activesupport (7.0.1)
|
32
32
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
33
33
|
i18n (>= 1.6, < 2)
|
34
34
|
minitest (>= 5.1)
|
35
35
|
tzinfo (~> 2.0)
|
36
|
-
zeitwerk (~> 2.3)
|
37
36
|
addressable (2.8.0)
|
38
37
|
public_suffix (>= 2.0.2, < 5.0)
|
39
38
|
ansi (1.5.0)
|
@@ -48,32 +47,32 @@ GEM
|
|
48
47
|
httparty (0.20.0)
|
49
48
|
mime-types (~> 3.0)
|
50
49
|
multi_xml (>= 0.5.2)
|
51
|
-
i18n (1.8.
|
50
|
+
i18n (1.8.11)
|
52
51
|
concurrent-ruby (~> 1.0)
|
53
|
-
loofah (2.
|
52
|
+
loofah (2.13.0)
|
54
53
|
crass (~> 1.0.2)
|
55
54
|
nokogiri (>= 1.5.9)
|
56
55
|
method_source (1.0.0)
|
57
|
-
mime-types (3.
|
56
|
+
mime-types (3.4.1)
|
58
57
|
mime-types-data (~> 3.2015)
|
59
|
-
mime-types-data (3.
|
60
|
-
minitest (5.
|
61
|
-
minitest-focus (1.1
|
58
|
+
mime-types-data (3.2022.0105)
|
59
|
+
minitest (5.15.0)
|
60
|
+
minitest-focus (1.3.1)
|
62
61
|
minitest (>= 4, < 6)
|
63
|
-
minitest-reporters (1.
|
62
|
+
minitest-reporters (1.5.0)
|
64
63
|
ansi
|
65
64
|
builder
|
66
65
|
minitest (>= 5.0)
|
67
66
|
ruby-progressbar
|
68
|
-
mocha (1.
|
67
|
+
mocha (1.13.0)
|
69
68
|
multi_xml (0.6.0)
|
70
|
-
nokogiri (1.
|
69
|
+
nokogiri (1.13.1-x86_64-linux)
|
71
70
|
racc (~> 1.4)
|
72
71
|
pry (0.14.1)
|
73
72
|
coderay (~> 1.1)
|
74
73
|
method_source (~> 1.0)
|
75
74
|
public_suffix (4.0.6)
|
76
|
-
racc (1.
|
75
|
+
racc (1.6.0)
|
77
76
|
rack (2.2.3)
|
78
77
|
rack-test (1.1.0)
|
79
78
|
rack (>= 1.0, < 3)
|
@@ -88,26 +87,25 @@ GEM
|
|
88
87
|
timecop (0.9.4)
|
89
88
|
tzinfo (2.0.4)
|
90
89
|
concurrent-ruby (~> 1.0)
|
91
|
-
webmock (3.
|
92
|
-
addressable (>= 2.
|
90
|
+
webmock (3.14.0)
|
91
|
+
addressable (>= 2.8.0)
|
93
92
|
crack (>= 0.3.2)
|
94
93
|
hashdiff (>= 0.4.0, < 2.0.0)
|
95
|
-
zeitwerk (2.4.2)
|
96
94
|
|
97
95
|
PLATFORMS
|
98
|
-
|
96
|
+
x86_64-linux
|
99
97
|
|
100
98
|
DEPENDENCIES
|
101
|
-
bundler (~> 2.
|
99
|
+
bundler (~> 2.3.5)
|
102
100
|
luno!
|
103
|
-
minitest (~> 5.0)
|
104
|
-
minitest-focus (~> 1.1
|
105
|
-
minitest-reporters (~> 1.
|
106
|
-
mocha (~> 1.
|
107
|
-
pry (~> 0.
|
108
|
-
rake (~> 13.0)
|
101
|
+
minitest (~> 5.15.0)
|
102
|
+
minitest-focus (~> 1.3.1)
|
103
|
+
minitest-reporters (~> 1.5.0)
|
104
|
+
mocha (~> 1.13.0)
|
105
|
+
pry (~> 0.14.1)
|
106
|
+
rake (~> 13.0.6)
|
109
107
|
timecop (~> 0.9.1)
|
110
|
-
webmock (~> 3.
|
108
|
+
webmock (~> 3.14.0)
|
111
109
|
|
112
110
|
BUNDLED WITH
|
113
|
-
2.
|
111
|
+
2.3.5
|
data/lib/luno/markets.rb
CHANGED
@@ -4,5 +4,15 @@ module Luno
|
|
4
4
|
path = "orderbook_top?pair=#{pair}"
|
5
5
|
unauthorised_and_send(http_method: :get, path: path)
|
6
6
|
end
|
7
|
+
|
8
|
+
def list_ticker_for_pair(pair:)
|
9
|
+
path = 'ticker'
|
10
|
+
authorise_and_send(http_method: :get, path: path, params: { pair: pair })
|
11
|
+
end
|
12
|
+
|
13
|
+
def list_tickets_for_all_pairs
|
14
|
+
path = 'tickers'
|
15
|
+
authorise_and_send(http_method: :get, path: path)
|
16
|
+
end
|
7
17
|
end
|
8
|
-
end
|
18
|
+
end
|
data/lib/luno/orders.rb
CHANGED
@@ -17,5 +17,75 @@ module Luno
|
|
17
17
|
path = "list_trades"
|
18
18
|
authorise_and_send(http_method: :get, path: path)
|
19
19
|
end
|
20
|
+
|
21
|
+
# TYPE = "BUY" "SELL"
|
22
|
+
def create_market_order(
|
23
|
+
pair:,
|
24
|
+
type:,
|
25
|
+
counter_volume: nil, # how much currency to use for a BUY order
|
26
|
+
base_volume: nil, # how much crypto to use for a SELL order
|
27
|
+
base_account_id: ,
|
28
|
+
counter_account_id: ,
|
29
|
+
ttl: 10000,
|
30
|
+
client_order_id: nil)
|
31
|
+
|
32
|
+
# TODO: Raise exception if counter_volume and base_volume are both nil
|
33
|
+
path = 'marketorder'
|
34
|
+
|
35
|
+
params = {
|
36
|
+
pair: pair,
|
37
|
+
type: type,
|
38
|
+
base_account_id: base_account_id,
|
39
|
+
counter_account_id: counter_account_id,
|
40
|
+
ttl: ttl
|
41
|
+
}
|
42
|
+
|
43
|
+
params = params.merge({ counter_volume: counter_volume }) if counter_volume
|
44
|
+
params = params.merge({ base_volume: base_volume }) if base_volume
|
45
|
+
params = params.merge({ client_order_id: client_order_id }) if client_order_id
|
46
|
+
|
47
|
+
authorise_and_send(http_method: :post, path: path, params: params)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Currency pair trade
|
51
|
+
# Type = "BID" or "ASK"
|
52
|
+
# stop_direction: "BELOW" "ABOVE" "RELATIVE_LAST_TRADE"
|
53
|
+
# TODO: Figure out
|
54
|
+
def create_limit_order(
|
55
|
+
pair:,
|
56
|
+
type:,
|
57
|
+
volume:,
|
58
|
+
price:,
|
59
|
+
post_only: nil,
|
60
|
+
stop_price: nil,
|
61
|
+
stop_direction: nil,
|
62
|
+
base_account_id: nil,
|
63
|
+
counter_account_id: nil,
|
64
|
+
ttl: 10000,
|
65
|
+
client_order_id: nil)
|
66
|
+
path = 'postorder'
|
67
|
+
|
68
|
+
params = {
|
69
|
+
pair: pair,
|
70
|
+
type: type,
|
71
|
+
volume: volume,
|
72
|
+
price: price,
|
73
|
+
ttl: ttl
|
74
|
+
}
|
75
|
+
|
76
|
+
params = params.merge({ post_only: post_only }) if post_only
|
77
|
+
params = params.merge({ stop_price: stop_price }) if stop_price
|
78
|
+
params = params.merge({ stop_direction: stop_direction }) if stop_direction
|
79
|
+
params = params.merge({ base_account_id: base_account_id }) if base_account_id
|
80
|
+
params = params.merge({ counter_account_id: counter_account_id }) if counter_account_id
|
81
|
+
params = params.merge({ client_order_id: client_order_id }) if client_order_id
|
82
|
+
|
83
|
+
authorise_and_send(http_method: :post, path: path, params: params)
|
84
|
+
end
|
85
|
+
|
86
|
+
def cancel_order(order_id:)
|
87
|
+
path = 'stoporder'
|
88
|
+
authorise_and_send(http_method: :post, path: path, params: { order_id: order_id })
|
89
|
+
end
|
20
90
|
end
|
21
91
|
end
|
data/lib/luno/other_data.rb
CHANGED
@@ -6,7 +6,7 @@ module Luno
|
|
6
6
|
COUNTRY_ENDPOINT = 'https://www.luno.com/en/countries'
|
7
7
|
DOCUMENTATION_ENDPOINT = 'https://www.luno.com/en/developers/api'
|
8
8
|
|
9
|
-
def ping(limit: 4, paths: ['https://www.luno.com/', 'https://api.mybitx.com/api/1/'])
|
9
|
+
def ping(limit: 4, paths: ['https://www.luno.com/', 'https://api.mybitx.com/api/1/', 'https://api.luno.com/api/1'])
|
10
10
|
endpoint_metrics = paths.map do |path|
|
11
11
|
responses = []
|
12
12
|
|
@@ -130,4 +130,4 @@ module Luno
|
|
130
130
|
false
|
131
131
|
end
|
132
132
|
end
|
133
|
-
end
|
133
|
+
end
|
data/lib/luno/version.rb
CHANGED
data/luno.gemspec
CHANGED
@@ -23,17 +23,17 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
25
|
spec.add_dependency "httparty", "~> 0.20.0"
|
26
|
-
spec.add_dependency "active_attr", "~> 0.15.
|
27
|
-
spec.add_dependency "nokogiri", "~> 1.
|
26
|
+
spec.add_dependency "active_attr", "~> 0.15.4"
|
27
|
+
spec.add_dependency "nokogiri", "~> 1.13.1"
|
28
28
|
|
29
29
|
# Development dependancies
|
30
|
-
spec.add_development_dependency "bundler", "~> 2.
|
31
|
-
spec.add_development_dependency "rake", "~> 13.0"
|
32
|
-
spec.add_development_dependency "minitest", "~> 5.0"
|
33
|
-
spec.add_development_dependency "minitest-focus", "~> 1.1
|
34
|
-
spec.add_development_dependency "minitest-reporters", "~> 1.
|
30
|
+
spec.add_development_dependency "bundler", "~> 2.3.5"
|
31
|
+
spec.add_development_dependency "rake", "~> 13.0.6"
|
32
|
+
spec.add_development_dependency "minitest", "~> 5.15.0"
|
33
|
+
spec.add_development_dependency "minitest-focus", "~> 1.3.1"
|
34
|
+
spec.add_development_dependency "minitest-reporters", "~> 1.5.0"
|
35
35
|
spec.add_development_dependency "timecop", "~> 0.9.1"
|
36
|
-
spec.add_development_dependency "mocha", "~> 1.
|
37
|
-
spec.add_development_dependency "pry", "~> 0.
|
38
|
-
spec.add_development_dependency "webmock", "~> 3.
|
36
|
+
spec.add_development_dependency "mocha", "~> 1.13.0"
|
37
|
+
spec.add_development_dependency "pry", "~> 0.14.1"
|
38
|
+
spec.add_development_dependency "webmock", "~> 3.14.0"
|
39
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: luno
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- trex22
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -30,98 +30,98 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.15.
|
33
|
+
version: 0.15.4
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.15.
|
40
|
+
version: 0.15.4
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: nokogiri
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.13.1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.13.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 2.
|
61
|
+
version: 2.3.5
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 2.
|
68
|
+
version: 2.3.5
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 13.0.6
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 13.0.6
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: minitest
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 5.15.0
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 5.15.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: minitest-focus
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.1
|
103
|
+
version: 1.3.1
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 1.1
|
110
|
+
version: 1.3.1
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: minitest-reporters
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 1.
|
117
|
+
version: 1.5.0
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 1.
|
124
|
+
version: 1.5.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: timecop
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,42 +142,42 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 1.
|
145
|
+
version: 1.13.0
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 1.
|
152
|
+
version: 1.13.0
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: pry
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
159
|
+
version: 0.14.1
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
166
|
+
version: 0.14.1
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: webmock
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
171
|
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: 3.
|
173
|
+
version: 3.14.0
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 3.
|
180
|
+
version: 3.14.0
|
181
181
|
description: A client for using the Luno API in Ruby. Built form their api documentation.
|
182
182
|
https://www.luno.com/en/developers/api. This is an unofficial project.
|
183
183
|
email:
|
@@ -234,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
234
234
|
- !ruby/object:Gem::Version
|
235
235
|
version: '0'
|
236
236
|
requirements: []
|
237
|
-
rubygems_version: 3.
|
237
|
+
rubygems_version: 3.3.3
|
238
238
|
signing_key:
|
239
239
|
specification_version: 4
|
240
240
|
summary: A client for using the Luno API in Ruby.
|