Overall Statistics
Total Orders
2
Average Win
0%
Average Loss
0%
Compounding Annual Return
436.573%
Drawdown
37.200%
Expectancy
0
Start Equity
1000000
End Equity
10026673.88
Net Profit
902.667%
Sharpe Ratio
4.135
Sortino Ratio
6.201
Probabilistic Sharpe Ratio
93.526%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
3.001
Beta
0.5
Annual Standard Deviation
0.738
Annual Variance
0.545
Information Ratio
3.994
Tracking Error
0.738
Treynor Ratio
6.105
Total Fees
$2717.09
Estimated Strategy Capacity
$100000.00
Lowest Capacity Asset
USDJPY 8G
Portfolio Turnover
15.43%
# region imports
from AlgorithmImports import *
# endregion

class YenCarryTradeAlgorithm(QCAlgorithm):

    # 1) Borrow Yen
    # 2) Convert Yen for USD
    # 3) Buy interest-producing, "risk-free" asset with USD
    # profit = interest earned from (3) - interest paid for (1)

    def initialize(self):
        self.set_start_date(2023, 4, 1)
        self.set_end_date(2024, 8, 13)
        self.set_cash(1_000_000) # 1M usd = 141M Yen Jan 1 2024.
        
        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)
    
        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", 50)
            self.set_holdings("USDJPY", 50)
        # deduct interest monthly
        interest = -self.portfolio.cash_book['JPY'].amount * (0.0025/12)
        self.portfolio.cash_book['JPY'].add_amount(interest)