rbtc_arbitrage 1.0.0 → 1.0.1

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: 085039358b729bed53c64ff11885c145b9a90686
4
- data.tar.gz: 841862abfc69c37d33ed1225727f19a5fe2be36c
3
+ metadata.gz: a1ae715eb30b67673c7fb9efa9cd6a9d7fcbc786
4
+ data.tar.gz: ac76073648c581650bece469ab13d79af0034653
5
5
  SHA512:
6
- metadata.gz: 4523e93e04eff256b8e811f20c1abe832d156e05bf965cf6053989bb772e55d91f7563d647bff86f0d2ef0b3dabf690ee9408c40d00e80b9bbde2b2266ae852e
7
- data.tar.gz: eaf1b7274b62f349c57141f82826fba5dea50394b13f26a6d59c3be79b20e30688ea4fce917077cf1e171f7980be2297b9043138ae8a3c9c2d90d9b226d8b369
6
+ metadata.gz: 6ef2161031e005cf0b32454b61b2737fe1af44319aa78486e79878fb7af461af21a91411437d8e110fc080496b7095e3dda5b3c95ac1343a0b0e514f62b7d162
7
+ data.tar.gz: b140bab5a24e2df05e6314df2f06826cd14144982bf561afe57e1f544d2d4705e3efe19d0e86aa530c7732e9c338f76a503acfe087fa57f9ddf6a210fd8fe779
data/README.md CHANGED
@@ -40,7 +40,7 @@ After installing the gem, simply run `rbtc` in the command line.
40
40
  - **Cutoff**: the minimum profit percentage required to execute a trade. Defaults to **%2.00**.
41
41
  - **Volume**: The amount of bitcoins to trade per transaction. Defaults to **0.01** (the minimum transaction size).
42
42
  - **Buyer**: The exchange you'd like to buy bitcoins from during arbitrage. `"mtgox"` or `"bitstamp"`. Default is `bitstamp`
43
- - **Seller**: The exchange you'd like to sell bitcoins from during arbitrage. `"mtgox"` or `"bitstamp"`. Default is `bitstamp`
43
+ - **Seller**: The exchange you'd like to sell bitcoins from during arbitrage. `"mtgox"` or `"bitstamp"`. Default is `mtgox`
44
44
 
45
45
  #### Examples
46
46
 
@@ -62,12 +62,7 @@ The output will look like this:
62
62
 
63
63
  ## Changelog
64
64
 
65
- ### 2.0.0
66
-
67
- - full refactor
68
- - 100% test coverage
69
- - Modularized exchange-specific code to allow for easier extension.
70
- - CLI `buyer` and `seller` option.
65
+ See [releases](https://github.com/hstove/rbtc_arbitrage/releases).
71
66
 
72
67
  ## Contributing
73
68
 
@@ -88,5 +83,6 @@ Right now there is support for only MtGox and Bitstamp, but adding support for o
88
83
  - `price`
89
84
  - `trade`
90
85
  - `exchange`
86
+ - `transfer`
91
87
 
92
88
  Make sure that the methods accept the same arguments and return similar objects. At the same time, make sure you copy the [mtgox_cient_spec](https://github.com/hstove/rbtc_arbitrage/blob/master/spec/clients/mtgox_client_spec.rb) and change it to test your client.
@@ -3,12 +3,19 @@ module RbtcArbitrage
3
3
  class MtGoxClient
4
4
  include RbtcArbitrage::Client
5
5
 
6
+ ##
7
+ # Returns an array of Floats.
8
+ # The first element is the balance in BTC;
9
+ # The second is in USD.
6
10
  def balance
7
11
  return @balance if @balance
8
12
  balances = MtGox.balance
9
13
  @balance = [balances[0].amount.to_f, balances[1].amount.to_f]
10
14
  end
11
15
 
16
+ ##
17
+ # Configures the MtGox
18
+ # client's API keys.
12
19
  def validate_env
13
20
  validate_keys
14
21
  MtGox.configure do |config|
@@ -22,6 +29,7 @@ module RbtcArbitrage
22
29
  end
23
30
 
24
31
  # `action` is :buy or :sell
32
+ # Returns a Numeric type.
25
33
  def price action
26
34
  return @price if @price
27
35
  action = {
@@ -37,6 +45,9 @@ module RbtcArbitrage
37
45
  MtGox.send(action, @options[:volume], :market)
38
46
  end
39
47
 
48
+ ##
49
+ # Transfers BTC to the address of a different
50
+ # exchange.
40
51
  def transfer other_client
41
52
  MtGox.withdraw! @options[:volume], other_client.address
42
53
  end
@@ -1,3 +1,3 @@
1
1
  module RbtcArbitrage
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -2,8 +2,14 @@ require 'thor'
2
2
  require 'mtgox'
3
3
  require_relative 'rbtc_arbitrage/campbx.rb'
4
4
  require 'bitstamp'
5
- require 'btce'
5
+ # require 'btce'
6
+ require_relative 'rbtc_arbitrage/client.rb'
6
7
  Dir["#{File.dirname(__FILE__)}/rbtc_arbitrage/**/*.rb"].each { |f| require(f) }
7
8
 
8
9
  module RbtcArbitrage
10
+ def self.clients
11
+ RbtcArbitrage::Clients.constants.collect do |c|
12
+ RbtcArbitrage::Clients.const_get(c)
13
+ end
14
+ end
9
15
  end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe RbtcArbitrage do
4
+ describe ".clients" do
5
+ it "includes clients" do
6
+ clients = RbtcArbitrage.clients
7
+ clients.should include(RbtcArbitrage::Clients::MtGoxClient)
8
+ clients.should include(RbtcArbitrage::Clients::BitstampClient)
9
+ end
10
+ end
11
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbtc_arbitrage
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hank Stoever
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-18 00:00:00.000000000 Z
11
+ date: 2013-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -167,6 +167,7 @@ files:
167
167
  - spec/client_spec.rb
168
168
  - spec/clients/bitstamp_client_spec.rb
169
169
  - spec/clients/mtgox_client_spec.rb
170
+ - spec/rbtc_arbitrage_spec.rb
170
171
  - spec/spec_helper.rb
171
172
  - spec/support/cassettes/RbtcArbitrage_Clients_BitstampClient/_balance/fetches_the_balance_correctly.yml
172
173
  - spec/support/cassettes/RbtcArbitrage_Clients_BitstampClient/_price/fetches_price_for_buy_correctly.yml
@@ -213,6 +214,7 @@ test_files:
213
214
  - spec/client_spec.rb
214
215
  - spec/clients/bitstamp_client_spec.rb
215
216
  - spec/clients/mtgox_client_spec.rb
217
+ - spec/rbtc_arbitrage_spec.rb
216
218
  - spec/spec_helper.rb
217
219
  - spec/support/cassettes/RbtcArbitrage_Clients_BitstampClient/_balance/fetches_the_balance_correctly.yml
218
220
  - spec/support/cassettes/RbtcArbitrage_Clients_BitstampClient/_price/fetches_price_for_buy_correctly.yml