import sys import os.path print(os.path.abspath('')) sys.path.insert(1, os.path.abspath('./Strategy')) import main_strategy # sys.path.insert(1, os.path.abspath('./BONUS')) # from func_position_info import get_position_info # import schedule # import time # pnl_un = 0 # _, _, pnl_un, _, _= get_position_info("BTCUSDT") # print(pnl_un) # sym_1, sym_1_price_decimals, sym_1_qty_decimals, sym_2, sym_2_price_decimals, sym_2_qty_decimals = main_strategy.perform_strategy() # print(sym_1, sym_1_price_decimals, sym_1_qty_decimals, sym_2, sym_2_price_decimals, sym_2_qty_decimals) # caller = main_strategy.StatStrategy() # caller.perform_strategy() # print(caller.sym_1, caller.sym_1_price_decimals, caller.sym_1_qty_decimals, caller.sym_2, caller.sym_2_price_decimals, caller.sym_2_qty_decimals, caller.hedge_ratio) # schedule.every(10).seconds.do(caller.perform_strategy) # while True: # schedule.run_pending() # print(caller.sym_1, caller.sym_1_price_decimals, caller.sym_1_qty_decimals, caller.sym_2, caller.sym_2_price_decimals, caller.sym_2_qty_decimals) # time.sleep(1) # from func_position_calls import active_position_confirmation # from func_position_calls import open_position_confirmation # print(active_position_confirmation("ETHUSDT")) # print(open_position_confirmation("BTCUSDT")) from func_get_time import convert_time from func_position_calls import get_closed_pnl_info from func_execution_calls import initialise_order_execution from config_execution_api import session_private #_,long_order_time,_,_=initialise_order_execution("ETHUSDT", "Long", 100) # order = session_private.place_active_order( # symbol="BTCUSDT", # side="Buy", # order_type="Market", # qty=0.1, # time_in_force="GoodTillCancel", # reduce_only=False, # close_on_trigger=False # ) # long_order_time = order["result"]["created_time"] # print(long_order_time) # print(convert_time(long_order_time)) # if long_order_time: # order_time1 = "2022-05-22T16:42:20Z" # order_time2 = "2022-05-22T16:42:00Z" # order_time3 = "2022-05-22T08:42:20Z" # order_time4 = "2022-05-22T08:42:00Z" # order_time5 = "2022-05-20T07:33:44Z" # start_time1 = (convert_time(order_time1)) # start_time2 = (convert_time(order_time2)) # start_time3 = (convert_time(order_time3)) # start_time4 = (convert_time(order_time4)) # start_time5 = (convert_time(order_time5)) # long_order_time ="2022-05-20T07:33:44Z" # short_order_time ="2022-05-20T07:33:44Z" # start_time = min(convert_time(long_order_time), convert_time(short_order_time)) # print("start time: ", start_time) # close_pnl,_ = get_closed_pnl_info("XTZUSDT", start_time) # print("Close PnL: ", close_pnl) # print("\n") # print("start time: ", start_time1) # close_pnl1,_ = get_closed_pnl_info("XTZUSDT", start_time1) # print("Close PnL: ", close_pnl1) # print("\n") # print("start time: ", start_time2) # close_pnl2,_ = get_closed_pnl_info("XTZUSDT", start_time2) # print("Close PnL: ", close_pnl2) # print("\n") # print("start time: ", start_time3) # close_pnl3,_ = get_closed_pnl_info("XTZUSDT", start_time3) # print("Close PnL: ", close_pnl3) # print("\n") # print("start time: ", start_time4) # close_pnl4,_ = get_closed_pnl_info("XTZUSDT", start_time4) # print("Close PnL: ", close_pnl4) # print("\n") # print("start time: ", start_time5) # close_pnl5,_ = get_closed_pnl_info("XTZUSDT", start_time5) # print("Close PnL: ", close_pnl5) # print("\n") # print(close_pnl) # search_sym = "XRPBIT" # from pybit import HTTP # session = HTTP("https://api-testnet.bybit.com", # spot=True) # symlist = session.query_symbol()['result'] # if len(symlist): # for sym in symlist: # # if sym['innovation']: # # print(sym['name']) # if search_sym == sym['name']: # print(sym['baseCurrency'], sym['quoteCurrency']) # print(type(symlist)) # import time # from pybit import HTTP # session = HTTP("https://api-testnet.bybit.com", # api_key="", api_secret="") # price_info = session.query_kline( # symbol="BTCUSDT", # interval="D", # from_time = 1640970000 #int(time.time())-10000 # ) # print(price_info) from func_get_price import get_latest_price print(get_latest_price('ETHUSDT','Buy'))