Skip to content

Using place_stop_order() for take profit orders #39

@cjh808

Description

@cjh808

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. :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions