Overall Statistics
Total Orders
7
Average Win
0%
Average Loss
-1.16%
Compounding Annual Return
-16.757%
Drawdown
25.400%
Expectancy
-1
Start Equity
100000
End Equity
83033.95
Net Profit
-16.966%
Sharpe Ratio
-0.782
Sortino Ratio
-0.876
Probabilistic Sharpe Ratio
1.503%
Loss Rate
100%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0.005
Beta
-0.595
Annual Standard Deviation
0.144
Annual Variance
0.021
Information Ratio
-1.412
Tracking Error
0.219
Treynor Ratio
0.189
Total Fees
$10.37
Estimated Strategy Capacity
$330000000.00
Lowest Capacity Asset
AAPL R735QTJ8XC9X
Portfolio Turnover
0.43%
from AlgorithmImports import *
from QuantConnect.DataSource import *

class QuiverGovernmentContractAlgorithm(QCAlgorithm):

    def initialize(self) -> None:
        self.set_start_date(2020, 10, 7)   #Set Start Date
        self.set_end_date(2021, 10, 11)    #Set End Date
        self.aapl = self.add_equity("AAPL", Resolution.DAILY).symbol
        self.dataset_symbol = self.add_data(QuiverGovernmentContract, self.aapl).symbol

        # history request
        history = self.history(self.dataset_symbol, 10, Resolution.DAILY)
        self.debug(f"We got {len(history)} items from historical data request of {self.dataset_symbol}.")

    def on_data(self, slice: Slice) -> None:
        for gov_contracts in slice.Get(QuiverGovernmentContract).values():
            if any([gov_contract.amount > 50000 for gov_contract in gov_contracts]):
                self.set_holdings(self.aapl, 1)
            elif any([gov_contract.amount < 10000 for gov_contract in gov_contracts]):
                self.set_holdings(self.aapl, -1)