Overall Statistics
Total Orders
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Start Equity
1000
End Equity
1000
Net Profit
0%
Sharpe Ratio
0
Sortino Ratio
0
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
0
Tracking Error
0
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
Portfolio Turnover
0%
Drawdown Recovery
0
from AlgorithmImports import *


class RoundingProbePython(QCAlgorithm):

    def initialize(self):
        # One-day backtest for deterministic rounding comparison only.
        self.set_start_date(2024, 9, 5)
        self.set_end_date(2024, 9, 5)
        self.set_cash(1000)
        self.add_forex("USDJPY", Resolution.MINUTE)

    def on_data(self, data):
        # First problematic price:
        # 2024-09-05T04:01:00Z,USDJPY,143.761,-333,Stop Market,Filled,-47872.413,"" 
        raw_high_1 = 143.7605
        raw_high_2 = 146.4955
        inside_high_1 = round(raw_high_1, 3)
        inside_high_2 = round(raw_high_2, 3)
        self.log(f"[PY_ROUND] raw_high={raw_high_1:.10f} inside_high={inside_high_1:.3f}")
        self.log(f"[PY_ROUND] raw_high={raw_high_2:.10f} inside_high={inside_high_2:.3f}")
        self.quit()