Overall Statistics
Total Orders
2
Average Win
0%
Average Loss
0%
Compounding Annual Return
11.903%
Drawdown
2.100%
Expectancy
0
Start Equity
100000.00
End Equity
100123.32
Net Profit
0.123%
Sharpe Ratio
3.409
Sortino Ratio
13.237
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-1.199
Beta
0.225
Annual Standard Deviation
0.178
Annual Variance
0.032
Information Ratio
-37.785
Tracking Error
0.196
Treynor Ratio
2.689
Total Fees
$0.00
Estimated Strategy Capacity
$850000.00
Lowest Capacity Asset
GBPZAR 8G
Portfolio Turnover
49.84%
# region imports
from AlgorithmImports import *
# endregion

class WellDressedRedFly(QCAlgorithm):

    def initialize(self):
        self.set_start_date(2021, 2, 1)
        self.set_end_date(2021, 2, 4)

        self.set_cash(100000)

        self.add_forex("GBPZAR", Resolution.HOUR)
        self.add_forex("USDNOK", Resolution.HOUR)

    def on_data(self, data: Slice):

        if self.Time == datetime(2021, 2, 1, 19):
            
            # Gets executed
            sym = "GBPZAR"
            quant = self.calculate_order_quantity(sym, 1)
            if not quant:
                self.log(str(self.Time) + " not bought " + sym)
            self.market_order(sym, quantity = quant)

        if self.Time == datetime(2021, 2, 3, 19):

            # Not executed because quant is None
            sym = "GBPZAR"
            quant = self.calculate_order_quantity(sym, 1)
            if not quant:
                self.log(str(self.Time) + " not bought " + sym)
            self.market_order(sym, quantity = quant)

            # Gets executed
            quant = self.calculate_order_quantity(sym, 2)
            if not quant:
                self.log(str(self.Time) + " not bought " + sym)
            self.market_order(sym, quantity = quant)