if (datetime.now().strftime("%H:%M") in timelist.timelist.values) : if open_position(quota2_klines): position_check1 = api.get_position(main_contract) getorder=api.get_order() # no holding and no unfinished long order #(getorder == {} | ((getorder.status == 'ALIVE') & (getorder.offset != "OPEN"))) if (position_check1.pos_long_today==0) : print("send order") quote = api.get_quote(main_contract) order = api.insert_order(symbol=main_contract, direction="BUY", offset="OPEN", limit_price=quote.ask_price1, volume=1) position_check2 = api.get_position(main_contract) if (position_check2.pos_long_today == 1): # costprice+0.005 quote1 = api.get_quote(main_contract) print("close position") api.insert_order(symbol=main_contract, direction="SELL", offset="CLOSE", limit_price=position_check1.position_price_long + 0.005, volume=1) 下单合约t2406
李思恒 已回答的问题 2024年3月14日