coss_api_ruby_wrapper 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7cbc9f414e57f076fdcd586ac10eb289711195cb02b7002bdebc2204f073d2db
4
- data.tar.gz: c567e689523e862345e0edd008b97f666ba5fb153b66d8ac195af6f27291c859
3
+ metadata.gz: ea3ec0790e0975b27a757e80b8fc85a6e312b4524e0b4915d1141d942ebad65e
4
+ data.tar.gz: 0ba331579e8e4a7e66103f49335f4089ef48d40311088ca790f82b4b38649217
5
5
  SHA512:
6
- metadata.gz: a974e4c99956b07fe8bcdbf91c86f58ffc5a9424ba317a3f7e02aefaaa42c00c418820faab83f797406ddd37cd0da8bace4b74394eb2b71fed909b100d907d79
7
- data.tar.gz: dcbc50669537bad7cfb61750d3ae80ce920eb3331ccd32b6d0458d4297bb3d15cf55935dd46323e442712a149d494a4d99b8e9ed2680645afc600c0e46e8cd3c
6
+ metadata.gz: 8f9371129b0d634e5aa25ed5d828ea2999ea36a7b4700a6be953bf2012d981fe77b56a57a78cc9ba8ae08db2b711098b4ad957e1b216410a11a296f3a955cbbd
7
+ data.tar.gz: 36dc3b844fdba1fbc8ef92c8f4ae97d818a08cee3fd806e3e45b123dec275df433b8984b010e74c3df778f909c4ef90afe16985e885a5f7d1a3e94d2ccda3d30
@@ -1,12 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- coss_api_ruby_wrapper (0.1.0)
4
+ coss_api_ruby_wrapper (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- byebug (10.0.2)
10
9
  diff-lcs (1.3)
11
10
  rake (10.5.0)
12
11
  rspec (3.8.0)
@@ -28,7 +27,6 @@ PLATFORMS
28
27
 
29
28
  DEPENDENCIES
30
29
  bundler (~> 1.17)
31
- byebug
32
30
  coss_api_ruby_wrapper!
33
31
  rake (~> 10.0)
34
32
  rspec (~> 3.0)
data/README.md CHANGED
@@ -29,10 +29,11 @@ coss.exchange_info # { ... }
29
29
 
30
30
  |Method |Required Parameters | Optional Parameters| Notes |
31
31
  | --------------------- | ------------------ | ------------------ | ------- |
32
- | place_limit_order | symbol, price, side, amount)| None | |
33
- | place_market_order | symbol, price, side, amount)| None | |
32
+ | place_limit_order | symbol, price, side, amount| None | |
33
+ | place_market_order | symbol, price, side, amount| None | |
34
34
  | order_details | order_id | None | |
35
- | open_orders | symbold | limit, page | |
35
+ | trade_detail | order_id | None | |
36
+ | open_orders | symbol | limit, page | |
36
37
  | completed_orders | symbol | limit, page | |
37
38
  | all_orders | symbol, from_order_id | limit | |
38
39
  | cancel_order | symbol, order_id | None | |
@@ -9,6 +9,6 @@ require 'json'
9
9
  require 'openssl'
10
10
 
11
11
  module CossApiRubyWrapper
12
- HOST_URL = 'https://trade.coss.io/c/api/v1'
13
- ANOTHER_HOST_URL = 'https://engine.coss.io/api/v1'
12
+ TRADE_HOST_URL = 'https://trade.coss.io/c/api/v1'
13
+ ENGINE_HOST_URL = 'https://engine.coss.io/api/v1'
14
14
  end
@@ -22,6 +22,10 @@ module CossApiRubyWrapper
22
22
  request(:post, '/order/details', order_id: order_id.to_s.strip)
23
23
  end
24
24
 
25
+ def trade_detail(order_id)
26
+ request(:post, '/order/trade-detail', order_id: order_id.to_s.strip)
27
+ end
28
+
25
29
  def open_orders(symbol, limit = 10, page = 0)
26
30
  request(:post, '/order/list/open', limit: limit.to_i, page: page.to_i, symbol: symbol.to_s.strip)
27
31
  end
@@ -58,6 +62,14 @@ module CossApiRubyWrapper
58
62
  request(:get, '/exchange-info')
59
63
  end
60
64
 
65
+ def ping
66
+ request(:get, '/ping')
67
+ end
68
+
69
+ def time
70
+ request(:get, '/time')
71
+ end
72
+
61
73
  def account_balances
62
74
  request(:get, '/account/balances')
63
75
  end
@@ -124,16 +136,16 @@ module CossApiRubyWrapper
124
136
  # At this point COSS has different hosts for some endpoints
125
137
  case endpoint
126
138
  when %r{^\/market_price.*}, %r{^\/dp.*}
127
- ANOTHER_HOST_URL
139
+ ENGINE_HOST_URL
128
140
  else
129
- HOST_URL
141
+ TRADE_HOST_URL
130
142
  end
131
143
  end
132
144
 
133
145
  def private_request?(endpoint)
134
146
  # Public requqests are not required to be signed with public/private keys
135
147
  case endpoint
136
- when %r{^\/market-price.*}, %r{^\/dp.*/, /^\/exchange-info.*}, %r{^\/getmarketsummaries.*}
148
+ when %r{^\/market-price.*}, %r{^\/dp.*/, /^\/exchange-info.*}, %r{^\/getmarketsummaries.*}, %r{^\/ping.*}, %r{^\/time.*}
137
149
  false
138
150
  else
139
151
  true
@@ -23,6 +23,8 @@ module CossApiRubyWrapper
23
23
  @errors << '"order_id" parameter should be a non-empty string' if params[:order_id].empty?
24
24
  when '/order/details'
25
25
  @errors << '"order_id" parameter should be a non-empty string' if params[:order_id].empty?
26
+ when '/order/trade-detail'
27
+ @errors << '"order_id" parameter should be a non-empty string' if params[:order_id].empty?
26
28
  when '/order/list/open'
27
29
  @errors << '"limit" parameter should be a positive integer' if params[:limit] <= 0
28
30
  @errors << '"symbol" parameter should be a string representing trading pair, for example: "COSS_ETH"' unless params[:symbol] =~ /\w+_\w+/
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CossApiRubyWrapper
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coss_api_ruby_wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Viktor Vsk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-20 00:00:00.000000000 Z
11
+ date: 2018-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler