sbenthall / SHARKFin

Simulating Heterogeneous Agents with Finance
6 stars 5 forks source link

Broker rounds down fractional share trades, losing them from the system #209

Open sbenthall opened 1 year ago

sbenthall commented 1 year ago

Mainly to @alanlujan91 : With the current implementation, this has some weird consequences.

image

It looks like we've been allowing trade in fractional shares on the SHARKFin side (because that makes things so much easier) and have only rounded things off to integers when the broker trade()s orders to the market.

https://github.com/sbenthall/SHARKFin/blob/master/sharkfin/broker.py#L70-L72

This means that with a tiny income (see #208 ) , we still see the consumer households slowly accumulate fractional shares, which add up to whole shares in aggregate. But no 'buy' orders are being sent, because the fractional shares are being rounded down to 0 each day in the Broker's calculation.

While probably not a big deal, it is very visible in the plots of the 'real economy' when there is zero starting wealth, since that's the only activity. This may be trivialized by #205 , but is also technically a bug. Filing for later.