rbtc_arbitrage 2.2.0 → 2.2.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 +4 -4
- data/CONTRIBUTING.md +59 -0
- data/Gemfile.lock +1 -1
- data/README.md +51 -38
- data/lib/rbtc_arbitrage/trader/logger.rb +2 -2
- data/lib/rbtc_arbitrage/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 003fb356e8d918847a8e6264c4d9b5cb92faa9bf
|
|
4
|
+
data.tar.gz: c71f37d6eff0c7acfc9d18b675f8a69dca12b427
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7384118643af66aff89842e6d40c633450146821b189ea3a88098813e0d5250c10366d9477e9a72bd19fdc9df98f9c48f31a9e38127850126b1a8c928f5731ef
|
|
7
|
+
data.tar.gz: 61064f0b85a60aebbc20a9af7aaa13966b20907b9bb6e2379ff431c8ec488808dc9160d53c2f6b547ee5f4522e71b544385261c769948d4a1b09765845d41fad
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
## Contributing
|
|
2
|
+
|
|
3
|
+
Pull Requests are welcome!
|
|
4
|
+
|
|
5
|
+
### Setup
|
|
6
|
+
|
|
7
|
+
~~~bash
|
|
8
|
+
git clone git@github.com:hstove/rbtc_arbitrage.git
|
|
9
|
+
cd rbtc_arbitrage
|
|
10
|
+
bundle install
|
|
11
|
+
~~~
|
|
12
|
+
|
|
13
|
+
To automatically run tests as you code, run `guard`.
|
|
14
|
+
|
|
15
|
+
### Adding an exchange
|
|
16
|
+
|
|
17
|
+
Create a new file called `lib/rbtc_arbitrage/clients/[exchange]_client.rb`. If the exchange is Bitstamp, the file will be `bitstamp_client.rb`.
|
|
18
|
+
|
|
19
|
+
Copy and paste this [template client](https://github.com/hstove/rbtc_arbitrage/blob/master/lib/rbtc_arbitrage/clients/client.rb.example) into your new file and replace class ExchangeClient with your exchange name. For Bitstamp, this would be **BitstampClient**.
|
|
20
|
+
|
|
21
|
+
Go through each method and implement it. You should use an already built and tested Ruby library for calling API methods. This part requires some programming and Ruby knowledge, so I won't go too into details about how to implement these methods. Feel free to look at the [other clients](https://github.com/hstove/rbtc_arbitrage/tree/master/lib/rbtc_arbitrage/clients) to see how they're done.
|
|
22
|
+
|
|
23
|
+
**Testing**
|
|
24
|
+
|
|
25
|
+
Once you've done that, create a new spec file in [spec/clients/](https://github.com/hstove/rbtc_arbitrage/tree/master/spec/clients) for your new trader. If you're a 'test first' type of developer like me, you might want to finish this step first.
|
|
26
|
+
|
|
27
|
+
While you're writing code, run guard in your terminal. This will run tests automatically as you edit code.
|
|
28
|
+
|
|
29
|
+
To test out your client, you'll first need to run `git add .`. You only need to do this one time after creating new files.
|
|
30
|
+
|
|
31
|
+
Then to test the new exchange in the command line, run rake install and then whatever command you'd like, such as:
|
|
32
|
+
|
|
33
|
+
~~~
|
|
34
|
+
rbtc --buyer mynewexchange
|
|
35
|
+
~~~
|
|
36
|
+
|
|
37
|
+
You'll need to re-run `rake install` anytime you make changes to your code and want to test the command line again.
|
|
38
|
+
|
|
39
|
+
### Submitting
|
|
40
|
+
|
|
41
|
+
When you're confident that your new exchange is fully functional, you just need to [submit a pull request](https://help.github.com/articles/using-pull-requests).
|
|
42
|
+
|
|
43
|
+
First, visit [rbtc_arbtirage](https://github.com/hstove/rbtc_arbitrage) and click the 'fork' button in the top-right. This will clone the repository in a new one under your account.
|
|
44
|
+
|
|
45
|
+
Then locate the ssh clone url on the right-hand side of your new repository. Copy that url, and in your terminal, run:
|
|
46
|
+
|
|
47
|
+
`git remote add github [url-you-just-copied]`
|
|
48
|
+
|
|
49
|
+
Then, push to that repository.
|
|
50
|
+
|
|
51
|
+
~~~
|
|
52
|
+
git add .
|
|
53
|
+
git commit -m 'added mynewexchange'
|
|
54
|
+
git push github master
|
|
55
|
+
~~~
|
|
56
|
+
|
|
57
|
+
Then go back to your repository on github. You should see a button that says 'Compare and pull request'. Click that button and enter a few details about your new code, then submit the pull request.
|
|
58
|
+
|
|
59
|
+
Your contributions are extremely thanked.
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
# RbtcArbitrage
|
|
2
2
|
|
|
3
|
-
A Ruby gem for executing arbitrage between
|
|
3
|
+
A Ruby gem for executing arbitrage between different Bitcoin exchanges. Supports:
|
|
4
|
+
|
|
5
|
+
- Bitstamp
|
|
6
|
+
- CampBX
|
|
7
|
+
- BTC-E
|
|
8
|
+
- Coinbase
|
|
9
|
+
- ~~MtGox~~ (deprecated)
|
|
4
10
|
|
|
5
11
|
## Meta
|
|
6
12
|
|
|
13
|
+
Please contribute! There are always new exchanges that could be easily supported.
|
|
14
|
+
Check out the [contribution guidelines](https://github.com/hstove/rbtc_arbitrage/blob/master/CONTRIBUTING.md)
|
|
15
|
+
for instructions. Earn Bitcoin for every commit:
|
|
16
|
+
|
|
17
|
+
[](http://tip4commit.com/projects/698)
|
|
18
|
+
|
|
7
19
|
[Explanation of bitcoin arbitrage](http://hankstoever.com/posts/13-Everything-you-need-to-know-about-Bitcoin-arbitrage)
|
|
8
20
|
|
|
9
21
|
[Why I open sourced a bitcoin arbitrate bot](http://hankstoever.com/posts/2-Why-I-open-sourced-a-bitcoin-arbitrage-bot)
|
|
10
22
|
|
|
11
23
|
I'm also creating a course on [creating your own bitcoin arbitrage bot](https://www.uludum.org/funds/2)
|
|
12
24
|
|
|
25
|
+
[CHANGELOG](https://github.com/hstove/rbtc_arbitrage/releases).
|
|
26
|
+
|
|
13
27
|
Donations accepted: **16BMcqf93eEpb2aWgMkJCSQQH85WzrpbdZ**
|
|
14
28
|
|
|
15
29
|
[](https://travis-ci.org/hstove/rbtc_arbitrage)
|
|
@@ -28,61 +42,60 @@ After installing the gem, simply run `rbtc` in the command line.
|
|
|
28
42
|
|
|
29
43
|
#### Options
|
|
30
44
|
|
|
31
|
-
- **Live**: whether you want to actually execute trades.
|
|
32
|
-
|
|
33
|
-
2. MTGOX_SECRET
|
|
34
|
-
2. MTGOX_ADDRESS
|
|
35
|
-
2. BITSTAMP_KEY
|
|
36
|
-
2. BITSTAMP_SECRET
|
|
37
|
-
3. BITSTAMP_ADDRESS
|
|
38
|
-
4. BITSTAMP_CLIENT_ID
|
|
39
|
-
|
|
45
|
+
- **Live**: whether you want to actually execute trades. See the 'Environment
|
|
46
|
+
Variable' section for the required keys.
|
|
40
47
|
- **Cutoff**: the minimum profit percentage required to execute a trade. Defaults to **%2.00**.
|
|
41
48
|
- **Volume**: The amount of bitcoins to trade per transaction. Defaults to **0.01** (the minimum transaction size).
|
|
42
|
-
- **Buyer**: The exchange you'd like to buy bitcoins from during arbitrage.
|
|
43
|
-
- **Seller**: The exchange you'd like to sell bitcoins from during arbitrage.
|
|
49
|
+
- **Buyer**: The exchange you'd like to buy bitcoins from during arbitrage. Default is `bitstamp`
|
|
50
|
+
- **Seller**: The exchange you'd like to sell bitcoins from during arbitrage. Default is `campbx`
|
|
51
|
+
|
|
52
|
+
Valid exchanges for the `--buyer` and `--seller` option are `bitstamp`, `campbx`,
|
|
53
|
+
`btce`,and `coinbase`.
|
|
44
54
|
|
|
45
55
|
#### Examples
|
|
46
56
|
|
|
57
|
+
~~~
|
|
47
58
|
$ rbtc --live --cutoff 4
|
|
48
59
|
$ rbtc --cutoff 0.5
|
|
49
60
|
$ rbtc --cutoff 3 --volume 0.05
|
|
50
|
-
$ rbtc --seller bitstamp --buyer
|
|
61
|
+
$ rbtc --seller bitstamp --buyer campbx
|
|
51
62
|
$ rbtc
|
|
63
|
+
~~~
|
|
52
64
|
|
|
53
65
|
The output will look like this:
|
|
54
66
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
67
|
+
~~~
|
|
68
|
+
I, [APR 6 2014 7:14:33 AM -0700#52261] INFO -- : Fetching exchange rates
|
|
69
|
+
I, [APR 6 2014 7:14:37 AM -0700#52261] INFO -- : Bitstamp (Ask): $455.0
|
|
70
|
+
I, [APR 6 2014 7:14:37 AM -0700#52261] INFO -- : Campbx (Bid): $455.05
|
|
71
|
+
I, [APR 6 2014 7:14:37 AM -0700#52261] INFO -- : buying 0.01 btc at Bitstamp for $4.58
|
|
72
|
+
I, [APR 6 2014 7:14:37 AM -0700#52261] INFO -- : selling 0.01 btc at Campbx for $4.52
|
|
73
|
+
I, [APR 6 2014 7:14:37 AM -0700#52261] INFO -- : profit: $-0.05 (-1.18%) is below cutoff of 2%.
|
|
74
|
+
~~~
|
|
75
|
+
|
|
76
|
+
### Environment Variables
|
|
62
77
|
|
|
63
|
-
|
|
78
|
+
You will need to configure the following environment variables
|
|
79
|
+
to trade with real accounts.
|
|
64
80
|
|
|
65
|
-
|
|
81
|
+
##### Bitstamp
|
|
66
82
|
|
|
67
|
-
|
|
83
|
+
* BITSTAMP_KEY
|
|
84
|
+
* BITSTAMP_SECRET
|
|
85
|
+
* BITSTAMP_ADDRESS
|
|
86
|
+
* BITSTAMP_CLIENT_ID
|
|
68
87
|
|
|
69
|
-
|
|
88
|
+
##### CampBX
|
|
70
89
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
74
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
|
75
|
-
5. Create new Pull Request
|
|
90
|
+
- CAMPBX_KEY
|
|
91
|
+
- CAMPBX_SECRET
|
|
76
92
|
|
|
77
|
-
|
|
93
|
+
##### BTC-E
|
|
78
94
|
|
|
79
|
-
|
|
95
|
+
* BTCE_KEY
|
|
96
|
+
* BTCE_SECRET
|
|
97
|
+
* BTCE_ADDRESS
|
|
80
98
|
|
|
81
|
-
|
|
82
|
-
- `balance`
|
|
83
|
-
- `price`
|
|
84
|
-
- `trade`
|
|
85
|
-
- `exchange`
|
|
86
|
-
- `transfer`
|
|
99
|
+
##### Coinbase
|
|
87
100
|
|
|
88
|
-
|
|
101
|
+
* COINBASE_KEY
|
|
@@ -8,8 +8,8 @@ module RbtcArbitrage
|
|
|
8
8
|
def log_info
|
|
9
9
|
lower_ex = @buy_client.exchange.to_s.capitalize
|
|
10
10
|
higher_ex = @sell_client.exchange.to_s.capitalize
|
|
11
|
-
logger.info "#{lower_ex}: $#{color(buyer[:price].round(2))}"
|
|
12
|
-
logger.info "#{higher_ex}: $#{color(seller[:price].round(2))}"
|
|
11
|
+
logger.info "#{lower_ex} (Ask): $#{color(buyer[:price].round(2))}"
|
|
12
|
+
logger.info "#{higher_ex} (Bid): $#{color(seller[:price].round(2))}"
|
|
13
13
|
logger.info log_string("buying", lower_ex, @paid)
|
|
14
14
|
logger.info log_string("selling", higher_ex, @received)
|
|
15
15
|
|
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: 2.2.
|
|
4
|
+
version: 2.2.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: 2014-04-
|
|
11
|
+
date: 2014-04-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -162,6 +162,7 @@ files:
|
|
|
162
162
|
- .gitmodules
|
|
163
163
|
- .rspec
|
|
164
164
|
- .travis.yml
|
|
165
|
+
- CONTRIBUTING.md
|
|
165
166
|
- Gemfile
|
|
166
167
|
- Gemfile.lock
|
|
167
168
|
- Guardfile
|