queru_btce 1.0.1 → 1.0.2

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
  SHA1:
3
- metadata.gz: f6351e5152b137d19c1f110ba8c86c5936dc398d
4
- data.tar.gz: e9a7bf1bf72f1af77864d93590c75cdfb5f8b063
3
+ metadata.gz: 30d380d0fc4144ce3594a6947f081ffbf6d8602c
4
+ data.tar.gz: 3131b493f07858ab249f349f8095a54634699956
5
5
  SHA512:
6
- metadata.gz: 0fcf1de5dc9ddf6173bc24e674ff709d9ec87fe95afe06186cd5941f257521797a5c1081dceab43499e0bef11bd6d2adb52e184a360b16ecf92be2e77155d70e
7
- data.tar.gz: 6b0fa3549bf8b9935bbb03825c1c7efa1fb6ef5c82f9d502e4900e6e07133f38723d5500c57dd787c3dfb8b1e51f9c41ef9819190735df9a81e9c21eaddf7522
6
+ metadata.gz: f424c4e7ade55b4f7cd3d5d8499e45b56b8c740879f3df70b98a22b1271ef0d1ab919bdecad874b86cad5e4bc97052a61ba1529ed8dc52f2c4df9eaaa2dbf071
7
+ data.tar.gz: b30b30a6547db00751788c07ddb622a34926b1a18c2a58f00e04e3ebca2329823edf7acc4dc73f896372fb0cc3f9353a6647b2bcfb3ea7aefebc0f2aeeff8b4b
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # queru-btce
2
2
 
3
- KISS BTC-E API Access from Ruby.
3
+ KISS _BTC-e_ API Access from Ruby.
4
4
 
5
5
  ### Pros:
6
6
 
7
7
  - No config file and no framework dependency.
8
- - No weird abstractions, you can follow BTC-e API specs.
8
+ - No weird abstractions, you can follow _BTC-e_ API specs.
9
9
  - Returns an object, keys are methods.
10
10
  - Really few error abstraction, exceptions are raised.
11
11
  - Nounce is enforced, I don't expect damm nounce error.
@@ -13,7 +13,7 @@ KISS BTC-E API Access from Ruby.
13
13
 
14
14
  ### Cons:
15
15
 
16
- - Not much abstraction, you should know BTC-e API.
16
+ - Not much abstraction, you should know _BTC-e_ API.
17
17
  - Its in **BETA** status. Not production tested until now.
18
18
 
19
19
  ## Installation
@@ -38,22 +38,82 @@ $ gem install queru-btce
38
38
 
39
39
  ## Usage
40
40
 
41
- This gem provides class methods for all public/private API methods offered by BTC-e.
41
+ This gem provides class methods for all public/private API methods offered by _BTC-e_.
42
42
  Responses are hashes and any errors are raised as exception, your program can handle it.
43
43
 
44
- - [BTC-E Trade API Documentation](https://btc-e.com/api/documentation)
45
- - [BTC-E Public API Documentation](https://btc-e.com/api/3/docs)
44
+ - [_BTC-e_ Trade API Documentation](https://btc-e.com/api/documentation)
45
+ - [_BTC-e_ Public API Documentation](https://btc-e.com/api/3/docs)
46
46
 
47
- You can call any BTC-e API methods this way:
47
+ You can call any _BTC-e_ API method this way:
48
48
 
49
+ #### Public API example:
49
50
  ```ruby
50
- QueruBtce.info
51
- QueruBtce.ticker(:btc_usd)
51
+ info = QueruBtce.info
52
+ puts info.server_time
53
+
54
+ btc_usd = QueruBtce.ticker(:btc_usd)
55
+ puts btc_usd.ask
56
+ puts btc_usd.bid
57
+
52
58
  QueruBtce.ticker(:btc_usd).btc_usd.last
53
- QueruBtce.ticker(:btc_usd, :eth_usd).eth_usd.ask
59
+ mytickers = QueruBtce.ticker(:btc_usd, :eth_usd, :ltc_usd)
60
+ puts "BTC: #{mytickers.btc_usd.last}"
61
+ puts "ETH: #{mytickers.eth_usd.last}"
62
+ puts "LTC: #{mytickers.ltc_usd.last}"
63
+ ```
64
+
65
+ #### Public API methods:
66
+
67
+ All the described at _BTC-e_ documentation:
68
+
69
+ ```ruby
70
+ QueruBtce.info
71
+ QueruBtce.ticker
72
+ QueruBtce.depth
73
+ QueruBtce.trades
74
+ ```
75
+
76
+ #### Private API:
77
+ ```ruby
78
+ QueruBtce.credentials key: 'mykey', secret: 'mysecret'
79
+ my_info = QueruBtce.get_info
80
+ puts my_info.return.funds.btc
81
+
82
+ orders = QueruBtce.active_orders pair: :btc_usd
83
+ puts 'I have open orders' if orders.return
84
+ ```
85
+
86
+ #### Trade API methods:
87
+
88
+
89
+ All the described at _BTC-e_ documentation. Parameters are passed as hash, for example:
90
+
91
+ ```ruby
92
+ QueruBtce.trans_history from: 0, count: 100, order: 'ASC'
93
+ ```
94
+
95
+ The list is:
96
+
97
+ ```ruby
98
+ QueruBtce.get_info
99
+ QueruBtce.trans_history
100
+ QueruBtce.trade_history
101
+ QueruBtce.active_orders
102
+ QueruBtce.trade
103
+ QueruBtce.cancel_order
54
104
  ```
55
105
 
56
- More docs to come.
106
+ ## Tips:
107
+
108
+ ### Nounce error:
109
+
110
+ Nonce is param required by _BTC-e_ trade api, is just an integer but the current one should be greater than the last one. I guess they require it to ensure your transactions are received in a known order, sequentially.
111
+
112
+ This gem always send a timestamp as nounce, ensuring its greater than the last one, so calls are delayed a second between. Not a problem cause API can dump you if you try to ask faster.
113
+
114
+ But if you are calling the API from more than one process, there's no locking mechanism in gem (maybe in the future) and you need to implement a lock to prevent making two calls at once. A cache key, or distributed message can do the work, even a semaphore file locking.
115
+
116
+ It remains at your side by the moment.
57
117
 
58
118
  ## Contributing
59
119
 
@@ -1,3 +1,3 @@
1
1
  module QueruBtce
2
- VERSION = '1.0.1'.freeze
2
+ VERSION = '1.0.2'.freeze
3
3
  end
data/queru_btce.gemspec CHANGED
@@ -19,6 +19,8 @@ Gem::Specification.new do |spec|
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ['lib']
21
21
 
22
+ spec.required_ruby_version = '>= 2.3'
23
+
22
24
  spec.add_dependency 'json', '~> 2.1'
23
25
  spec.add_dependency 'rubysl-ostruct', '~> 2.1'
24
26
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: queru_btce
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Queru AKA Jorge Fuertes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-14 00:00:00.000000000 Z
11
+ date: 2017-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -124,7 +124,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
124
124
  requirements:
125
125
  - - ">="
126
126
  - !ruby/object:Gem::Version
127
- version: '0'
127
+ version: '2.3'
128
128
  required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  requirements:
130
130
  - - ">="
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  version: '0'
133
133
  requirements: []
134
134
  rubyforge_project:
135
- rubygems_version: 2.6.10
135
+ rubygems_version: 2.6.8
136
136
  signing_key:
137
137
  specification_version: 4
138
138
  summary: KISS BTC-e API Access from Ruby