Added example files and a document describing usage and reading reports. Resolves #26.

This commit is contained in:
scoobybejesus 2019-09-01 00:28:17 -04:00
parent b91488f034
commit 3282fcc896
7 changed files with 167 additions and 0 deletions

109
examples/examples.md Normal file
View File

@ -0,0 +1,109 @@
// Copyright (c) 2017-2019, scoobybejesus
// Redistributions must include the license: https://github.com/scoobybejesus/cryptools-rs/blob/master/LEGAL.txt
# Examples for using cryptools-rs
The sample input files and the resulting reports are in the `/examples/resources/` directory.
## Using the wizard
##### First, preview the input file `faker1__sample_input.csv`.
     (You'll see it is the same (or roughly the same) as the README example.)
##### We're going to pass in that file as a command-line argument (no flags are required).
Enter the following:
#####     `cargo run -- ./examples/resources/faker1__sample_input.csv`
     (Substitute a Windows-style file path, if necessary.)
Running that command takes you to the wizard.
     (Note: You can simply run **`cargo run`** instead, in which case after answering yes to "Shall we proceed," you will have to enter the absolute path of the input file, but it's easier to pass in the relative path.)
##### Type `<Enter>` to accept default responses to the first three prompts, which are:
* Shall we proceed?
* Choose the lot inventory costing method.
* Continue without like-kind treatment?
##### The final question asks if and where you'd like to save the reports.
The default is the current directory, which is probably undesirable.
Type `c` and `<Enter>` to change the directory.
Then tab-complete your way through `/Users/<your-username>/Documents`*, for example, and then `<Enter>`.
&nbsp;&nbsp;&nbsp;&nbsp;\* This would be different for Windows, of course.
##### Now the program has ended, and you should have reports in the directory you provided.
The reports should match those in the `examples/resources` directory.
## Skipping the wizard
This time around, we'll pass command-line parameters to skip past the wizard.
##### Again, preview the input file `faker2__sample_input.csv`.
You'll see it's similar to the README example, except that there is a slightly wider variety of transactions, plus the memos are more descriptive.
##### Run **`cargo run -- --help`** to see descriptions for the parameters we can use, or just enter:
##### &nbsp;&nbsp;&nbsp;&nbsp;`cargo run -- -a -o ~/Documents ./examples/resources/faker2__sample_input.csv`
&nbsp;&nbsp;&nbsp;&nbsp;\* Substitute `~/Documents` with your desired output directory. Substitute a Windows-style file path, if necessary.
##### Again, the program runs, and you should have reports in the location you provided.
We bypassed the wizard because:
1. The required parameters were passed.
2. Default values were used for parameters not passed.
3. The `-a` flag was set which accepts all parameters without asking twice (i.e., skips the wizard).
The only "required" parameter is the input file.
All other parameters have default values.
The default values may not be desirable for your use case, however.
You may want FIFO instead of LIFO.
You may need EUR instead of USD.
You may want to apply like-kind exchange treatment through a particular date.
These parameters can be set via command line parameters.
## Notes on the reports
There are two style of reports: Accounts and Transactions.
### Accounts
* This style of report shows you what you have.
* *Account* reports reflect the balances in each account along with the cost basis of those holdings. (The exception being the home currency accounts. In that case, it merely reflects the net of how much was deposited/spent.)
* Future reports will be written that provide details of every deposit and every withdrawal, on a movement-by-movement basis, into and out of every lot, for each account.
### Transactions
* This style of report show you how your holdings performed (not including unrealized gains/losses).
* *Transaction* reports reflect the result of each transaction (specifically, each transaction which results in a gain/loss or income/expense).
* Future reports will be written that provide a more detailed breakdown of the income/expense/gain/loss from every movement (or possibly a more summarized version, too).
#### Other notes and limitations
* There is no place where transaction fees are recorded.
Whether in an exchange transaction or when sending to yourself, in the input file you simply reflect the net amount leaving one account and the net amount entering the other account.
That "cost" simply remains as cost basis until the holding is disposed.
* Transactions in which cryptocurrency is spent reflect a gain/loss ***and*** an expense.
Perhaps your goverment does not require you to reflect any gain or loss resulting from purchases, in which case you would presumably separate expense those rows from the rest.
* There is currently no way to provide sub-classifications for income and expenses.
For example, in `faker2`, there is mining income and there is remote tech support income. Also, there is a coffee mug purchase and a donation.
The details are easily found in the memo field, but it is up to the user to "parse" those items for their use.
* As noted in the README, adjustments occasionally may need to be made to the output reports.
For example, in `faker2`, a donation was made.
You may choose (or your accountant may decide) that this transaction (#11) is analogous to donating an appreciated security.
In that case, you may decide to manually adjust the **Proceeds** to match the **Cost basis**, and then update the **Gain/loss** to be zero.
* You can't spend or exchange something that you don't have.
The program is designed to crash if you try to do this.
That is, the program is unable to function properly if your holdings appear to go negative.
The only accounts that are permitted to go negative are home currency accounts.
The balances of all other currencies **must** remain greater than or equal to 0.
(The exception to this is margin accounts, since the liability reflects as a negative balance.)

View File

@ -0,0 +1,6 @@
Account,Balance,Ticker,Cost Basis,Total lots
Bank,-220.0000000,USD,-220.0000000,1
Exchange,0.00,BTC,0.00,5
Wallet,0.00,BTC,0.00,3
MyMonero,0.00,XMR,0.00,3
Simplewallet,400.0000000,XMR,2000.0,2
1 Account Balance Ticker Cost Basis Total lots
2 Bank -220.0000000 USD -220.0000000 1
3 Exchange 0.00 BTC 0.00 5
4 Wallet 0.00 BTC 0.00 3
5 MyMonero 0.00 XMR 0.00 3
6 Simplewallet 400.0000000 XMR 2000.0 2

View File

@ -0,0 +1,7 @@
Date,Txn#,Type,Memo,Amount,Ticker,Term,Proceeds,Cost basis,Gain/loss,Income,Expense
2016/03/01,2,Exchange,SECOND,-0.2500000,BTC,ST,250.0,-220.0,30.0,0,0
2016/05/02,5,Exchange,FIFTH,-90.0000000,XMR,ST,160.0,-125.0,35.0,0,0
2016/07/01,7,Exchange,SEVENTH,-90.0000000,XMR,ST,200.0,-125.0,75.0,0,0
2016/09/01,9,Exchange,NINTH,-0.5,BTC,ST,400.0,-217.14,182.86,0,0
2016/10/01,10,Exchange,TENTH,-200.0000000,XMR,ST,900.0,-400.0,500.0,0,0
2016/12/01,12,Exchange,TWELFTH,-1.5,BTC,ST,2000.00,-1042.86,957.14,0,0
1 Date Txn# Type Memo Amount Ticker Term Proceeds Cost basis Gain/loss Income Expense
2 2016/03/01 2 Exchange SECOND -0.2500000 BTC ST 250.0 -220.0 30.0 0 0
3 2016/05/02 5 Exchange FIFTH -90.0000000 XMR ST 160.0 -125.0 35.0 0 0
4 2016/07/01 7 Exchange SEVENTH -90.0000000 XMR ST 200.0 -125.0 75.0 0 0
5 2016/09/01 9 Exchange NINTH -0.5 BTC ST 400.0 -217.14 182.86 0 0
6 2016/10/01 10 Exchange TENTH -200.0000000 XMR ST 900.0 -400.0 500.0 0 0
7 2016/12/01 12 Exchange TWELFTH -1.5 BTC ST 2000.00 -1042.86 957.14 0 0

View File

@ -0,0 +1,16 @@
txDate,proceeds,memo,1,2,3,4,5
,,,Bank,Exchange,Wallet,Exchange,Simplewallet
,,,USD,BTC,BTC,XMR,XMR
,,,non,non,non,non,non
2/1/16,0,FIRST,-220,0.25,,,
3/1/16,250,SECOND,,-0.25,,180,
4/1/16,0,THIRD,,,,-90,90
5/1/16,0,FOURTH,,,,90,-90
5/2/16,160,FIFTH,,0.3,,-90,
6/1/16,0,SIXTH,,-0.3,0.3,,
7/1/16,200,SEVENTH,,0.7,,-90,
8/1/16,0,EIGHTH,,0.3,-0.3,,
9/1/16,400,NINTH,,-0.5,,200,
10/1/16,900,TENTH,,1,,-200,
11/1/16,0,ELEVENTH,,-1.5,1.5,,
12/1/16,2000,TWELFTH,,,-1.5,,400
1 txDate proceeds memo 1 2 3 4 5
2 Bank Exchange Wallet Exchange Simplewallet
3 USD BTC BTC XMR XMR
4 non non non non non
5 2/1/16 0 FIRST -220 0.25
6 3/1/16 250 SECOND -0.25 180
7 4/1/16 0 THIRD -90 90
8 5/1/16 0 FOURTH 90 -90
9 5/2/16 160 FIFTH 0.3 -90
10 6/1/16 0 SIXTH -0.3 0.3
11 7/1/16 200 SEVENTH 0.7 -90
12 8/1/16 0 EIGHTH 0.3 -0.3
13 9/1/16 400 NINTH -0.5 200
14 10/1/16 900 TENTH 1 -200
15 11/1/16 0 ELEVENTH -1.5 1.5
16 12/1/16 2000 TWELFTH -1.5 400

View File

@ -0,0 +1,6 @@
Account,Balance,Ticker,Cost Basis,Total lots
Bank,-20.0000000,USD,-20.0000000,1
Exchange,0.4500000,BTC,480.6700000,4
Wallet,1,BTC,583.33,1
Exchange,0.00,XMR,0.00,2
Simplewallet,874.9600000,XMR,229.17,2
1 Account Balance Ticker Cost Basis Total lots
2 Bank -20.0000000 USD -20.0000000 1
3 Exchange 0.4500000 BTC 480.6700000 4
4 Wallet 1 BTC 583.33 1
5 Exchange 0.00 XMR 0.00 2
6 Simplewallet 874.9600000 XMR 229.17 2

View File

@ -0,0 +1,8 @@
Date,Txn#,Type,Memo,Amount,Ticker,Term,Proceeds,Cost basis,Gain/loss,Income,Expense
2/1/16,1,Flow,Mining income,0.25,BTC,LT,0,0,0,220,0
3/1/16,2,Flow,Bought $25 Satoshi coffee mug,-0.03,BTC,ST,25,-26.4,-1.4,0,-25
5/1/16,4,Exchange,Traded for Monero,-0.1,BTC,ST,125,-81.6,43.4,0,0
6/1/16,6,Exchange,Bought more Monero,-0.1,BTC,ST,150,-88,62,0,0
8/1/16,8,Flow,Remote tech support income,0.2,BTC,LT,0,0,0,320,0
9/1/16,9,Exchange,Took Monero profit,-150,XMR,ST,700,-37.5,662.5,0,0
11/1/16,11,Flow,Contribute $100 worth to OSS project,-25,XMR,ST,100,-8.33,91.67,0,-100
1 Date Txn# Type Memo Amount Ticker Term Proceeds Cost basis Gain/loss Income Expense
2 2/1/16 1 Flow Mining income 0.25 BTC LT 0 0 0 220 0
3 3/1/16 2 Flow Bought $25 Satoshi coffee mug -0.03 BTC ST 25 -26.4 -1.4 0 -25
4 5/1/16 4 Exchange Traded for Monero -0.1 BTC ST 125 -81.6 43.4 0 0
5 6/1/16 6 Exchange Bought more Monero -0.1 BTC ST 150 -88 62 0 0
6 8/1/16 8 Flow Remote tech support income 0.2 BTC LT 0 0 0 320 0
7 9/1/16 9 Exchange Took Monero profit -150 XMR ST 700 -37.5 662.5 0 0
8 11/1/16 11 Flow Contribute $100 worth to OSS project -25 XMR ST 100 -8.33 91.67 0 -100

View File

@ -0,0 +1,15 @@
txDate,proceeds,memo,1,2,3,4,5
,,,Bank,Exchange,Wallet,Exchange,Simplewallet
,,,USD,BTC,BTC,XMR,XMR
,,,non,non,non,non,non
2/1/16,220,Mining income,,0.25,,,
3/1/16,25,Bought $25 Satoshi coffee mug,,-0.03,,,
4/1/16,0,Bought back for less,-20,0.03,,,
5/1/16,125,Traded for Monero,,-0.1,,600,
5/2/16,0,Withdrew to my wallet,,,,-500,499.98
6/1/16,150,Bought more Monero,,-0.1,,450,
7/1/16,0,Withdrew to my wallet,,,,-400,399.98
8/1/16,320,Remote tech support income,,0.2,,,
9/1/16,700,Took Monero profit,,1.2,,-150,
10/1/16,0,Withdrew to my wallet,,-1,1,,
11/1/16,100,Contribute $100 worth to OSS project,,,,,-25
1 txDate proceeds memo 1 2 3 4 5
2 Bank Exchange Wallet Exchange Simplewallet
3 USD BTC BTC XMR XMR
4 non non non non non
5 2/1/16 220 Mining income 0.25
6 3/1/16 25 Bought $25 Satoshi coffee mug -0.03
7 4/1/16 0 Bought back for less -20 0.03
8 5/1/16 125 Traded for Monero -0.1 600
9 5/2/16 0 Withdrew to my wallet -500 499.98
10 6/1/16 150 Bought more Monero -0.1 450
11 7/1/16 0 Withdrew to my wallet -400 399.98
12 8/1/16 320 Remote tech support income 0.2
13 9/1/16 700 Took Monero profit 1.2 -150
14 10/1/16 0 Withdrew to my wallet -1 1
15 11/1/16 100 Contribute $100 worth to OSS project -25