You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def close_position():
if get_position_size() > 0:
# order using market price
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
The text was updated successfully, but these errors were encountered:
def close_position():
if get_position_size() > 0:
# order using market price
entry_price = float(get_position_entry_price())
position_size = float(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
The text was updated successfully, but these errors were encountered: