delta-exchange / python-rest-client

https://pypi.org/project/delta-rest-client/
13 stars 19 forks source link

Using place_stop_order() for take profit orders #39

Open cjh808 opened 2 years ago

cjh808 commented 2 years ago

Trying to place a take profit order, alongside my stop order, but there's no arguments for this in the place_stop_order() function. I feel like it should take an additional argument SL_TP_order='stop_loss_order' or 'take_profit_order' that can then be used in the order parameters. So, the function would look something like this:

def place_stop_order(self, product_id, size, side, stop_price=None, limit_price=None, trail_amount=None, order_type=OrderType.LIMIT, isTrailingStopLoss=False,SL_TP_order='take_profit_order'): order = { 'product_id': product_id, 'size': int(size), 'side': side, 'order_type': order_type.value, 'stop_order_type': SL_TP_order, } .........

That way both Stop Loss orders and Take Profit orders can be passed through the place_stop_order(). If there's a much easier way of placing Take Profit orders, please let me know. I had to modify my version of the library as above to use it. :)