def active_strategy(start_date, end_date, update=False, source="cp68", market="^VNINDEX"): symbols = getliststocks(typestock=market) for ticker in symbols: try: # ninja_trading(ticker, start, end, realtime = update, source = source) # hedgefund_trading(ticker, start, end, realtime = update, source = source) hung_canslim(ticker, start=start_date, end=end_date, realtime=update, source=source, market=market, ndays=2, typetrade='Long') # mean_reversion(ticker, start, end, realtime = update, source = source) # bollinger_bands(ticker, start, end, realtime = update, source = source) # short_selling(ticker, start, end, realtime = update, source = source) except Exception as e: print(e) print("Error in reading symbol: ", ticker) pass
def analysis_trading(tickers, start, end, update=False, source="cp68", trade='Long'): if tickers == None: tickers = getliststocks(typestock="TICKER") if tickers == 'VN30': tickers = getliststocks(typestock="VN30") # data = pd.read_csv('fundemental_stocks_all.csv', parse_dates=True, index_col=0) # data['Diff_Price'] = data['Close'] - data['EPS']*data['PE']/1000 # data['EPS_Price'] = data['EPS']/data['Close']/1000 # df = data.query("MeanVol_10W > 80000") # df = data.query("MeanVol_13W > 80000") # df = df.query("EPS > 1000") # df = df.query("ROE > 15") # # canslim_symbol = df.index.tolist() # # tickers = canslim_symbol for ticker in tickers: # print(" Analysing ..." , ticker) try: # ninja_trading(ticker, start, end, realtime = update, source = source) # hedgefund_trading(ticker, start, end, realtime = update, source = source) # hung_canslim(ticker, start, end, realtime = update, source = source, ndays = 5, typetrade = 'MarkM_tickers')# hung_canslim(ticker, start, end, realtime=update, source=source, ndays=2, typetrade=trade) # hung_canslim(ticker, start, end, realtime = update, source = source, ndays = 3, typetrade = 'Short') # mean_reversion(ticker, start, end, realtime = update, source = source) # bollinger_bands(ticker, start, end, realtime = update, source = source) # short_selling(ticker, start, end, realtime = update, source = source, ndays = 2, typetrade = 'Short') except Exception as e: print(e) print("Error in reading symbol: ", ticker) pass
def analysis_trading(tickers, start, end, update=False, nbdays=15, source="cp68", trade='Long'): if tickers == None: tickers = getliststocks(typestock="TICKER") if tickers == 'VN30': tickers = getliststocks(typestock="VN30") # data = pd.read_csv('fundemental_stocks_all.csv', parse_dates=True, index_col=0) # data['Diff_Price'] = data['Close'] - data['EPS']*data['PE']/1000 # data['EPS_Price'] = data['EPS']/data['Close']/1000 # df = data.query("MeanVol_10W > 80000") # df = data.query("MeanVol_13W > 80000") # df = df.query("EPS > 1000") # df = df.query("ROE > 15") # # canslim_symbol = df.index.tolist() # # tickers = canslim_symbol # result = pd.DataFrame([['Ticker', 'Advise']]) result = pd.DataFrame(columns=['Ticker', 'Advise', 'PCT', 'Close']) result = result.set_index('Ticker') for ticker in tickers: # print(" Analysing ..." , ticker) try: # ninja_trading(ticker, start, end, realtime = update, source = source) # hedgefund_trading(ticker, start, end, realtime = update, source = source) # hung_canslim(ticker, start, end, realtime = update, source = source, ndays = 5, typetrade = 'MarkM_tickers')# res = hung_canslim(ticker, start, end, realtime=update, source=source, ndays=nbdays, typetrade=trade) if len(res) > 1: # result = result.append([res]) result.loc[res[0]] = [res[1], 100 * res[2], res[3]] # hung_canslim(ticker, start, end, realtime = update, source = source, ndays = 3, typetrade = 'Short') # mean_reversion(ticker, start, end, realtime = update, source = source) # bollinger_bands(ticker, start, end, realtime = update, source = source) # short_selling(ticker, start, end, realtime = update, source = source, ndays = 2, typetrade = 'Short') except Exception as e: print(e) print("Error in reading symbol: ", ticker) pass return result