Overall Statistics
Total Orders
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Start Equity
100000
End Equity
100000
Net Profit
0%
Sharpe Ratio
0
Sortino 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
0
Tracking Error
0
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
Portfolio Turnover
0%
# region imports
from AlgorithmImports import *
# endregion

class MeasuredFluorescentOrangePig(QCAlgorithm):

    def initialize(self):
        self.set_start_date(2017, 12, 20)
        self.set_end_date(2017, 12, 29)
        CustomUniverse.algorithm = self
        self._universe = self.add_universe(CustomUniverse, 'CustomUniverse', Resolution.DAILY, self._select_assets)

    def _select_assets(self, data: List[CustomUniverse]):
        return [x.symbol for x in data]

    def on_data(self, data):
        self.quit(f'Universe size: {len(self._universe.selected)}')

class CustomUniverse(PythonData):

    def get_source(self, config: SubscriptionDataConfig, date: datetime, is_live: bool):
        return SubscriptionDataSource(
            f"example_data_unzipped/Universe_{date.strftime('%Y%m%d')}.txt",
            SubscriptionTransportMedium.OBJECT_STORE,
            FileFormat.CSV
        )

    def reader(self, config: SubscriptionDataConfig, line: str, date: datetime, is_live: bool):
        if not line[0].isdigit():
            return None
        data = line.split('|')
        asset = CustomUniverse()
        symbol = CustomUniverse.algorithm.cusip(data[0])
        if not symbol:
            return
        asset.symbol = symbol
        asset.market_cap = float(data[1])
        asset.name = data[2]
        asset.end_time = datetime(2017, 12, 27)
        return asset