entry_price = float(get_position_entry_price())
position_size = float(get_position_size())
close_price = ((float(min_markup) * entry_price) + entry_price)
last_price = get_last_price()
if close_price > last_price:
print(f"The desired close_price of {close_price} is greater than the last price of {last_price}")
else:
print(f"The desired close_price of {close_price} is lower than the last price of {last_price}")
order = FuturesOrder(contract=contract, size='0', price='0', close='true', tif='ioc')
try:
order_response = futures_api.create_futures_order(settle, order)
except GateApiException as ex:
logger.error("error encountered creating futures order: %s", ex)
print(f"Error: {ex}")
else:
print(f"No position found. Position size is {get_position_size()}")
Am trying to close an order with the above code, the docs says to set size='0' and close='true' but I get invalid size with close-order error. what am I doing wrong
def close_position(): if get_position_size() > 0:
order using market price
Am trying to close an order with the above code, the docs says to set size='0' and close='true' but I get invalid size with close-order error. what am I doing wrong