def run_generate_code(): dbh = connectDB() proto_id = nextPrototypeId(dbh) logger.debug(f"processing prototype: {proto_id}") if not proto_id: logger.debug("No prototype returned") return proto_id cnt = 0 while proto_id: cnt += 1 setup = getPrototypeSetup(dbh, proto_id) logger.debug("setup ==>") logger.debug(setup) if not generatePrototypeCode(dbh, setup): logger.debug( "could not generate prototype code for proto_id {proto_id}") return None if setup["num_tests"] < 12500: setup["jcl_version"] = f"{setup['jcl_version']}_exhaustive" dbUpdatePrototype(dbh, proto_id, {"jcl_version": setup["jcl_version"]}) if not generateJclCode(dbh, setup): logger.debug("could not generate jcl code for proto_id {proto_id}") return None dbUpdatePrototype(dbh, proto_id, { "status": "code", "status_state": "done" }) proto_id = nextPrototypeId(dbh) return cnt
def run_generate_code(): dbh = connectDB() cand_id = nextOosCandidateId() logger.debug(f"processing candidate: {cand_id}") if not cand_id: logger.debug("No candidate returned") return cand_id cnt = 0 while cand_id: cnt += 1 setup = getCandidateSetup(dbh, cand_id) if not generateCandidateCode(dbh, setup): logger.debug( "could not generate candidate code for cand_id {cand_id}") return None if not generateJclCode(dbh, setup): logger.debug("could not generate jcl code for cand_id {cand_id}") return None dbUpdateCandidate(dbh, cand_id, { "status": "code", "status_state": "done" }) cand_id = nextCandidateId(dbh) return cnt
def run_filter(data_dir, archive_dir): dbh = connectDB() proto_id, df = prepare_data(dbh, data_dir, archive_dir) if not proto_id: return proto_id # test_mode = True cnt = select_candidates(dbh, proto_id, df) exit() # generateCandidateCode(dbh, proto_id) return cnt
def run_test(cand_id="1725"): dbh = connectDB() ## testing code logger.debug(f"*********** cand_id: {cand_id}") setup = getCandidateSetup(dbh, cand_id) logger.debug("************************************************") logger.debug(setup) pprint.pprint(setup) logger.debug("************************************************") generateCandidateCode(dbh, setup) logger.debug("************************************************") exit()
def run_strategy_setup(): dbh = connectDB() strat_id = nextStrategyId(dbh) if not strat_id: return None cand_id = queryStrategy(dbh, strat_id).cand_id clear_strategy_settings(dbh, strat_id) clear_strategy_parameters(dbh, strat_id) clear_strategy_oos_settings(dbh, strat_id) clear_strategy_oos_periods(dbh, strat_id) run_update_strategy_settings(dbh, strat_id, cand_id) run_update_strategy_reopt_parameters(dbh, strat_id, cand_id) setup = getStrategySetup(dbh, strat_id) get_historical_params(dbh, setup, cand_id, strat_id) with open(f"{json_dir}/strat_{strat_id}.json", "w") as json_file: json.dump(setup, json_file) run_generate_code(dbh, setup)
def run_generate_code(): dbh = connectDB() cand_id = nextCandidateId(dbh) logger.debug(f"processing candidate: {cand_id}") if not cand_id: logger.debug("No candidate returned") return cand_id ## testing code # cand_id = '1725' # logger.debug(f"*********** cand_id: {cand_id}") # setup = getCandidateSetup(dbh, cand_id) # logger.debug("************************************************") # logger.debug(setup) # pprint.pprint(setup) # logger.debug("************************************************") # generateCandidateCode(dbh, setup) # logger.debug("************************************************") # exit() cnt = 0 while cand_id: cnt += 1 setup = getCandidateSetup(dbh, cand_id) if not generateCandidateCode(dbh, setup): logger.debug("could not generate candidate code for cand_id {cand_id}") return None if not generateJclCode(dbh, setup): logger.debug("could not generate jcl code for cand_id {cand_id}") return None dbUpdateCandidate(dbh, cand_id, {"status": "code", "status_state": "done"}) cand_id = nextCandidateId(dbh) return cnt
import sys from loguru import logger sys.path.append("/Users/szagar/ZTS/Dropbox/Business/ats/Code/lib") sys.path.append("C:\\ZTS\\Dropbox\\Business\\ats\\Code\\lib") from ats_tools import add_prototype, BOS, Day from db_query import connectDB # ,queryEntryFilter import pprint dbh = connectDB() tradeStrategy = BOS tradeStyle = Day #data_series = [["@CL", "15", "m"]] data_series = [["@CL", "60", "m"]] #data_series = [["@ES.D", "30", "m"]] session_id = 7 data_set = 3 data_block = 1 #proto_id = add_prototype( # dbh, # tradeStrategy, # tradeStyle, # data_series, # session_id, # data_set, # data_block, #) #pprint.pprint(proto_id)