# region imports
from AlgorithmImports import *
from QuantConnect.DataSource import *# endregion

class HipsterFluorescentYellowOwl(QCAlgorithm):

def Initialize(self):
	self.SetStartDate(2023, 8, 15)
	self.SetStartDate(2023, 8, 17)

    # Requesting data
    self.AddUniverse(self.SelectCoarse, self.SelectFine)
    self.UniverseSettings.Resolution = Resolution.Daily

# Coarse filter: get list of symbols with biggest dollar volume
def SelectCoarse(self, coarse):
	selected = [c for c in coarse if c.HasFundamentalData]
	sorted_by_dollar_volume = sorted(selected, key=lambda c: c.DollarVolume, reverse=True)
	return [ c.Symbol for c in sorted_by_dollar_volume[:10000] ]

# Fine filter: filter to only 10 regional banks via MorningstarIndustryCode
def SelectFine(self, fine):
	filtered_by_class = [f for f in fine if f.AssetClassification.MorningstarIndustryCode == MorningstarIndustryCode.BanksRegional]
	return [ f.Symbol for f in filtered_by_class[:self.10] ]

def OnData(self, data: Slice):
	for security in self._changes.AddedSecurities:
	#self.Plot(???) # here I have no clue how to get the fundamental data from morningstar
#Event fired each time the we add/remove securities from the data feed
def OnSecuritiesChanged(self, changes):
	self._changes = changes