Overall Statistics
Total Orders
2
Average Win
0%
Average Loss
0%
Compounding Annual Return
429.114%
Drawdown
65.000%
Expectancy
0
Start Equity
1000000
End Equity
2802804.52
Net Profit
180.280%
Sharpe Ratio
4.042
Sortino Ratio
5.59
Probabilistic Sharpe Ratio
73.008%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
4.176
Beta
0.175
Annual Standard Deviation
1.039
Annual Variance
1.079
Information Ratio
3.909
Tracking Error
1.042
Treynor Ratio
24.04
Total Fees
$2176.29
Estimated Strategy Capacity
$39000.00
Lowest Capacity Asset
USDJPY 8G
Portfolio Turnover
37.52%
from AlgorithmImports import *

class YenCarryTradeAlgorithm(QCAlgorithm): 
    def initialize(self):
        self.set_start_date(2024, 1, 2)
        self.set_end_date(2024, 8, 13)
        self.set_cash(1_000_000) # 1M usd = 141M Yen Jan 1 2024.
        self.schedule.on(self.date_rules.month_start(5), self.time_rules.at(10,00), self.trade)

        for asset in [self.add_equity("BIL", Resolution.DAILY),  self.add_forex("USDJPY", Resolution.DAILY)]:
            asset.set_leverage(100)
            asset.set_data_normalization_mode(DataNormalizationMode.RAW)

    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)