"KRW-ETC" , # 이더리움클래식 "KRW-BAT" , # 베이직어텐션토큰 "KRW-HBAR" , # 헤데라해시그래프 "KRW-ZIL" , # 질리카 "KRW-MANA" , # 디센트럴랜드 "KRW-TFUEL", # 쎄타퓨엘 "KRW-ICX" , # 아이콘 ] coin_names = top30big # reverseAcc = sorted(info, key=lambda x:float(x["acc_trade_price_24h"]))[20:-10] # test? # Dash external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css'] app = dash.Dash(__name__, external_stylesheets=external_stylesheets) accs = broker.get_accounts() current_balance = [cname for cname, v in accs.items() if cname not in ["KRW-KRW", "KRW-USDT"] and (v["balance"]*v["avg_buy_price"]+v["locked"]*v["avg_buy_price"]>=5000)] sum_balance_value = sum([accs.get(cname)['balance']*accs.get(cname)['avg_buy_price'] for cname in current_balance]) broker.set_cash(START_CASH - sum_balance_value if START_CASH>=sum_balance_value else 0) current_order_used = len(current_balance) hours_check = [False for _ in range(24)] minutes_check = [False for _ in range(60)] # minutes_check[0] = True # 거래가 일어나는 00분은 제외(데이터 갱신이 안될 수 있음) coin_data = [] buy_orders = [] sell_orders = [] pending_orders = [] sold_orders = [] try: with open('tmp/pending', 'rb') as f: pending_orders = pickle.load(f)
coin_names = broker.get_market_info() current_order = 0 info = broker.get_current_info(coin_names) top30 = sorted(info, key=lambda x:float(x["acc_trade_price_24h"]), reverse=True)[:30] # reverseAcc = sorted(info, key=lambda x:float(x["acc_trade_price_24h"]))[20:-10] # test? print("Load coin data") coin_data = [] for coin_name in tqdm(coin_names): coin_data.append(CoinData(coin_name)) time.sleep(0.1) cash_per_order = (broker.get_cash() / (MAX_ORDER-current_order)) current_accounts = broker.get_accounts() buy_orders = [] for coin in coin_data: cond_buy, cond_sell = myStrategyRSI(coin) account = current_accounts.get(coin.coin_name) if account: if account["balance"] > 0 and not account["locked"]: # 현재 코인 있음 if cond_sell and cond_buy: continue elif cond_sell: broker.sell(coin.coin_name, account["balance"], coin.df["trade_price"][-2]) #전일종가에 판매 else: market_info = broker.marketCheck(coin.coin_name) if not market_info["market"]["state"] == "active":