This script processes an ordered transaction log and outputs the remaining tax lots based on a selected algorithm.
To build the executable script, follow these steps:
- Ensure you have Elixir installed on your system. You can download Elixir here.
- Clone this repository:
git clone [email protected]:jacobluetzow/tax_lot.git
- Navigate to the project directory:
cd <project_directory>
- Fetch the project dependencies:
mix deps.get
- Compile the project:
mix compile
- Build the executable script:
mix escript.build
The executable script tax_lot
will be generated in the project directory.
The script reads from stdin
and takes one argument, the tax lot selection algorithm (fifo
or hifo
).
Example:
echo -e '2021-01-01,buy,10000.00,1.00000000\n2021-02-01,sell,20000.00,0.50000000' | ./tax_lot fifo
./tax_lot -h
or
./tax_lot --help
To run the automated tests for this project, use the command:
mix test
This project is licensed under the terms of the Apache License 2.0 license. See the LICENSE file.