Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe 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
-21.597
Tracking Error
0.111
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
Portfolio Turnover
0%
# region imports
from AlgorithmImports import *
import xgboost as xgb
import joblib
# endregion

class XGBoostExampleAlgorithm(QCAlgorithm):
    
    def Initialize(self):
        self.SetStartDate(2022, 7, 4)
        self.SetEndDate(2022, 7, 8)
        self.SetCash(100000)

        self.AddUniverse(self.CoarseFilterFunction)
        self.u_symbols = [i.Value for i in self.ActiveSecurities.Keys]

        self.df = self.History(self.u_symbols, 30)

    def CoarseFilterFunction(self, coarse: List[CoarseFundamental]) -> List[Symbol]:
        sorted_by_dollar_volume = sorted(coarse, key=lambda x: x.DollarVolume, reverse=True) 
        return [c.Symbol for c in sorted_by_dollar_volume[:10]]

    def OnData(self, slice: Slice) -> None:
        for i in self.u_symbols:
            self.Log(f"We have symbol : {i}")

    def OnEndOfAlgorithm(self):
        self.ObjectStore.Save("price-models/history", self.df.sort_index().to_csv())