Thought
this deserved a thread of its own. Here is a
new plugin that classifies sales into short term or long term capital gains based on how long they have
been held, like so:
Converts:
```
plugin "long_short" "{
'generic_account_pat': ':Capital-Gains',
'short_account_rep': ':Capital-Gains:Short',
'long_account_rep': ':Capital-Gains:Long',
}"
2014-01-01 open Assets:Brokerage
2014-01-01 open Assets:Bank
2014-01-01 open Income:Capital-Gains
2014-02-01 * "Buy"
Assets:Brokerage 100 ORNG {1 USD}
Assets:Bank -100 USD
2016-02-01 * "Buy"
Assets:Brokerage 100 ORNG {2 USD}
Assets:Bank -200 USD
2016-03-01 * "Sell"
Assets:Brokerage -100 ORNG {1 USD} @ 2.50 USD
Assets:Brokerage -100 ORNG {2 USD} @ 2.50 USD
Assets:Bank 500 USD
Income:Capital-Gains
```
to:
```
2014-01-01 open Assets:Brokerage
2014-01-01 open Assets:Bank
2014-01-01 open Income:Capital-Gains:Short
2014-01-01 open Income:Capital-Gains:Long
2014-02-01 * "Buy"
Assets:Brokerage 100 ORNG {1 USD}
Assets:Bank -100 USD
2016-02-01 * "Buy"
Assets:Brokerage 100 ORNG {2 USD}
Assets:Bank -200 USD
2016-03-01 * "Sell"
Assets:Brokerage -100 ORNG {1 USD} @ 2.50 USD
Assets:Brokerage -100 ORNG {2 USD} @ 2.50 USD
Assets:Bank 500 USD
Income:Capital-Gains:Short -50 USD
Income:Capital-Gains:Long -150 USD```
WARNINGS:
- still under development
- doesn't work for leap years yet
- doesn't distinguish between reductions and short purchases (doesn't understand the
latter)
- there are probably cases outside the current unit tests that this fails for