luno 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: 5996c0e75e16a7c0214117ad8b70dbc77437cbc4618551fa4497e8c0f03c3b75
4
- data.tar.gz: 211b164f1c8806bcc36c7d304433bfbb00eee6454fa5d8d16e40c7c3025a01d2
3
+ metadata.gz: 741cc36b2b40ba8f2113f2fb41654b00a517898c6f79edfe070b279c36246994
4
+ data.tar.gz: 113aaa7447c3320afde4d7c5a0d8a1a1c248efbfe0de7f27d228fe40a13e42f8
5
5
  SHA512:
6
- metadata.gz: 2bcf85710dd090c938b197756e1a536be5ed366ba9b52c7fd07d6b77b4678ed779ae77effa208262d8c62bb75cc4e7995c0828f28224d24b4bc7b37fdc735422
7
- data.tar.gz: f9647d25fcac5354d2f4d99ca70249f4fdef9c9484aa8cc2ac8cab015e17d64875b31908a599f58215a897000f3e5d2ff178376153499929c339dfb06add8f2b
6
+ metadata.gz: 89633b98f67bf14edd4fa9005f740a8cf0d159c32586001cbe338d7c8407bee57b4d2c9211295881eaa6a136b190ad5dde037e79059908ab905f1deeae60cc59
7
+ data.tar.gz: 7d07c10654c48ac214ea9026143dfa55c63e993823a79e0ab8675b72f46f3272cc2cd755eeccd1f98831520e82e56b2ed67ccf94d126a0216b6897bef08f61b1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- luno (0.2.5)
4
+ luno (0.2.7)
5
5
  active_attr (~> 0.15.3)
6
6
  httparty (~> 0.20.0)
7
7
  nokogiri (~> 1.12.5)
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.merge({ counter_volume: counter_volume }) if counter_volume
44
+ params.merge({ base_volume: base_volume }) if base_volume
45
+ 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.merge({ post_only: post_only }) if post_only
77
+ params.merge({ stop_price: stop_price }) if stop_price
78
+ params.merge({ stop_direction: stop_direction }) if stop_direction
79
+ params.merge({ base_account_id: base_account_id }) if base_account_id
80
+ params.merge({ counter_account_id: counter_account_id }) if counter_account_id
81
+ 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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Luno
2
- VERSION = "0.2.7"
2
+ VERSION = "0.2.8"
3
3
  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.7
4
+ version: 0.2.8
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-09 00:00:00.000000000 Z
11
+ date: 2021-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty