Overall Statistics
Total Orders
2
Average Win
0%
Average Loss
0%
Compounding Annual Return
426.555%
Drawdown
65.000%
Expectancy
0
Start Equity
1000000
End Equity
2807157.09
Net Profit
180.716%
Sharpe Ratio
4.023
Sortino Ratio
5.551
Probabilistic Sharpe Ratio
72.991%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
4.147
Beta
0.173
Annual Standard Deviation
1.036
Annual Variance
1.074
Information Ratio
3.886
Tracking Error
1.04
Treynor Ratio
24.065
Total Fees
$2176.29
Estimated Strategy Capacity
$39000.00
Lowest Capacity Asset
USDJPY 8G
Portfolio Turnover
37.36%
from AlgorithmImports import *

class YenCarryTradeAlgorithm(QCAlgorithm): 
    def initialize(self):
        self.set_start_date(2024, 1, 2)
        self.set_end_date(2024, 8, 15)
        self.set_cash(1_000_000) # 1M usd = 141M Yen Jan 1 2024
        self.add_forex("USDJPY", Resolution.DAILY, leverage=100)
        self.add_equity("BIL", Resolution.DAILY, leverage=100, data_normalization_mode=DataNormalizationMode.RAW)  
        self.schedule.on(self.date_rules.month_start(5), self.time_rules.at(10,00), self.trade)

    def trade(self):
        if not self.portfolio.invested:
            self.set_holdings("BIL", 40)
            self.set_holdings("USDJPY", 40)
            self._interest_payment = -40_000_000 * (0.0025/12) # USD

        # deduct interest
        self.portfolio.cash_book['USD'].add_amount(self._interest_payment)