cryptsy 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -5
- data/lib/cryptsy/client.rb +23 -4
- data/lib/cryptsy/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d1a9e53dc363dc442072d76a240b16e5d246b7d
|
4
|
+
data.tar.gz: 79ef12b13f786c0528c789622588be3400c83979
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 007bfc16b7ad2b71978044f0e972239be6059a2cdb99d23f5aead8453632478c9475e2508bd70b6f5a09883ee3855c4a2e35a7ef5d9ac2c245ac9a471bf15cd4
|
7
|
+
data.tar.gz: 1848249a8eb3a1d272763e96b1bd23fcee70c08861291bd89c394909a2dc0bc5b639508bd41372d60b55d51a2fe4beb9ebb8dd6a9d3575bf4df97a839ba25c6e
|
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
Provides an idiomatic Ruby client for the authenticated Cryptsy API
|
4
4
|
|
5
|
+
[![Gem Release](http://img.shields.io/gem/v/cryptsy.svg)](http://rubygems.org/gems/cryptsy)
|
6
|
+
|
5
7
|
## JSON client
|
6
8
|
|
7
9
|
Grab your API keys from the Crypsty website
|
@@ -159,8 +161,3 @@ This includes the following:
|
|
159
161
|
|
160
162
|
Therefore, you should isolate the use of this client away from a public-facing service. On a separate VM,
|
161
163
|
you can use a background worker process, like Sidekiq or Resque.
|
162
|
-
|
163
|
-
## To-do
|
164
|
-
|
165
|
-
- [FIX] Add error handling to web client
|
166
|
-
- [FEAT] Add auto-confirm for emailed confirmation links
|
data/lib/cryptsy/client.rb
CHANGED
@@ -85,7 +85,12 @@ module Cryptsy
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def create_order(market_id, order_type, quantity, price)
|
88
|
-
call(:createorder,
|
88
|
+
call(:createorder,
|
89
|
+
marketid: market_id,
|
90
|
+
ordertype: order_type,
|
91
|
+
quantity: format_number(quantity),
|
92
|
+
price: format_number(price)
|
93
|
+
)
|
89
94
|
end
|
90
95
|
|
91
96
|
def cancel_order(order_id)
|
@@ -109,7 +114,11 @@ module Cryptsy
|
|
109
114
|
end
|
110
115
|
|
111
116
|
def calculate_fees(order_type, quantity, price)
|
112
|
-
call(:calculatefees,
|
117
|
+
call(:calculatefees,
|
118
|
+
ordertype: order_type,
|
119
|
+
quantity: format_number(quantity),
|
120
|
+
price: format_number(price)
|
121
|
+
)
|
113
122
|
end
|
114
123
|
|
115
124
|
def generate_new_address(currency)
|
@@ -131,7 +140,7 @@ module Cryptsy
|
|
131
140
|
def call(method_name, params = {})
|
132
141
|
request = {
|
133
142
|
method: method_name,
|
134
|
-
nonce: Time.now.to_i
|
143
|
+
nonce: (Time.now.to_f * 1000).to_i
|
135
144
|
}.merge(params)
|
136
145
|
|
137
146
|
body = URI.encode_www_form(request)
|
@@ -159,7 +168,17 @@ module Cryptsy
|
|
159
168
|
raise ClientError, body.error
|
160
169
|
end
|
161
170
|
|
162
|
-
body.return
|
171
|
+
if body.return
|
172
|
+
body.return
|
173
|
+
else
|
174
|
+
body
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
# @param [Numeric] number
|
179
|
+
# @return [String]
|
180
|
+
def format_number(number)
|
181
|
+
format('%.8f', number)
|
163
182
|
end
|
164
183
|
|
165
184
|
# @param [Object] code
|
data/lib/cryptsy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cryptsy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Unruh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -83,4 +83,3 @@ test_files:
|
|
83
83
|
- spec/client_spec.rb
|
84
84
|
- spec/spec_helper.rb
|
85
85
|
- spec/web_client_spec.rb
|
86
|
-
has_rdoc:
|