from Code.lib.ta_momentum_studies import TALibMomentumStudies from Code.lib.model_utils import ModelUtility, TimeSeriesSplitImproved from Code.lib.feature_generator import FeatureGenerator from Code.lib.config import current_feature, feature_dict from Code.models import models_utils from Code.lib.model_algos import AlgoUtility from Code.lib.tms_utils import TradeRisk plotIt = PlotUtility() timeUtil = TimeUtility() ct = ComputeTarget() candle_ind = CandleIndicators() dSet = DataRetrieve() taLibMomSt = TALibMomentumStudies() transf = Transformers() modelUtil = ModelUtility() featureGen = FeatureGenerator() dSet = DataRetrieve() modelAlgo = AlgoUtility() sysUtil = TradingSystemUtility() tradeRisk = TradeRisk() if __name__ == '__main__': # set to existing system name OR set to blank if creating new if len(sys.argv) < 2: print('You must set a system_name or set to """"!!!') system_name = sys.argv[1] system_directory = sysUtil.get_system_dir(system_name) #ext_input_dict = sys.argv[2]
#us_cal = CustomBusinessDay(calendar=USFederalHolidayCalendar()) from sklearn.model_selection import StratifiedShuffleSplit from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier, GradientBoostingClassifier from sklearn.neighbors import KNeighborsClassifier from sklearn import svm if __name__ == "__main__": plotIt = PlotUtility() timeUtil = TimeUtility() ct = ComputeTarget() candle_ind = CandleIndicators() dSet = DataRetrieve() taLibMomSt = TALibMomentumStudies() transf = Transformers() modelUtil = ModelUtility() featureGen = FeatureGenerator() issue = "TLT" # Set IS-OOS parameters pivotDate = datetime.date(2019, 1, 3) is_oos_ratio = 2 oos_months = 4 segments = 4 df = dSet.read_issue_data(issue) dataLoadStartDate = df.Date[0] lastRow = df.shape[0] dataLoadEndDate = df.Date[lastRow - 1] dataSet = dSet.set_date_range(df, dataLoadStartDate, dataLoadEndDate) # Resolve any NA's for now