Marigold / universal-portfolios

Collection of algorithms for online portfolio selection
Other
774 stars 213 forks source link

some question about the transaction cost code #101

Open jomeswang opened 1 year ago

jomeswang commented 1 year ago

Hello, I have a question about the transaction cost in this codebase. In the code writing here (https://github.com/Marigold/universal-portfolios/blob/b99bbd3d52361bd4e4c2bec68b53924176ca56d0/universal/result.py#L110), the transaction cost only calculated by the rebalancing portfolio(self.to_rebalance().abs()) and transaction cost rate(self.fee) , it didn't divided by 2.

But in the paper Borodin A, El-Yaniv R, Gogan V. Can we learn to beat the best stock[J]. Advances in Neural Information Processing Systems, 2003, 16. and the paper Huang D, Zhou J, Li B, et al. Robust median reversion strategy for online portfolio selection[J]. IEEE Transactions on Knowledge and Data Engineering, 2016, 28(9): 2480-2493. both indicate a transaction cost formulation like : image In the above formulation, we can see that it has a process of dividing by 2, which is doesn't match the code. So I wonder what article the transaction cost code came from.

That's all my question, I will appreciate it if you can reply me.

Marigold commented 1 year ago

Hey @jomeswang. I found it more natural to define fees as this. In the paper they probably use "roundtrip" fees which is more common and includes both buy & sell fees. If you use fee = gamma / 2 then you get identical results.