virtex 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +49 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +114 -0
- data/lib/virtex/client.rb +145 -0
- data/lib/virtex/exception.rb +7 -0
- data/lib/virtex/version.rb +3 -0
- data/lib/virtex.rb +3 -0
- data/spec/fixtures/vcr_cassettes/virtex_authenticated_cassette.yml +309 -0
- data/spec/fixtures/vcr_cassettes/virtex_authenticated_error_cassette.yml +45 -0
- data/spec/fixtures/vcr_cassettes/virtex_unauthenticated_cassette.yml +1522 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/virtex_spec.rb +163 -0
- data/virtex.gemspec +24 -0
- metadata +147 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0e6bcfd56ab2a8ed0d7f367edf108259c918a81d
|
4
|
+
data.tar.gz: c130f2bf7700dfceb4c75c2b51df44182dd5e552
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 087bbe40855dbb163e225df97cb6322e581ef26365a377cbef08b6e827caa2afcd6612457988c39d4e4b5859865e6958398423559a6f1adea4ce271c19158a0f
|
7
|
+
data.tar.gz: 80b7c8c511305af4e44c2bf46335e325aba668364323cfd821ce7c1988b35c7e01e6055de2f0b52da3317797d7dbc18f5b2ae78794d1af38783223d697999ee3
|
data/.gitignore
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
*.sw[m-p]
|
4
|
+
.bundle
|
5
|
+
.config
|
6
|
+
.yardoc
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
/.config
|
19
|
+
/coverage/
|
20
|
+
/InstalledFiles
|
21
|
+
/pkg/
|
22
|
+
/spec/reports/
|
23
|
+
/test/tmp/
|
24
|
+
/test/version_tmp/
|
25
|
+
/tmp/
|
26
|
+
|
27
|
+
## Specific to RubyMotion:
|
28
|
+
.dat*
|
29
|
+
.repl_history
|
30
|
+
build/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalisation:
|
39
|
+
/.bundle/
|
40
|
+
/lib/bundler/man/
|
41
|
+
|
42
|
+
Gemfile.lock
|
43
|
+
.ruby-version
|
44
|
+
.ruby-gemset
|
45
|
+
|
46
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
47
|
+
.rvmrc
|
48
|
+
|
49
|
+
.env
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Coinbase, Zaratan, aianus
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
Virtex
|
2
|
+
==========
|
3
|
+
|
4
|
+
A thin wrapper around the CaVirtex API
|
5
|
+
|
6
|
+
## Usage
|
7
|
+
|
8
|
+
See the CaVirtex API docs and source code for more information
|
9
|
+
|
10
|
+
### Unauthenticated requests
|
11
|
+
|
12
|
+
``` ruby
|
13
|
+
require 'virtex'
|
14
|
+
@virtex = Virtex::Client.new
|
15
|
+
```
|
16
|
+
|
17
|
+
#### Orderbook
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
book = @virtex.orderbook('BTCCAD').orderbook
|
21
|
+
|
22
|
+
best_bid = book.bids.first
|
23
|
+
expect(best_bid[0]).to eq(631.481850000) # Price
|
24
|
+
expect(best_bid[1]).to eq(1.367900000) # Size
|
25
|
+
|
26
|
+
best_ask = asks.last
|
27
|
+
expect(best_ask[0]).to eq(634.974840000)
|
28
|
+
expect(best_ask[1]).to eq(9.727400000)
|
29
|
+
```
|
30
|
+
|
31
|
+
#### Tradebook
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
trades = @virtex.tradebook('BTCCAD').trades
|
35
|
+
latest = trades.first
|
36
|
+
```
|
37
|
+
|
38
|
+
#### Ticker
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
ticker = @virtex.ticker("BTCCAD").ticker.BTCCAD
|
42
|
+
```
|
43
|
+
|
44
|
+
### Authenticated requests
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
require 'virtex'
|
48
|
+
@virtex = Virtex::Client.new(ENV['VIRTEX_API_KEY'], ENV['VIRTEX_API_SECRET'])
|
49
|
+
```
|
50
|
+
|
51
|
+
#### View Balance
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
expect(@virtex.balance.balance.CAD).to eq(0.0385)
|
55
|
+
```
|
56
|
+
|
57
|
+
#### View Transactions
|
58
|
+
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
transactions = @virtex.transactions("BTC").transactions
|
62
|
+
```
|
63
|
+
|
64
|
+
#### View trades
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
recent_trades = @virtex.trades.trades
|
68
|
+
```
|
69
|
+
|
70
|
+
#### View orders
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
recent_orders = @virtex.orders.orders
|
74
|
+
```
|
75
|
+
|
76
|
+
#### Place an order
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
# Place a new order to sell 0.1 BTC/CAD at 1000.00
|
80
|
+
new_order = @virtex.new_order!('sell', 0.1, 'BTCCAD', 1000.00).order
|
81
|
+
```
|
82
|
+
|
83
|
+
#### Cancel an order
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
@virtex.cancel_order! 543468
|
87
|
+
```
|
88
|
+
|
89
|
+
#### Withdraw to an external wallet
|
90
|
+
|
91
|
+
```ruby
|
92
|
+
withdrawal = @virtex.withdraw!(0.01, 'BTC', '1DWYffTxhXgBtbswMjNViw9nNCvx3Drpvn').result
|
93
|
+
```
|
94
|
+
|
95
|
+
## Testing
|
96
|
+
|
97
|
+
If you'd like to contribute code or modify this gem, you can run the test suite with:
|
98
|
+
|
99
|
+
```ruby
|
100
|
+
gem install virtex --dev
|
101
|
+
bundle exec rspec
|
102
|
+
```
|
103
|
+
|
104
|
+
## Contributing
|
105
|
+
|
106
|
+
1. Fork this repo and make changes in your own copy
|
107
|
+
2. Add a test if applicable and run the existing tests with `rspec` to make sure they pass
|
108
|
+
3. Commit your changes and push to your fork `git push origin master`
|
109
|
+
4. Create a new pull request and submit it back to me
|
110
|
+
|
111
|
+
## Credits
|
112
|
+
|
113
|
+
Thanks to @Skizzk for providing an example of correctly authenticating with Virtex
|
114
|
+
Thanks to @barmstrong on whose coinbase gem I based this library
|
@@ -0,0 +1,145 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'hashie'
|
3
|
+
|
4
|
+
module Virtex
|
5
|
+
class Client
|
6
|
+
include HTTParty
|
7
|
+
|
8
|
+
# From 0.000000001 to 10,000,000
|
9
|
+
VIRTEX_SIGNIFICANT_DIGITS = 16
|
10
|
+
BASE_URI = 'https://cavirtex.com/api2'
|
11
|
+
|
12
|
+
def initialize(api_key=nil, api_secret=nil, options={})
|
13
|
+
@api_key = api_key
|
14
|
+
@api_secret = api_secret
|
15
|
+
|
16
|
+
# defaults
|
17
|
+
options[:base_uri] ||= BASE_URI
|
18
|
+
@base_uri = options[:base_uri]
|
19
|
+
options.each do |k,v|
|
20
|
+
self.class.send k, v
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Unauthenticated
|
25
|
+
|
26
|
+
def orderbook currencypair
|
27
|
+
do_request '/orderbook.json', { get: { 'currencypair' => currencypair } }
|
28
|
+
end
|
29
|
+
|
30
|
+
def tradebook currencypair, opts = {}
|
31
|
+
params = {
|
32
|
+
'currencypair' => currencypair
|
33
|
+
}.merge(opts)
|
34
|
+
do_request '/trades.json', { get: params }
|
35
|
+
end
|
36
|
+
|
37
|
+
def ticker currencypair
|
38
|
+
do_request '/ticker.json', { get: { 'currencypair' => currencypair } }
|
39
|
+
end
|
40
|
+
|
41
|
+
# Authenticated
|
42
|
+
|
43
|
+
def balance
|
44
|
+
do_request '/user/balance.json'
|
45
|
+
end
|
46
|
+
|
47
|
+
def orders opts = {}
|
48
|
+
do_request '/user/orders.json', { post: opts }
|
49
|
+
end
|
50
|
+
|
51
|
+
def trades opts = {}
|
52
|
+
do_request '/user/trades.json', { post: opts }
|
53
|
+
end
|
54
|
+
|
55
|
+
def transactions currency, opts = {}
|
56
|
+
params = {
|
57
|
+
'currency' => currency
|
58
|
+
}.merge(opts)
|
59
|
+
|
60
|
+
do_request '/user/transactions.json', { post: params }
|
61
|
+
end
|
62
|
+
|
63
|
+
def new_order! mode, amount, currencypair, price, opts = {}
|
64
|
+
params = {
|
65
|
+
'mode' => mode,
|
66
|
+
'amount' => amount,
|
67
|
+
'price' => price,
|
68
|
+
'currencypair' => currencypair
|
69
|
+
}.merge(opts)
|
70
|
+
|
71
|
+
do_request '/user/order.json', { post: params }
|
72
|
+
end
|
73
|
+
|
74
|
+
def cancel_order! id
|
75
|
+
do_request '/user/order_cancel.json', { post: { 'id' => id } }
|
76
|
+
end
|
77
|
+
|
78
|
+
def withdraw! amount, currency, address
|
79
|
+
params = {
|
80
|
+
'amount' => amount,
|
81
|
+
'currency' => currency,
|
82
|
+
'address' => address
|
83
|
+
}
|
84
|
+
do_request '/user/withdraw.json', { post: params }
|
85
|
+
end
|
86
|
+
|
87
|
+
protected
|
88
|
+
|
89
|
+
def generate_api_signature(endpoint, nonce, params)
|
90
|
+
# Alphabetically sorted post parameters for signature
|
91
|
+
data = ""
|
92
|
+
params.keys.sort.each do |k|
|
93
|
+
data += params[k].to_s
|
94
|
+
end
|
95
|
+
|
96
|
+
digest = OpenSSL::Digest.new('sha256')
|
97
|
+
OpenSSL::HMAC.hexdigest(digest, @api_secret, nonce.to_s + @api_key + '/api2' + endpoint + data)
|
98
|
+
end
|
99
|
+
|
100
|
+
def do_request(path, options={})
|
101
|
+
options[:get] ||= {}
|
102
|
+
options[:post] ||= {}
|
103
|
+
|
104
|
+
path = "#{path}?#{URI.encode_www_form(options[:get])}" if !options[:get].empty?
|
105
|
+
|
106
|
+
nonce = options[:nonce] || (Time.now.to_f * 1e6).to_i
|
107
|
+
|
108
|
+
if (@api_key && @api_secret)
|
109
|
+
auth_params = {
|
110
|
+
token: @api_key,
|
111
|
+
nonce: nonce,
|
112
|
+
signature: generate_api_signature(path, nonce, options[:post])
|
113
|
+
}
|
114
|
+
else
|
115
|
+
auth_params = {}
|
116
|
+
end
|
117
|
+
|
118
|
+
r = self.class.post(path, body: options[:post].merge(auth_params))
|
119
|
+
|
120
|
+
case r.code
|
121
|
+
when 504
|
122
|
+
raise TimeoutError, "Gateway timeout, please try again later"
|
123
|
+
when 500..600
|
124
|
+
raise ServerError, "Server error: (#{r.code})"
|
125
|
+
when 401
|
126
|
+
raise UnauthorizedError
|
127
|
+
when 404
|
128
|
+
raise NotFoundError
|
129
|
+
end
|
130
|
+
|
131
|
+
# Virtex API is incorrectly returning text/html so ignore this for now
|
132
|
+
# if !r.headers['content-type'].downcase.include? 'json'
|
133
|
+
# raise Error, "Unrecognized content type #{r.headers['content-type']}"
|
134
|
+
# end
|
135
|
+
|
136
|
+
hash = Hashie::Mash.new(JSON.parse(r.body))
|
137
|
+
|
138
|
+
if hash.status == "error"
|
139
|
+
raise Error, hash.message
|
140
|
+
end
|
141
|
+
|
142
|
+
hash
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
data/lib/virtex.rb
ADDED
@@ -0,0 +1,309 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://cavirtex.com/api2/user/balance.json
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: token=bzv6qarmw4nocmz4wdtmm5tukn9nvng1&nonce=1407048082998318&signature=7a0e066b06a62cfc5189d20afb1ba1d1d2ab06e1db8914f71fd24eb6370cf3ea
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
Server:
|
16
|
+
- cloudflare-nginx
|
17
|
+
Date:
|
18
|
+
- Sun, 03 Aug 2014 06:41:25 GMT
|
19
|
+
Content-Type:
|
20
|
+
- text/html; charset=utf-8
|
21
|
+
Transfer-Encoding:
|
22
|
+
- chunked
|
23
|
+
Connection:
|
24
|
+
- keep-alive
|
25
|
+
Set-Cookie:
|
26
|
+
- __cfduid=dc7ab4725531c12e9342d61d2b41188661407048084643; expires=Mon, 23-Dec-2019
|
27
|
+
23:50:00 GMT; path=/; domain=.cavirtex.com; HttpOnly
|
28
|
+
- sessionid=bb9c19c9b945eedf31d2cc30f2fc98c5; expires=Sun, 03-Aug-2014 10:41:22
|
29
|
+
GMT; httponly; Max-Age=14400; Path=/; secure
|
30
|
+
Last-Modified:
|
31
|
+
- Sun, 03 Aug 2014 06:41:22 GMT
|
32
|
+
Expires:
|
33
|
+
- Sun, 03 Aug 2014 06:41:22 GMT
|
34
|
+
Vary:
|
35
|
+
- Cookie,Accept-Encoding
|
36
|
+
Cache-Control:
|
37
|
+
- max-age=0
|
38
|
+
Cf-Ray:
|
39
|
+
- 15408780dc6f0bc9-HKG
|
40
|
+
body:
|
41
|
+
encoding: UTF-8
|
42
|
+
string: '{"status": "ok", "apirate": 2, "message": "", "balance": {"LTC": 0,
|
43
|
+
"BTC": 0E-9, "CAD": 0.038500000}}'
|
44
|
+
http_version:
|
45
|
+
recorded_at: Sun, 03 Aug 2014 06:41:25 GMT
|
46
|
+
- request:
|
47
|
+
method: post
|
48
|
+
uri: https://cavirtex.com/api2/user/transactions.json
|
49
|
+
body:
|
50
|
+
encoding: UTF-8
|
51
|
+
string: currency=BTC&token=bzv6qarmw4nocmz4wdtmm5tukn9nvng1&nonce=1407052130701530&signature=5447d0703224ceaae6618465dbac7b694185179de000d40752061b708d3e0b0f
|
52
|
+
headers: {}
|
53
|
+
response:
|
54
|
+
status:
|
55
|
+
code: 200
|
56
|
+
message: OK
|
57
|
+
headers:
|
58
|
+
Server:
|
59
|
+
- cloudflare-nginx
|
60
|
+
Date:
|
61
|
+
- Sun, 03 Aug 2014 07:48:56 GMT
|
62
|
+
Content-Type:
|
63
|
+
- text/html; charset=utf-8
|
64
|
+
Transfer-Encoding:
|
65
|
+
- chunked
|
66
|
+
Connection:
|
67
|
+
- keep-alive
|
68
|
+
Set-Cookie:
|
69
|
+
- __cfduid=d7f2a4cf67af77489e4c4089d2a7d676c1407052136485; expires=Mon, 23-Dec-2019
|
70
|
+
23:50:00 GMT; path=/; domain=.cavirtex.com; HttpOnly
|
71
|
+
- sessionid=7e590153f8b43b30106637b785912858; expires=Sun, 03-Aug-2014 11:48:53
|
72
|
+
GMT; httponly; Max-Age=14400; Path=/; secure
|
73
|
+
Last-Modified:
|
74
|
+
- Sun, 03 Aug 2014 07:48:53 GMT
|
75
|
+
Expires:
|
76
|
+
- Sun, 03 Aug 2014 07:48:53 GMT
|
77
|
+
Vary:
|
78
|
+
- Cookie,Accept-Encoding
|
79
|
+
Cache-Control:
|
80
|
+
- max-age=0
|
81
|
+
Cf-Ray:
|
82
|
+
- 1540ea6d056b052e-YYZ
|
83
|
+
body:
|
84
|
+
encoding: UTF-8
|
85
|
+
string: '{"status": "ok", "apirate": 1, "message": "", "transactions": [{"currency":
|
86
|
+
"BTC", "reason": "deposit", "total": 0.171200000, "id": 2355387, "processed":
|
87
|
+
1407051921}]}'
|
88
|
+
http_version:
|
89
|
+
recorded_at: Sun, 03 Aug 2014 07:48:57 GMT
|
90
|
+
- request:
|
91
|
+
method: post
|
92
|
+
uri: https://cavirtex.com/api2/user/order.json
|
93
|
+
body:
|
94
|
+
encoding: UTF-8
|
95
|
+
string: mode=sell&amount=0.1&price=1000.0¤cypair=BTCCAD&token=bzv6qarmw4nocmz4wdtmm5tukn9nvng1&nonce=1407052399159746&signature=e2d4462cf29ce4d0e4e9122cf81272e9b9fa71723d3e79b8d00fa8e0f27f2fa1
|
96
|
+
headers: {}
|
97
|
+
response:
|
98
|
+
status:
|
99
|
+
code: 200
|
100
|
+
message: OK
|
101
|
+
headers:
|
102
|
+
Server:
|
103
|
+
- cloudflare-nginx
|
104
|
+
Date:
|
105
|
+
- Sun, 03 Aug 2014 07:53:31 GMT
|
106
|
+
Content-Type:
|
107
|
+
- text/html; charset=utf-8
|
108
|
+
Transfer-Encoding:
|
109
|
+
- chunked
|
110
|
+
Connection:
|
111
|
+
- keep-alive
|
112
|
+
Set-Cookie:
|
113
|
+
- __cfduid=dc5cbe10953670130feb2e5570d7985cb1407052410931; expires=Mon, 23-Dec-2019
|
114
|
+
23:50:00 GMT; path=/; domain=.cavirtex.com; HttpOnly
|
115
|
+
- sessionid=36cf235cfaa9581cb7b0eb72e024e3f1; expires=Sun, 03-Aug-2014 11:53:28
|
116
|
+
GMT; httponly; Max-Age=14400; Path=/; secure
|
117
|
+
Last-Modified:
|
118
|
+
- Sun, 03 Aug 2014 07:53:28 GMT
|
119
|
+
Expires:
|
120
|
+
- Sun, 03 Aug 2014 07:53:28 GMT
|
121
|
+
Vary:
|
122
|
+
- Cookie,Accept-Encoding
|
123
|
+
Cache-Control:
|
124
|
+
- max-age=0
|
125
|
+
Cf-Ray:
|
126
|
+
- 1540f1205e4d0528-YYZ
|
127
|
+
body:
|
128
|
+
encoding: UTF-8
|
129
|
+
string: '{"status": "ok", "apirate": 2, "message": "", "order": {"status": "open",
|
130
|
+
"id": 543468}}'
|
131
|
+
http_version:
|
132
|
+
recorded_at: Sun, 03 Aug 2014 07:53:32 GMT
|
133
|
+
- request:
|
134
|
+
method: post
|
135
|
+
uri: https://cavirtex.com/api2/user/order_cancel.json
|
136
|
+
body:
|
137
|
+
encoding: UTF-8
|
138
|
+
string: id=543468&token=bzv6qarmw4nocmz4wdtmm5tukn9nvng1&nonce=1407052456858152&signature=cba571fea974418fea652ac6c698f241723d9aa7622fed906fd699e50f7e3da2
|
139
|
+
headers: {}
|
140
|
+
response:
|
141
|
+
status:
|
142
|
+
code: 200
|
143
|
+
message: OK
|
144
|
+
headers:
|
145
|
+
Server:
|
146
|
+
- cloudflare-nginx
|
147
|
+
Date:
|
148
|
+
- Sun, 03 Aug 2014 07:54:29 GMT
|
149
|
+
Content-Type:
|
150
|
+
- text/html; charset=utf-8
|
151
|
+
Transfer-Encoding:
|
152
|
+
- chunked
|
153
|
+
Connection:
|
154
|
+
- keep-alive
|
155
|
+
Set-Cookie:
|
156
|
+
- __cfduid=d6bc11d8c18572860ebd4624c89c4fa201407052462131; expires=Mon, 23-Dec-2019
|
157
|
+
23:50:00 GMT; path=/; domain=.cavirtex.com; HttpOnly
|
158
|
+
- sessionid=7b5cc98aab3b9f1e91b73b2ed3412d6b; expires=Sun, 03-Aug-2014 11:54:26
|
159
|
+
GMT; httponly; Max-Age=14400; Path=/; secure
|
160
|
+
Last-Modified:
|
161
|
+
- Sun, 03 Aug 2014 07:54:26 GMT
|
162
|
+
Expires:
|
163
|
+
- Sun, 03 Aug 2014 07:54:26 GMT
|
164
|
+
Vary:
|
165
|
+
- Cookie,Accept-Encoding
|
166
|
+
Cache-Control:
|
167
|
+
- max-age=0
|
168
|
+
Cf-Ray:
|
169
|
+
- 1540f2605db1053a-YYZ
|
170
|
+
body:
|
171
|
+
encoding: UTF-8
|
172
|
+
string: '{"status": "ok", "apirate": 3, "message": "", "id": 543468}'
|
173
|
+
http_version:
|
174
|
+
recorded_at: Sun, 03 Aug 2014 07:54:30 GMT
|
175
|
+
- request:
|
176
|
+
method: post
|
177
|
+
uri: https://cavirtex.com/api2/user/orders.json
|
178
|
+
body:
|
179
|
+
encoding: UTF-8
|
180
|
+
string: token=bzv6qarmw4nocmz4wdtmm5tukn9nvng1&nonce=1407052609966936&signature=8e6296434a8ec0b31a867a346d0e842ab774eec4a9d474d9a96a92b81ce1def8
|
181
|
+
headers: {}
|
182
|
+
response:
|
183
|
+
status:
|
184
|
+
code: 200
|
185
|
+
message: OK
|
186
|
+
headers:
|
187
|
+
Server:
|
188
|
+
- cloudflare-nginx
|
189
|
+
Date:
|
190
|
+
- Sun, 03 Aug 2014 07:56:53 GMT
|
191
|
+
Content-Type:
|
192
|
+
- text/html; charset=utf-8
|
193
|
+
Transfer-Encoding:
|
194
|
+
- chunked
|
195
|
+
Connection:
|
196
|
+
- keep-alive
|
197
|
+
Set-Cookie:
|
198
|
+
- __cfduid=dbcf42e9c89809e7b5236b0bc4217fe211407052613068; expires=Mon, 23-Dec-2019
|
199
|
+
23:50:00 GMT; path=/; domain=.cavirtex.com; HttpOnly
|
200
|
+
- sessionid=ba85c15f4af23edd5598e55e49cbd932; expires=Sun, 03-Aug-2014 11:56:50
|
201
|
+
GMT; httponly; Max-Age=14400; Path=/; secure
|
202
|
+
Last-Modified:
|
203
|
+
- Sun, 03 Aug 2014 07:56:50 GMT
|
204
|
+
Expires:
|
205
|
+
- Sun, 03 Aug 2014 07:56:50 GMT
|
206
|
+
Vary:
|
207
|
+
- Cookie,Accept-Encoding
|
208
|
+
Cache-Control:
|
209
|
+
- max-age=0
|
210
|
+
Cf-Ray:
|
211
|
+
- 1540f60fafe40528-YYZ
|
212
|
+
body:
|
213
|
+
encoding: UTF-8
|
214
|
+
string: '{"status": "ok", "apirate": 4, "message": "", "orders": [{"status":
|
215
|
+
"canceled", "requested": 1000.000000000, "created": 1407052408, "price": 1000.000000000,
|
216
|
+
"completed": 1407052466, "remaining": 0.100000000, "currency": "BTC", "amount":
|
217
|
+
0.100000000, "mode": "sell", "id": 543468, "with_currency": "CAD"}]}'
|
218
|
+
http_version:
|
219
|
+
recorded_at: Sun, 03 Aug 2014 07:56:53 GMT
|
220
|
+
- request:
|
221
|
+
method: post
|
222
|
+
uri: https://cavirtex.com/api2/user/trades.json
|
223
|
+
body:
|
224
|
+
encoding: UTF-8
|
225
|
+
string: token=bzv6qarmw4nocmz4wdtmm5tukn9nvng1&nonce=1407053048063873&signature=44b24561c9314e0a34135df2fb41795d64d5723748fa86cc7f45f76b31c87747
|
226
|
+
headers: {}
|
227
|
+
response:
|
228
|
+
status:
|
229
|
+
code: 200
|
230
|
+
message: OK
|
231
|
+
headers:
|
232
|
+
Server:
|
233
|
+
- cloudflare-nginx
|
234
|
+
Date:
|
235
|
+
- Sun, 03 Aug 2014 08:04:14 GMT
|
236
|
+
Content-Type:
|
237
|
+
- text/html; charset=utf-8
|
238
|
+
Transfer-Encoding:
|
239
|
+
- chunked
|
240
|
+
Connection:
|
241
|
+
- keep-alive
|
242
|
+
Set-Cookie:
|
243
|
+
- __cfduid=db50882cf5c3a616bff9d5deb0672afaf1407053053643; expires=Mon, 23-Dec-2019
|
244
|
+
23:50:00 GMT; path=/; domain=.cavirtex.com; HttpOnly
|
245
|
+
- sessionid=81e192d540510a5b0d44ae6ed03dbe89; expires=Sun, 03-Aug-2014 12:04:10
|
246
|
+
GMT; httponly; Max-Age=14400; Path=/; secure
|
247
|
+
Last-Modified:
|
248
|
+
- Sun, 03 Aug 2014 08:04:10 GMT
|
249
|
+
Expires:
|
250
|
+
- Sun, 03 Aug 2014 08:04:10 GMT
|
251
|
+
Vary:
|
252
|
+
- Cookie,Accept-Encoding
|
253
|
+
Cache-Control:
|
254
|
+
- max-age=0
|
255
|
+
Cf-Ray:
|
256
|
+
- 154100d14146052e-YYZ
|
257
|
+
body:
|
258
|
+
encoding: UTF-8
|
259
|
+
string: '{"status": "ok", "apirate": 4, "message": "", "trades": [{"rate": 632.071010000,
|
260
|
+
"for_currency_amount": 0.632000000, "trade_currency_amount": 0.001000000,
|
261
|
+
"date": 1407053027.0, "amount": 0.632000000, "price": 0.00158, "oid": 543503,
|
262
|
+
"id": 202617, "trade_currency": "BTC", "for_currency": "CAD"}]}'
|
263
|
+
http_version:
|
264
|
+
recorded_at: Sun, 03 Aug 2014 08:04:14 GMT
|
265
|
+
- request:
|
266
|
+
method: post
|
267
|
+
uri: https://cavirtex.com/api2/user/withdraw.json
|
268
|
+
body:
|
269
|
+
encoding: UTF-8
|
270
|
+
string: amount=0.01¤cy=BTC&address=1DWYffTxhXgBtbswMjNViw9nNCvx3Drpvn&token=bzv6qarmw4nocmz4wdtmm5tukn9nvng1&nonce=1407053975001896&signature=7682f10e1bfd901e42f162610aeb61ae9aa3105e977f36526b879b5767a540a3
|
271
|
+
headers: {}
|
272
|
+
response:
|
273
|
+
status:
|
274
|
+
code: 200
|
275
|
+
message: OK
|
276
|
+
headers:
|
277
|
+
Server:
|
278
|
+
- cloudflare-nginx
|
279
|
+
Date:
|
280
|
+
- Sun, 03 Aug 2014 08:19:57 GMT
|
281
|
+
Content-Type:
|
282
|
+
- text/html; charset=utf-8
|
283
|
+
Transfer-Encoding:
|
284
|
+
- chunked
|
285
|
+
Connection:
|
286
|
+
- keep-alive
|
287
|
+
Set-Cookie:
|
288
|
+
- __cfduid=d01b57ddf0eafb2511009b744d612b7691407053978507; expires=Mon, 23-Dec-2019
|
289
|
+
23:50:00 GMT; path=/; domain=.cavirtex.com; HttpOnly
|
290
|
+
- sessionid=f4b9ba0eb85734a1869569270590da3a; expires=Sun, 03-Aug-2014 12:19:54
|
291
|
+
GMT; httponly; Max-Age=14400; Path=/; secure
|
292
|
+
Last-Modified:
|
293
|
+
- Sun, 03 Aug 2014 08:19:54 GMT
|
294
|
+
Expires:
|
295
|
+
- Sun, 03 Aug 2014 08:19:54 GMT
|
296
|
+
Vary:
|
297
|
+
- Cookie,Accept-Encoding
|
298
|
+
Cache-Control:
|
299
|
+
- max-age=0
|
300
|
+
Cf-Ray:
|
301
|
+
- 15411765ac250528-YYZ
|
302
|
+
body:
|
303
|
+
encoding: UTF-8
|
304
|
+
string: '{"status": "ok", "apirate": 2, "message": "", "result": {"currency":
|
305
|
+
"BTC", "reason": "withdrawal", "fee": 0, "user": "aianus", "wallet": "1DWYffTxhXgBtbswMjNViw9nNCvx3Drpvn",
|
306
|
+
"withdrawalfee": -0.0005, "amount": -0.01, "publictransactionid": "1592b009ebeb1bdc2b53a0ffe1a2ae7a56ef4fe011f235a14fa1d7ba085b3c8a"}}'
|
307
|
+
http_version:
|
308
|
+
recorded_at: Sun, 03 Aug 2014 08:19:58 GMT
|
309
|
+
recorded_with: VCR 2.9.2
|