luno 0.2.5 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/luno/client.rb +1 -1
- data/lib/luno/constants.rb +2 -1
- data/lib/luno/markets.rb +11 -1
- data/lib/luno/orders.rb +87 -1
- data/lib/luno/other_data.rb +2 -2
- data/lib/luno/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19c346b6ae99d5fde5d1753b1d1effb863ab408b29c8b6ec159d1faffff72ca4
|
4
|
+
data.tar.gz: 6e5d1111e01966c12d68f539aa783a9264d02b7c75a6262d0aee065876e334e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 683fcd08ec222b266680e9f878f035f39ac42097b8427b699596bf020171281b683351ce7d63d9ec58bc2a89153c20db1cbc7449bc9f5f03cb8305b9904d24f5
|
7
|
+
data.tar.gz: 1a4a47b6e22620398335506bd275ad1e30b39972021a7cd1ce596242e2aa6c34e9eda86c0ee0d66bfabb95fa260a4a16c15fa132429ae8cf2ea81787d538d4ea
|
data/Gemfile.lock
CHANGED
data/lib/luno/client.rb
CHANGED
@@ -22,7 +22,7 @@ module Luno
|
|
22
22
|
|
23
23
|
attr_reader :key, :secret, :base_path, :port
|
24
24
|
|
25
|
-
def initialize(key:, secret:, base_path: 'https://api.
|
25
|
+
def initialize(key:, secret:, base_path: 'https://api.luno.com/api/1', port: 80)
|
26
26
|
@key = key
|
27
27
|
@secret = secret
|
28
28
|
@base_path = base_path
|
data/lib/luno/constants.rb
CHANGED
@@ -12,6 +12,7 @@ module Luno
|
|
12
12
|
ZMW: 'Zambian Kwacha'
|
13
13
|
}
|
14
14
|
|
15
|
+
# TODO: Update, see: https://www.luno.com/en/countries
|
15
16
|
CURRENCY_PAIRS = [
|
16
17
|
'XBTEUR',
|
17
18
|
'XBTZAR',
|
@@ -67,4 +68,4 @@ module Luno
|
|
67
68
|
API_RATE_LIMIT = 5 # per second per ip
|
68
69
|
API_BURST_RATE_LIMIT = 25 # per second per ip
|
69
70
|
end
|
70
|
-
end
|
71
|
+
end
|
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
@@ -1,5 +1,91 @@
|
|
1
1
|
module Luno
|
2
2
|
module Orders
|
3
|
+
def get_fee_information(maker:, taker:)
|
4
|
+
path = "fee_info"
|
5
|
+
pair = "#{maker}#{taker}".upcase
|
3
6
|
|
7
|
+
# TODO: Validate pair from constants
|
8
|
+
authorise_and_send(http_method: :get, path: path, params: { pair: pair })
|
9
|
+
end
|
10
|
+
|
11
|
+
def list_orders
|
12
|
+
path = "list_orders"
|
13
|
+
authorise_and_send(http_method: :get, path: path)
|
14
|
+
end
|
15
|
+
|
16
|
+
def list_trades
|
17
|
+
path = "list_trades"
|
18
|
+
authorise_and_send(http_method: :get, path: path)
|
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
|
4
90
|
end
|
5
|
-
end
|
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
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.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- trex22
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|