Open swiinger opened 9 months ago
You don't need to create an Order object. Refer to the model doc for corresponding Class you need
ok got it
from gate_api import ApiClient, Configuration, Order, SpotApi, AccountApi, SpotPriceTriggeredOrder, SpotPriceTrigger, SpotPricePutOrder
# import classes we'll need
currency_pair = "CSPR_USDT" sell_price = "0.035" order_amount = "100" trigger_price = "0.033"
spot_price_put_order = SpotPricePutOrder ( type="limit", side= "sell", price= sell_price, # stop-loss price amount=order_amount )
spot_price_trigger = SpotPriceTrigger ( price=trigger_price, rule= '<=', expiration= 604800 #86400*number of days )
spot_price_trigger_order = SpotPriceTriggeredOrder( trigger=spot_price_trigger,put=spot_price_put_order,market=currency_pair )
created = spot_api.create_spot_price_triggered_order(spot_price_trigger_order) # here is the stop loss ! logger.info("order created with id %s", created.id) print (created)
Hello,
I've looked at the python example which is nice but I can't figure out how to create a stop loss order Do I need to use the Order class and how to use the parameters ? I have tried this but I can't give all needed parameters for the stop loss like rule or expiration
and I have an error
HTTP response body: {"label":"INVALID_PARAM_VALUE","message":"invalid argument: put.account"}
Thanks a lot
Chris