def check(): print("What do you want to check? ") print("1. entry condition") print("2. minute") print("3. position") print("4. realizedPNL") input_num = input("\nEnter a number : ") if (input_num == '1'): start = time.time() import heikin_ashi heikin_ashi.get_hour(6) heikin_ashi.get_hour(4) heikin_ashi.get_hour(2) heikin_ashi.get_hour(1) from binance_futures import get_volume previous_volume = get_volume("PREVIOUS", "1HOUR") current_volume = get_volume("CURRENT", "1HOUR") print("PREVIOUS VOLUME : " + str(previous_volume)) print("CURRENT VOLUME : " + str(current_volume)) if (previous_volume / 5) < current_volume: print(colored("VOLUME ENTRY : YES", "green")) else: print(colored("VOLUME ENTRY : NO", "red")) if heikin_ashi.pattern_broken("5MINUTE") == "BROKEN": print(colored("5 MIN PATTERN : BROKEN", "red")) if heikin_ashi.pattern_broken("1HOUR") == "BROKEN": print(colored("1 HOUR PATTERN : BROKEN", "red")) print(f"Time Taken: {time.time() - start} seconds") elif (input_num == '2'): import heikin_ashi loop = input("Do you want to loop? [Y/n]") or 'n' if loop == 'Y': while True: heikin_ashi.get_current_minute(1) heikin_ashi.get_current_minute(5) print() time.sleep(3) else: start = time.time() heikin_ashi.get_current_minute(1) heikin_ashi.get_current_minute(5) print(f"Time Taken: {time.time() - start} seconds") elif (input_num == '3'): start = time.time() from get_position import get_position_info print("\nThe <get_position.py> return value is : " + get_position_info()) print(f"Time Taken: {time.time() - start} seconds") else: import get_realizedPNL print()
def lets_make_some_money(i): response = binance_futures_api.position_information(i) mark_price = binance_futures_api.mark_price(i) klines_1min = binance_futures_api.KLINE_INTERVAL_1MINUTE(i) klines_5min = binance_futures_api.KLINE_INTERVAL_5MINUTE(i) klines_1HOUR = binance_futures_api.KLINE_INTERVAL_1HOUR(i) position_info = get_position.get_position_info(i, response) profit_threshold = get_position.profit_threshold() HA_current.output(mark_price, klines_1HOUR) HA_current.output(mark_price, klines_5min) HA_current.output(mark_price, klines_1min) leverage = config.leverage[i] if int(response.get("leverage")) != leverage: binance_futures_api.change_leverage(i, leverage) if response.get('marginType') != "isolated": binance_futures_api.change_margin_to_ISOLATED(i) if not live_trade: backtest.trigger_backtest(i, mark_price, profit_threshold, klines_1min) if position_info == "LONGING": if place_order.EXIT_LONG(i, response, mark_price, profit_threshold, klines_1min): if live_trade: binance_futures_api.close_position(i, "LONG") print("ACTION : 💰 CLOSE_LONG 💰") else: print(colored("ACTION : HOLDING_LONG", "green")) elif position_info == "SHORTING": if place_order.EXIT_SHORT(i, response, mark_price, profit_threshold, klines_1min): if live_trade: binance_futures_api.close_position(i, "SHORT") print("ACTION : 💰 CLOSE_SHORT 💰") else: print(colored("ACTION : HOLDING_SHORT", "red")) else: if place_order.GO_LONG(mark_price, klines_1min, klines_5min, klines_1HOUR): OPEN_LONG_POSITION(i, mark_price) elif place_order.GO_SHORT(mark_price, klines_1min, klines_5min, klines_1HOUR): OPEN_SHORT_POSITION(i, mark_price) else: DO_NOTHING(i) print("Last action executed @ " + datetime.now().strftime("%H:%M:%S") + "\n")
def lets_make_some_money(): position_info = get_position.get_position_info() six_hour = heikin_ashi.get_hour(6) four_hour = heikin_ashi.get_hour(4) one_hour = heikin_ashi.get_hour(1) five_minute = heikin_ashi.get_current_minute(5) one_minute = heikin_ashi.get_current_minute(1) previous_volume = binance_futures.get_volume("PREVIOUS", "1HOUR") current_volume = binance_futures.get_volume("CURRENT", "1HOUR") if position_info == "LONGING": if DIRECTION_CHANGE_EXIT_LONG(one_hour, previous_volume, current_volume): print("ACTION : 💰 CLOSE_LONG 💰") binance_futures.close_position("LONG") else: print(colored("ACTION : HOLDING_LONG", "green")) elif position_info == "SHORTING": if DIRECTION_CHANGE_EXIT_SHORT(one_hour, previous_volume, current_volume): print("ACTION : 💰 CLOSE_SHORT 💰") binance_futures.close_position("SHORT") else: print(colored("ACTION : HOLDING_SHORT", "red")) else: if (six_hour == "GREEN" or four_hour == "GREEN") and volume_confirmation( previous_volume, current_volume): if GO_LONG(one_minute, five_minute, one_hour): print(colored("ACTION : 🚀 GO_LONG 🚀", "green")) if config.live_trade: binance_futures.open_position("LONG", config.quantity) else: print("ACTION : 🐺 WAIT 🐺") elif (six_hour == "RED" or four_hour == "RED") and volume_confirmation( previous_volume, current_volume): if GO_SHORT(one_minute, five_minute, one_hour): print(colored("ACTION : 💥 GO_SHORT 💥", "red")) if config.live_trade: binance_futures.open_position("SHORT", config.quantity) else: print("ACTION : 🐺 WAIT 🐺") else: print("ACTION : 🐺 WAIT 🐺") print("Last action executed @ " + datetime.now().strftime("%H:%M:%S") + "\n")