Is there a way to get the sell order equivalent of cost_basis? When we've ordered and own a position, we can see how much we paid for that position (plus commission) per share. Is there a way to get the execution price (minus commission) per share of a sell order?
The intent of tracking that is so that I can see how my returns are for allocations to assets with different characteristics. My allocations are based on historical returns of assets with those characteristics. I've seen examples where people use data.current_price, but that doesn't take into account partial fills. It also means that for something like a limit order, one would have to specifically track if/when the order actually executes. That's doable, but just getting the execution cost would be preferable.
Also- just thought of this now- is the position cost_basis inclusive of multiple non-contiguous ownership periods? The help doc only states "The volume-weighted average price paid (price and commission) per share in this position" but doesn't clarify if that resets after closing a position.For example, if I purchased ABC at a cost basis of $5, then closed that position entirely, then reopened at a cost basis of $8, would that show up as $8? Or would it be somewhere between $5 and $8?