Thanks for the comments!

So, as I understand so far, there is no dedicated function in Zorro to calculate a margin interest for borrowed money (cost of borrowing) in case of leverage in the stock market. RollLong calculates rollover costs and it's not really a margin interest. It calculates costs for holding all positions overnight, not a cost of interest for borrowed money. As a workaround, it's possible to use RollLong and multiply it by (1 - 1 / leverage) , as Hredot suggested (0.5 in case of leverage 2, thanks for idea!). But it seems that this method will give only approximate results because there are some assumptions.

So, I have 3 questions:
1. jcl, could you confirm or deny that the best way to calculate margin interest (or cost of borrowing) for the stock market is: "RollLong * (1 - 1 / leverage)"? RollLong comes from broker's interest for borrowing, i.e. 3%. (1 - 1 / leverage) takes into account only borrowed amount, not all (i.e. 1/2 for lev 2; 2/3 for lev 3, etc ).
2. Are there any plans to implement a dedicated function for margin interest (cost of borrowing) calculation? if not, why?
3. I assume I can manually calculate margin interest (cost of borrowing) in my own written scripts. If so, could you please give me a hint how to do this?

Thanks for the help!

Last edited by kujo; 12/12/17 01:51.