mexbt 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c719018874ce5763f076516c3ef74dec3ef6da19
4
- data.tar.gz: aee53e8c6555fba852665f96c27bcdcacc721bef
3
+ metadata.gz: 25fa8e7c779ae07ef6f22b81bfa259eebcc5659e
4
+ data.tar.gz: 275a2668c6469ade0a0512472ce08dfd767310ac
5
5
  SHA512:
6
- metadata.gz: 4743cd9c08579f12e733c79654b7050b91ffb4a5488c2226b6a747d8892b30fc0d94a8cc54c23428158aaf53032985270ec5f643f5d927b20de0e97877349eea
7
- data.tar.gz: 4bac247a64df3f5c426ad596556e19b5a4c593e5c9b830c1ed737cc7918870056515e435b6d4aa1fe614d5fcb30416bd9a26d6dcd69ca190035fb9a90b7b8bbe
6
+ metadata.gz: 106267fe0660c0fc2e953c30d3fa08af104ab8d932b2e0c83574ed55deef11b783b5d0d63389cf631a5f7e89644e950b7aea28e9498f7455efb21126b8b8f39f
7
+ data.tar.gz: d65cc9be57cf4706e9091e5bc3a4e7ade89618139dae00e2a5a45598479d7984699ce1fe8a0ac27e42c770c52544eea9273f3f630b864efda5938f2520e81a69
data/lib/mexbt/account.rb CHANGED
@@ -39,14 +39,17 @@ module Mexbt
39
39
  end
40
40
 
41
41
  def withdraw(amount:, address:, currency: :btc)
42
- call("withdraw", { ins: currency, amount: amount, sendToAddress: address })
42
+ call("withdraw", { ins: currency, amount: format_amount(amount), sendToAddress: address })
43
+ rescue RuntimeError => e
44
+ if sandbox
45
+ puts "Withdrawals do not yet work on the sandbox :( Let's pretend..."
46
+ else
47
+ raise e
48
+ end
43
49
  end
44
50
 
45
51
  def create_order(amount:, price: nil, currency_pair: Mexbt.currency_pair, side: :buy, type: :market)
46
- # Horribly hack because sandbox only accepts 6 decimal places thanks to AP
47
- if Mexbt.sandbox
48
- amount = BigDecimal.new(amount, 15).round(6).to_f
49
- end
52
+ amount = format_amount(amount)
50
53
  type =
51
54
  case type
52
55
  when :market, 1
@@ -86,5 +89,16 @@ module Mexbt
86
89
  end
87
90
  call("orders/modify", { ins: currency_pair, serverOrderId: id, modifyAction: action } )
88
91
  end
92
+
93
+ private
94
+
95
+ def format_amount(amount)
96
+ if sandbox
97
+ # Horribly hack because sandbox only accepts 6 decimal places thanks to AP
98
+ BigDecimal.new(amount, 15).round(6).to_f
99
+ else
100
+ amount
101
+ end
102
+ end
89
103
  end
90
104
  end
data/lib/mexbt/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mexbt
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -29,7 +29,7 @@ describe Mexbt::Account do
29
29
 
30
30
  context "with per-instance authentication" do
31
31
 
32
- subject(:account) { Mexbt::Account.new(public_key: "fa4ed1ce8040f66b1bf8708aedff3c16", private_key: "09c4aa0a971eb453378768e7d2d4147e", user_id: "test@mexbt.com", sandbox: true) }
32
+ subject(:account) { Mexbt::Account.new(public_key: "62e78ef68b20bc1db55e56cd7cb675df", private_key: "b4bf685ab83a0a4017cdf471e4d410e1", user_id: "test@mexbt.com", sandbox: true) }
33
33
 
34
34
  it "still works" do
35
35
  expect(account.info[:isAccepted]).to be true
@@ -43,8 +43,8 @@ describe Mexbt::Account do
43
43
 
44
44
  before do
45
45
  Mexbt.configure do |c|
46
- c.public_key = "fa4ed1ce8040f66b1bf8708aedff3c16"
47
- c.private_key = "09c4aa0a971eb453378768e7d2d4147e"
46
+ c.public_key = "62e78ef68b20bc1db55e56cd7cb675df"
47
+ c.private_key = "b4bf685ab83a0a4017cdf471e4d410e1"
48
48
  c.user_id = "test@mexbt.com"
49
49
  c.sandbox = true
50
50
  end
@@ -137,4 +137,4 @@ describe Mexbt::Account do
137
137
 
138
138
  end
139
139
 
140
- end
140
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mexbt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - williamcoates
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-30 00:00:00.000000000 Z
11
+ date: 2015-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport