# coding=UTF-8 import os, imp import common as cm imp.reload(cm) import lib.dblib as dl imp.reload(dl) import s01 imp.reload(s01) try: dbstr = db.connstr datecount = td.DateCount except: db = dl.DBConn(host="127.0.0.1", uid="sa", pwd="geniustom", cata="FutureHis") td = dl.TradeData(db.conn) def daytrade(s): return cm.runDayTrade(db, td, fName=s.FName, cName=__name__, sName=s.s1, sTittle=s.STittle) daytrade(s01)
import lib.dblib as dl import lib.indicator as il import lib.strategy_lib as sl import lib.tracking as tl import lib.analytics as an import numpy as np import pylab as pl import scipy as sc import matplotlib.pyplot as plt Market = 'TX00' DorN = 'N' dbt = dl.DBConn(host="192.168.1.102", uid="sa", pwd="geniustom", cata="FutureData") tdt = dl.TradeData(dbt.conn, Market, DorN) dayindi = il.indicatorGroup() #========================================================================= #dayindi=tdt.FetchDateByDB("20/03/13") #D: #dayindi=tdt.FetchDateByDB("20/03/16") #D: #dayindi=tdt.FetchDateByDB("20/03/17") #D: #dayindi=tdt.FetchDateByDB("20/03/18") #D: #dayindi=tdt.FetchDateByDB("20/03/20") #D: #dayindi=tdt.FetchDateByDB("20/03/23") #D: #dayindi=tdt.FetchDateByDB("20/03/24") #D: #dayindi=tdt.FetchDateByDB("20/03/25") #D: #dayindi=tdt.FetchDateByDB("20/03/26") #D: #dayindi=tdt.FetchDateByDB("20/03/27") #D:
t0 = time.time() sorted_feature_key.sort() sorted_option_key.sort() print('sort time:', time.time() - t0) print('future data cnt:', len(sorted_feature_key)) print('option data cnt:', len(sorted_option_key)) ################################################################### for i in range(len(sorted_feature_key)): kDate, kTime, kName = sorted_feature_key[i].split(',') sorted_feature_key[i] = ','.join([kName, kTime, kDate]) for i in range(len(sorted_option_key)): kDate, kTime, kName = sorted_option_key[i].split(',') sorted_option_key[i] = ','.join([kName, kTime, kDate]) dbcf = ldb.DBConn('127.0.0.1', 'sa', 'geniustom', 'FutureData') dbco = ldb.DBConn('127.0.0.1', 'sa', 'geniustom', 'OptionData') qf = ldb.Query(dbcf.conn) qc = ldb.Query(dbco.conn) ################################################################### t0 = time.time() fk_invalid_cnt = 0 for fk in sorted_feature_key: fdata = cache.hgetall(fk) if len(fdata) < 37: if CheckKeyIsInvalid(fk) == True: cache.delete(fk) fk_invalid_cnt += 1 #print('------------------- ',fk,' error -------------------') #print(fdata) else: