div0man / lotter Goto Github PK
View Code? Open in Web Editor NEWLotter is a command-line tool that works with trade data in ledger-cli format. Forked from https://src.d10.dev/lotter
License: Other
Lotter is a command-line tool that works with trade data in ledger-cli format. Forked from https://src.d10.dev/lotter
License: Other
I tried to account for some stock splits and noticed that the date doesn't carry correctly. Here's an example:
2020-01-01 Equity
Equity:Cash -100.00 EUR
Assets:Cash 100.00 EUR
2020-01-01 Buy AAA
Assets:Cash -100.00 EUR
Assets:Stocks 1.00 AAA @@ 100 EUR
2020-02-01 Temporary commodity to hold the value
Assets:Stocks -1.00 AAA
Assets:Stocks:Splits 1.00 TEMP @@ 1 AAA
2020-02-01 Stock split
Assets:Stocks:Splits -1.00 TEMP
Assets:Stocks 10.00 AAA @@ 1 TEMP
P 2020-03-01 00:00:00 AAA 20 EUR
2020-03-01 Sell AAA
Assets:Stocks -5.00 AAA @@ 100 EUR
Assets:Cash 100.00 EUR
Running lotter -f test.txt -base EUR lot | ledger -f - bal -X EUR -E
I get:
200.00 EUR Assets
100.00 EUR Cash
100.00 EUR Stocks
0 Splits
-100.00 EUR Equity:Cash
-100.00 EUR Lot
-50.00 EUR
0 2020/01/01
0 1AAA@100EUR
0 1TEMP@1AAA@100EUR
-50.00 EUR 2020/02/01:[email protected]@100EUR
-50.00 EUR Income:short term gain
--------------------
0
While it demonstrates the convenience of using lotter
as a pre-processor, it produces wrong output for my use-case. Too bad :(
It correctly shows that I started with 100 EUR, then bought 1 AAA, which got split 10-for-1 into 10 AAA, later appreciated +100% at which point I took some gains, and am still holding 5 AAA worth 100 EUR with unrealized gains shown under that lot's account.
Judging by the original author's comments in the code here below
Lines 697 to 700 in d99fcb7
I understand that the intent was to carry the date of the latest consumed inventory, but that's not what happens because the newly created lot is actually taking the date of the preceding transaction and not of the actual lot.
I think it should either preserve the oldest date(s) or set the date of newly created lot to the transaction date, so 2 modes of operation.
If old dates are to be carried forward, then lotter
should create a new lot for each different input date, and can't merge them into a single one as it does now.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.