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 0 Tracking Error 0 Treynor Ratio 0 Total Fees $0.00 |
import datetime import numpy as np import pandas as pd import mlfinlab as ml from scipy import stats class ModulatedHorizontalAutosequencers(QCAlgorithm): def Initialize(self): self.SetStartDate(2019, 1, 18) # Set Start Date self.SetEndDate(2019, 1, 19) self.SetCash(100000) # Set Strategy Cash self.AddEquity("SPY", Resolution.Tick) self.start = datetime.date(2019, 1, 15) self.end = datetime.date(2019, 1, 17) self.features = ["open", "high", "low", "close", "volume"] self.estado = True def OnData(self, data): if self.estado: h1 = self.History(self.Securities.Keys, self.start, self.end, Resolution.Tick) data = h1[h1.suspicious == False] data = data[["lastprice", "quantity"]] data = data.loc["SPY R735QTJ8XC9X"] df = pd.DataFrame() df["date_time"] = data.index.values df["price"] = data.lastprice.values df["volume"] = data.quantity.values df.to_csv('raw_tick_data.csv', index=False) volume = ml.data_structures.get_volume_bars('raw_tick_data.csv', threshold=20000, batch_size=1000000, verbose=False) self.Debug(volume.head()) self.estado = False