df['ma_l'] = df['close'].rolling(ml).mean().shift(1) cond = (df['ma_s'] > df['ma_l']) df['status'] = np.where(cond, 1, 0) df.iloc[-1, -1] = 0 if (df['status'][-2] == 0) & (df['status'][-1] == 1): return "지금이니" elif (df['status'][-2] == 1) & (df['status'][-1] == 0): return "팔아!" elif (df['status'][-2] == 1) & (df['status'][-1] == 1): return "홀딩해" elif (df['status'][-2] == 0) & (df['status'][-1] == 0): return "도망쳐" for coin in Bithumb.get_tickers()[:150]: f = open("BestMa.txt", 'r') searchMA = pd.DataFrame(columns=['Ticker', 'MAS', 'MAL']) try: df = get_ohlv_MA(coin) short, long = ma_long_ma_short(df) get_ohlv(coin, short, long) new_data = {'Ticker': coin, 'MAS': short, 'MAL': long} searchMA.append(new_data, ignore_index=True) print(new_data) # data = f"Ticker : {coin} MAS : {short} MAL : {long} \n"
long = int(best.iloc[0]['long']) result = int(best.iloc[0]['result']) return short, long, result def get_ohlv_MA(ticker): df = Bithumb.get_candlestick(ticker, chart_intervals="12h") return df searchMA = pd.DataFrame(columns=['Ticker', 'MAS', 'MAL', 'result']) for coin in Bithumb.get_tickers(): f = open("BestMa.txt", 'r') try: df = get_ohlv_MA(coin) short, long, result = ma_long_ma_short(df) # get_ohlv(coin, short, long) new_data = { 'Ticker': coin, 'MAS': short, 'MAL': long, 'result': result } searchMA = searchMA.append(new_data, ignore_index=True)
""" import sys from PyQt5 import QtGui from PyQt5 import QtWidgets as Q from PyQt5.QtCore import * import time from pybithumb import Bithumb as B doing_job = False from ui import Ui_Dialog ui_class = Ui_Dialog coin_list = ["-"] + B.get_tickers() class autoTrader(QThread): text_out = pyqtSignal(str) def __init__(self, access_token, secret_key, coin, buyPrice, sellPrice): super().__init__() self.access_token = access_token self.secret_key = secret_key self.coin = coin self.buyPrice = buyPrice self.sellPrice = sellPrice def sell_all(self, trader): qty = trader.get_balance(self.coin)