Overall Statistics
Total Orders
411
Average Win
0.76%
Average Loss
-0.35%
Compounding Annual Return
-18.759%
Drawdown
77.300%
Expectancy
-0.843
Start Equity
100000
End Equity
29151.14
Net Profit
-70.849%
Sharpe Ratio
-0.771
Sortino Ratio
-0.915
Probabilistic Sharpe Ratio
0.000%
Loss Rate
95%
Win Rate
5%
Profit-Loss Ratio
2.14
Alpha
-0.039
Beta
-0.952
Annual Standard Deviation
0.187
Annual Variance
0.035
Information Ratio
-0.753
Tracking Error
0.338
Treynor Ratio
0.152
Total Fees
$423.69
Estimated Strategy Capacity
$690000.00
Lowest Capacity Asset
XLI RGRPZX100F39
Portfolio Turnover
0.56%
from AlgorithmImports import *

class EODHDEconomicEventsAlgorithm(QCAlgorithm):
    def initialize(self):
        self.set_start_date(2019, 1, 1)
        # Use industrial sector ETF as a vehicle to trade.
        self.equity_symbol = self.add_equity("XLI").symbol
        # Request US PMI economic event data to generate trade signals.
        ticker = EODHD.Events.UnitedStates.MARKIT_MANUFACTURING_PURCHASING_MANAGERS_INDEX
        self.dataset_symbol = self.add_data(EODHDEconomicEvents, ticker).symbol

    def on_data(self, slice):
        # Trade based on the updated economic events.
        if self.dataset_symbol in slice.get(EODHDEconomicEvents):
            # Use the Manufacturing Index to generate trade signals on manufacturing industry vehicles.
            # Make sure previous and estimate are available to estimate the direction of the industry.
            event = slice[self.dataset_symbol].data[0]
            if event.previous and event.estimate:
                # If the estimated PMI is higher than the previous PMI, the manufacturing ETF price is expected to rise.
                if event.previous > event.estimate:
                    self.set_holdings(self.equity_symbol, 1)
                # Otherwise, it is expected manufacturing ETF prices will drop.
                else:
                    self.set_holdings(self.equity_symbol, -1)