We add spread to our systems in the PRT platform, but what about overnight broker fees, interest, and the impact of dividends?
I’ve developed some code that calculates the cost of overnight fees, interest, and the impact of dividends. I use it across all my systems since these factors can really add up over time.
Below, you’ll find the code based on the DAX 40. It should be simple to integrate into your own systems and customise as needed. The code is designed to work on any intraday time frame, you’ll just need to adjust the CurrentTime = 220000 to match the fee application time in your own time zone.
This version is designed for the UK, with IG, and assumes an interest rate of 4.75% plus a broker fee of 3.0%. It also includes an approximate calculation for dividends (accounting for both positive values for longs and negatives for shorts). It then plots the results on a graph, and if a position is held on a Friday night, the fee is calculated as three times the standard value.
But, it is hard to get accurate results over time as SOFR% (or LIBOR rates) changes every day…
Also, note that in IG Markets i found 2 different formula :
Sometimes it is written : Nights held x (market closing price x trade size x ( relevant interest rate benchmark+/- admin fee*)) / 365.
And sometimes : Number of contracts x value per contract x price x (3% admin fee+/-SOFR%*) ÷ 360
What is the value of the contrat ?
Also for the week end it is written in french IG Markets website that 3 days of interest are applied for the week end, not only 2…
“Veuillez noter que les positions maintenues ouvertes après 23h (heure de Paris) le vendredi seront ajustées pour trois jours de financement afin de couvrir le week-end.”
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue