self._cl_calculator.find_targets() curr_time = datetime.now() if end_time is not None: curr_time = end_time latest_bp = self.__db.get_latest_bp(curr_time) latest_sp = self.__db.get_latest_sp(curr_time) self.__db.merge_clmacd_result(curr_time, len(latest_bp), len(latest_sp)) self.__db.update_log_time('last_merge_clmacd_result_time') mail = ZeusMail() mail.send_mail(curr_time, latest_bp, latest_sp) if __name__ == '__main__': bd = BaseDB() sbf = StockBaseFetcher(bd) df = KDataFetcher(bd) cc = CLMACDCalculator(bd) zeus = Zeus(bd, sbf, df, cc) # zeus.refresh_stock_list() # zeus.refresh_targets() # st = datetime.strptime('2017-06-01 16:05:00', '%Y-%m-%d %H:%M:%S') # zeus.refresh_targets(st) # 开始运行 zeus.start()
row['id_time'], row['code'], row['price']) text += '</table></body></html>' msg = MIMEText(text, 'html', 'utf-8') msg["Subject"] = '%s - bp:%d sp:%d' % ( calc_time.strftime('%Y-%m-%d %H:%M:%S'), bp_count, sp_count) msg["From"] = self.__user msg["To"] = self.__to try: s = smtplib.SMTP_SSL("smtp.qq.com", 465) s.login(self.__user, self.__pwd) s.sendmail(self.__user, self.__to, msg.as_string()) s.quit() print("Mail sending Success!") except smtplib.SMTPException as e: print("Mail sending Falied,%s" % e) if __name__ == '__main__': curr_time = datetime.now() db = BaseDB() latest_bp = db.get_latest_bp(curr_time) latest_sp = db.get_latest_sp(curr_time) db.merge_clmacd_result(curr_time, len(latest_bp), len(latest_sp)) db.update_log_time('last_merge_clmacd_result_time') mail = ZeusMail() mail.send_mail(curr_time, latest_bp, latest_sp)
if len(df) < 80: return last_index = len(df) - 1 if not if_times(df['date'][last_index], k_type): df = df.drop(last_index) macd_dif, macd_dea, macd_val = ta.MACDEXT(np.array(df['close']), fastperiod=12, fastmatype=1, slowperiod=26, slowmatype=1, signalperiod=9, signalmatype=1) macd_val = macd_val * 2 df['dif'] = pd.Series(macd_dif, index=df.index) df['dea'] = pd.Series(macd_dea, index=df.index) df['macd'] = pd.Series(macd_val, index=df.index) remain_count = 40; if k_type == '15': remain_count = 80 df1 = df[(len(df) - remain_count):len(df)] df1.to_sql(table_name, self.__db.get_engine(), if_exists='append', index=False) except Exception as e: print(":", e.__repr__(), code) if __name__ == '__main__': base_db = BaseDB() sf = KDataFetcher(base_db) # sf.fetch_hist_min_label_k_data_all('30') # sf.fetch_hist_min_label_k_data_all('15') # bd = base_db.get_macd_data('000066', '15') sf.fetch_hist_min_label_k_data(base_db, '000066', '30', 1, 1)
def __init__(self): BaseDB.__init__(self)
def __init__(self): # super(DomainDB, self).__init__() BaseDB.__init__(self)
def __init__(self): #super(DomainDB, self).__init__() BaseDB.__init__(self)