Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
14.140%
Drawdown
17.000%
Expectancy
0
Net Profit
22.012%
Sharpe Ratio
0.524
Sortino Ratio
0.709
Probabilistic Sharpe Ratio
37.675%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-0.013
Beta
1.009
Annual Standard Deviation
0.144
Annual Variance
0.021
Information Ratio
-7.447
Tracking Error
0.002
Treynor Ratio
0.075
Total Fees
$1.31
Estimated Strategy Capacity
$990000000.00
Lowest Capacity Asset
SPY R735QTJ8XC9X
Portfolio Turnover
0.19%
# region imports
from AlgorithmImports import *
# endregion

class CustomFillModelAlgorithm(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2022, 6, 28)
        self.SetCash(100000)

        security = self.AddEquity("SPY", Resolution.Daily)
        security.SetMarginInterestRateModel(MyMarginInterestRateModel())

    def OnData(self, data: Slice):
        if not self.Portfolio.Invested:
            self.SetHoldings("SPY", 1)


class MyMarginInterestRateModel:

    def ApplyMarginInterestRate(self, marginInterestRateParameters: MarginInterestRateParameters) -> None:
        holdings = marginInterestRateParameters.Security.Holdings
        position_value = holdings.GetQuantityValue(holdings.Quantity)
        position_value.Cash.AddAmount(-1)