gtmtech-crypto 0.0.3 → 0.0.4
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/README.md +22 -12
- data/gtmtech-crypto.gemspec +1 -1
- data/lib/gtmtech/crypto.rb +1 -1
- data/lib/gtmtech/crypto/data.rb +7 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8b626f33b4fe82491e97bd218f56004b19d118c
|
4
|
+
data.tar.gz: 9cd200dcdef3b12c192d2592f293abdfea01ba16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0011f6b6cdc9b1f24ac67a0a1390fb94e3d65f98799d9de8fd5342fdf35d8bb83f208b8698ba0bc3f6f1d26f5069fe0904bcac3f0f60ddbe9775916868adf489
|
7
|
+
data.tar.gz: d5f03f32ee6bc383f4bd75676071c352fc0f60382712868320074db4969046905ef5fd846897ac28e95f1427af9784f1a90e927666cc6554e816929a8adc75a3
|
data/README.md
CHANGED
@@ -29,39 +29,49 @@ Usage:
|
|
29
29
|
Firstly set up some accounts
|
30
30
|
|
31
31
|
```
|
32
|
-
$ crypto
|
33
|
-
$ crypto
|
34
|
-
$ crypto
|
32
|
+
$ crypto account add --name barclays --currencies GBP --type bank
|
33
|
+
$ crypto account add --name kraken --currencies GBP,BTC --type exchange
|
34
|
+
$ crypto account add --name ledger --currencies BTC,ETH --type wallet
|
35
35
|
```
|
36
36
|
|
37
37
|
Then trade
|
38
38
|
|
39
39
|
```
|
40
|
-
$ crypto
|
41
|
-
$ crypto
|
40
|
+
$ crypto txn add --from barclays.GBP=200 --to bitbargain.GBP
|
41
|
+
$ crypto txn add --from kraken.GBP=150 --to kraken.BTC=0.08
|
42
42
|
```
|
43
43
|
|
44
44
|
some transactions have fees associated with them
|
45
45
|
|
46
46
|
```
|
47
|
-
$ crypto
|
48
|
-
$ crypto
|
47
|
+
$ crypto txn add --from kraken.BTC=0.08 --to ledger.BTC=0.078 # implicit fees of 0.0002 BTC
|
48
|
+
$ crypto txn add --from kraken.BTC=0.08 --to ledger.BTC --fees.BTC=0.002 # extra fees paid at source (kraken)
|
49
49
|
```
|
50
50
|
|
51
51
|
Output transaction history
|
52
52
|
|
53
53
|
```
|
54
|
-
$ crypto list
|
55
|
-
$ crypto list
|
56
|
-
$ crypto list
|
54
|
+
$ crypto txn list # all transactions
|
55
|
+
$ crypto txn list --account barclays # all barclays transactions
|
56
|
+
$ crypto txn list --currency BTC # all bitcoin transactions
|
57
57
|
```
|
58
58
|
|
59
59
|
Output pnl sheet
|
60
60
|
|
61
61
|
```
|
62
|
-
$ crypto
|
62
|
+
$ crypto pnl # profit-and-loss
|
63
63
|
```
|
64
|
-
|
64
|
+
|
65
|
+
Profiles
|
66
|
+
========
|
67
|
+
|
68
|
+
You can keep track of different user profiles, using the CRYPTO_PROFILE environment variable:
|
69
|
+
|
70
|
+
```
|
71
|
+
$ export CRYPTO_PROFILE=antony
|
72
|
+
|
73
|
+
$ crypto account list
|
74
|
+
```
|
65
75
|
|
66
76
|
Building
|
67
77
|
========
|
data/gtmtech-crypto.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = "gtmtech-crypto"
|
7
|
-
gem.version = "0.0.
|
7
|
+
gem.version = "0.0.4"
|
8
8
|
gem.description = "Simple tool for accounting of cryptocurrencies"
|
9
9
|
gem.summary = "Simple tool for accounting of cryptocurrencies"
|
10
10
|
gem.author = "Geoff Meakin"
|
data/lib/gtmtech/crypto.rb
CHANGED
data/lib/gtmtech/crypto/data.rb
CHANGED
@@ -6,7 +6,11 @@ module Gtmtech
|
|
6
6
|
class Data
|
7
7
|
|
8
8
|
def self.load
|
9
|
-
|
9
|
+
if ENV['CRYPTO_PROFILE']
|
10
|
+
@@path = "#{ENV['HOME']}/.crypto.#{ENV['CRYPTO_PROFILE']}.yaml"
|
11
|
+
else
|
12
|
+
@@path = "#{ENV['HOME']}/.crypto.yaml"
|
13
|
+
end
|
10
14
|
unless File.exist? @@path
|
11
15
|
File.open(@@path, 'w') do |file|
|
12
16
|
file.write("---\naccounts: {}\ntransactions: []\n")
|
@@ -28,6 +32,7 @@ module Gtmtech
|
|
28
32
|
end
|
29
33
|
|
30
34
|
def self.list_accounts
|
35
|
+
puts "Accounts for profile \"#{ENV['CRYPTO_PROFILE'] || 'main'}\":"
|
31
36
|
printf("%-10s %-10s %-60s\n", "name", "type", "currencies")
|
32
37
|
puts "-" * 80
|
33
38
|
@@document[ "accounts" ].each do |name, account_info|
|
@@ -63,6 +68,7 @@ module Gtmtech
|
|
63
68
|
end
|
64
69
|
|
65
70
|
def self.list_transactions
|
71
|
+
puts "Transactions for profile \"#{ENV['CRYPTO_PROFILE'] || 'main'}\":"
|
66
72
|
printf("%-36s %-20s %-15s %-15s %-15s %-15s\n", "id", "date", "src account", "src amount", "dest account", "dest amount")
|
67
73
|
puts "-" * 120
|
68
74
|
@@document[ "transactions" ].each do |id, txn|
|