2.4 KiB
piker.accounting
A subsystem for transaction processing, storage and historical measurement.
synopsis
The big question for any trader is this:
what is the price that determines whether i take a loss or a gain on my trade?
In other words, at any given state of accounting your current assets, what is the price between any 2 assets you've transacted that determines at which price you can conduct the next transaction and know if you are making or losing more (or less) of the source asset versus the destination asset?
Let's do a very simple example:
> Joe wants to buy some tacos bc they're super hungo. > Joe has a friend who also likes tacos but doesn't mind if they're fresh; he doesn't mind having day old tacos. > Inflation is rampant and taco prices are trending up for no good reason besides everyone thinks prices are going up. > Joe goes to the taco stand and buys 4 tacos at 25 mxn. > This makes Joe's net cost 4 * 25 = 200 mxn. > Joe eats 3 tacos and realizes that he can't finish the last, so he puts it in the fridge to save for the next day (since he owns a comal). > The next day the price of tacos goes up to 30 mxn (for no good reason > besides the taco stand noticing Joe is a tourist and that > "inflation" is some thing that's used as an excuse for price changes). > Joe's friend from before got lit up (like he does every morning) and msgs Joe to buy him 2 tacos for when he shows up in the late morning. > Joe says "sure, but i also have a leftover if you want it, and I'm fasting today so you can have my sobras and i'll buy you a new one". > The friend coughs a couple times, and says "yee no problem man, just make sure you get them" >
Prior suit definitions:
- the canucks equiv of the IRS call this idea ["Adjusted cost base"](https://www.canada.ca/en/revenue-agency/services/tax/individuals/topics/about-your-tax-return/tax-return/completing-a-tax-return/personal-income/line-12700-capital-gains/definitions-capital-gains.html#Adjustedcostbase)
.pnl
BEP, the break even price: the price at which liquidating a remaining position results in a zero PnL since the position was "opened" in the destination asset.
PPU: price-per-unit: the "average cost" (in cumulative mean terms) of the "entry" transactions which "make a position larger"; taking a profit relative to this price means that you will "make more profit then made prior" since the position was opened.