Jump to content
z.jevtic

How to update stop order trigger price

Recommended Posts

Guest andreif

Something like this:

var order = client.TradesAndOrders.GetActiveStopLimitOrder(orderId.ToString()).ActiveStopLimitOrder;

        var request = new UpdateStopLimitOrderRequestDTO
        {
            OrderId = orderId,
            TradingAccountId = (int)order.TradingAccountId,
            Direction = order.Direction,
            MarketId = order.MarketId,
            Quantity = order.Quantity,
            OfferPrice = order.TriggerPrice * 0.9M,
            TriggerPrice = newTriggerPrice, // <<<<
            BidPrice = order.TriggerPrice * 1.1M,
        };

        var resp = client.TradesAndOrders.UpdateOrder(request);
        client.MagicNumberResolver.ResolveMagicNumbers(resp);

Share this post


Link to post

Just an additional question on this point; the "var resp" object looks to be an ApiTradeOrderResponseDTO object.

 

For an UpdateOrder call, will the status field be populated in the main body of the object i.e. resp.Status, or is it in one of the resp.Orders ApiOrderResponseDTO objects?

 

Thanks.

Share this post


Link to post
Guest andreif

It's populated both in the main response object and in the appropriate ApiOrderResponseDTO object. 

I'd suggest to use the main response object's (ApiTradeOrderResponseDTO) Status and StatusResolved fields, as the Orders array can be left empty when the Update() call has failed.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×