kraken_ruby 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/Gemfile.lock +4 -0
- data/LICENSE.txt +1 -1
- data/README.md +166 -3
- data/kraken_ruby-0.2.0.gem +0 -0
- data/kraken_ruby-0.2.1.gem +0 -0
- data/lib/kraken_ruby/client.rb +1 -1
- data/lib/kraken_ruby/version.rb +1 -1
- metadata +3 -3
- data/.gitignore +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec8b50b8dc92dd736d696e55e0c5a6d9d053afc0
|
4
|
+
data.tar.gz: 93cd06c2b0f5985a6322290d4500238e27103a42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 076941c2f85cf77902c745bea8555bae9f5a607167038ffe6aabb1b3ccb6d0e168f707ff1c554296c316734ecddd942bb57e2946e4bbf9618154786c48b69f40
|
7
|
+
data.tar.gz: 3ed194a84dddc2319d67dc509a84a6fc03c6e667f9a3fa9f6b20022f2247c01e0545bb492d182629f833bc50181331d74ad4d5b9303df809b904f5a55ddaaa20
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,12 +2,14 @@ PATH
|
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
4
|
kraken_ruby (0.2.0)
|
5
|
+
addressable
|
5
6
|
hashie
|
6
7
|
httparty
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: https://rubygems.org/
|
10
11
|
specs:
|
12
|
+
addressable (2.3.5)
|
11
13
|
diff-lcs (1.2.5)
|
12
14
|
hashie (2.0.5)
|
13
15
|
httparty (0.12.0)
|
@@ -30,6 +32,8 @@ PLATFORMS
|
|
30
32
|
|
31
33
|
DEPENDENCIES
|
32
34
|
bundler (~> 1.3)
|
35
|
+
hashie
|
36
|
+
httparty
|
33
37
|
kraken_ruby!
|
34
38
|
rake
|
35
39
|
rspec
|
data/LICENSE.txt
CHANGED
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
19
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
21
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,6 +1,22 @@
|
|
1
1
|
# KrakenRuby
|
2
2
|
|
3
|
-
|
3
|
+
### IMPORTANT
|
4
|
+
|
5
|
+
This gem is currently built to only query data. There is an experimental ```add_order``` trading method that can be used at **your own risk**. Please thoroughly vet everything in the code for yourself before using this gem to buy, sell, or move any of your assets.
|
6
|
+
|
7
|
+
PLEASE submit an issue or pull request if you notice any bugs, security holes, or potential improvements.
|
8
|
+
|
9
|
+
### Description
|
10
|
+
|
11
|
+
This gem is a wrapper for the [Kraken Digital Asset Trading Platform](https://www.kraken.com) API. Official documentation from Kraken can be found [here](https://www.kraken.com/help/api).
|
12
|
+
|
13
|
+
The current version (0.2.0) can be used to query public and private market data. Private data queries require use of your account API keys.
|
14
|
+
|
15
|
+
### Pending Future Updates
|
16
|
+
|
17
|
+
- Solid trade execution functionality
|
18
|
+
- More comprehensive test suite for methods requiring authentication (using VCR perhaps)
|
19
|
+
- More comprehensive documentation
|
4
20
|
|
5
21
|
## Installation
|
6
22
|
|
@@ -18,7 +34,154 @@ Or install it yourself as:
|
|
18
34
|
|
19
35
|
## Usage
|
20
36
|
|
21
|
-
|
37
|
+
Create a Kraken client:
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
API_KEY = '3bH+M/nLp......'
|
41
|
+
API_SECRET = 'wQG+7Lr9b.....'
|
42
|
+
|
43
|
+
kraken = Kraken::Client.new(API_KEY, API_SECRET)
|
44
|
+
|
45
|
+
time = kraken.server_time
|
46
|
+
time.unixtime #=> 1393056191
|
47
|
+
```
|
48
|
+
|
49
|
+
### Public Data Methods
|
50
|
+
|
51
|
+
#### Server Time
|
52
|
+
|
53
|
+
This functionality is provided by Kraken to to aid in approximating the skew time between the server and client.
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
time = kraken.server_time
|
57
|
+
|
58
|
+
time.unixtime #=> 1393056191
|
59
|
+
time.rfc1123 #=> "Sat, 22 Feb 2014 08:28:04 GMT"
|
60
|
+
```
|
61
|
+
|
62
|
+
#### Asset Info
|
63
|
+
|
64
|
+
Returns the assets that can be traded on the exchange. This method can be passed ```info```, ```aclass``` (asset class), and ```asset``` options. An example below is given for each:
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
kraken.assets
|
68
|
+
```
|
69
|
+
|
70
|
+
#### Asset Pairs
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
pairs = kraken.asset_pairs
|
74
|
+
```
|
75
|
+
|
76
|
+
#### Ticker Information
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
ticker_data = kraken.ticker('XLTCXXDG, ZUSDXXVN')
|
80
|
+
```
|
81
|
+
|
82
|
+
#### Order Book
|
83
|
+
|
84
|
+
Get market depth information for given asset pairs
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
depth_data = kraken.order_book('LTCXRP')
|
88
|
+
```
|
89
|
+
|
90
|
+
#### Trades
|
91
|
+
|
92
|
+
Get recent trades
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
trades = kraken.trades('LTCXRP')
|
96
|
+
```
|
97
|
+
|
98
|
+
#### Spread
|
99
|
+
|
100
|
+
Get spread data for a given asset pair
|
101
|
+
|
102
|
+
```ruby
|
103
|
+
spread = kraken.spread('LTCXRP')
|
104
|
+
```
|
105
|
+
|
106
|
+
### Private Data Methods
|
107
|
+
|
108
|
+
#### Balance
|
109
|
+
|
110
|
+
Get account balance for each asset
|
111
|
+
Note: Rates used for the floating valuation is the midpoint of the best bid and ask prices
|
112
|
+
|
113
|
+
```ruby
|
114
|
+
balance = kraken.balance
|
115
|
+
```
|
116
|
+
|
117
|
+
#### Trade Balance
|
118
|
+
|
119
|
+
Get account trade balance
|
120
|
+
|
121
|
+
```ruby
|
122
|
+
trade_balance = kraken.trade_balance
|
123
|
+
```
|
124
|
+
|
125
|
+
#### Open Orders
|
126
|
+
|
127
|
+
```ruby
|
128
|
+
open_orders = kraken.open_orders
|
129
|
+
```
|
130
|
+
|
131
|
+
#### Query Orders
|
132
|
+
|
133
|
+
See all orders
|
134
|
+
|
135
|
+
```ruby
|
136
|
+
orders = kraken.query_orders
|
137
|
+
```
|
138
|
+
|
139
|
+
#### Trades History
|
140
|
+
|
141
|
+
Get array of all trades
|
142
|
+
|
143
|
+
```ruby
|
144
|
+
trades = kraken.trade_history
|
145
|
+
```
|
146
|
+
|
147
|
+
#### Query Trades
|
148
|
+
|
149
|
+
**Input:** Comma delimited list of transaction (tx) ids
|
150
|
+
|
151
|
+
```ruby
|
152
|
+
trades = kraken.query_trades(tx_ids)
|
153
|
+
```
|
154
|
+
|
155
|
+
#### Open Positions
|
156
|
+
|
157
|
+
**Input:** Comma delimited list of transaction (tx) ids
|
158
|
+
|
159
|
+
```ruby
|
160
|
+
positions = kraken.open_positions(tx_ids)
|
161
|
+
```
|
162
|
+
|
163
|
+
#### Ledgers Info
|
164
|
+
|
165
|
+
```ruby
|
166
|
+
ledgers = kraken.ledgers_info
|
167
|
+
```
|
168
|
+
|
169
|
+
#### Ledgers Info
|
170
|
+
|
171
|
+
**Input:** Comma delimited list of ledger ids
|
172
|
+
|
173
|
+
```ruby
|
174
|
+
ledgers = kraken.query_ledgers(ledger_ids)
|
175
|
+
```
|
176
|
+
|
177
|
+
#### Trade Volume
|
178
|
+
|
179
|
+
**Input:** Comma delimited list of asset pairs
|
180
|
+
|
181
|
+
```ruby
|
182
|
+
asset_pairs = 'XLTCXXDG, ZEURXXDG'
|
183
|
+
volume = kraken.query_ledgers(asset_pairs)
|
184
|
+
```
|
22
185
|
|
23
186
|
## Contributing
|
24
187
|
|
@@ -26,4 +189,4 @@ TODO: Write usage instructions here
|
|
26
189
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
190
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
191
|
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
-
5. Create new Pull Request
|
192
|
+
5. Create new Pull Request
|
data/kraken_ruby-0.2.0.gem
CHANGED
Binary file
|
Binary file
|
data/lib/kraken_ruby/client.rb
CHANGED
@@ -161,7 +161,7 @@ module Kraken
|
|
161
161
|
end
|
162
162
|
|
163
163
|
def generate_hmac(key, message)
|
164
|
-
Base64.
|
164
|
+
Base64.strict_encode64(OpenSSL::HMAC.digest('sha512', key, message))
|
165
165
|
end
|
166
166
|
|
167
167
|
def url_path(method)
|
data/lib/kraken_ruby/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kraken_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Leishman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -101,7 +101,6 @@ executables: []
|
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
|
-
- .gitignore
|
105
104
|
- Gemfile
|
106
105
|
- Gemfile.lock
|
107
106
|
- LICENSE.txt
|
@@ -109,6 +108,7 @@ files:
|
|
109
108
|
- Rakefile
|
110
109
|
- kraken_ruby-0.1.0.gem
|
111
110
|
- kraken_ruby-0.2.0.gem
|
111
|
+
- kraken_ruby-0.2.1.gem
|
112
112
|
- kraken_ruby.gemspec
|
113
113
|
- lib/kraken_ruby.rb
|
114
114
|
- lib/kraken_ruby/client.rb
|
data/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
kraken.key
|