Jump to content
Sign in to follow this  
tscreators

updatetradeorder and i am receiving the following 500

Recommended Posts

Hi

 

 

 

I am trying to post to /tradingapi/order/updatetradeorder and i am receiving the following 500 error:

 

json request in given url     http://prntscr.com/jxnu1u

 

 

 

{"HttpStatus":500,"ErrorMessage":"Exception of type 'InstructionProcessorGateway.ErrorResponse.IpException' was thrown.","ErrorCode":0}

 

 

 

Any ideas?

 

 

 

Thanks

Share this post


Link to post

hi ,

i add in post with screenshot kindly check  from this url

http://prntscr.com/jxnu1u

 

{"IfDone":[{"Stop":{"ExpiryDateTimeUTC":null,"Guaranteed":false,"Direction":"sell","Quantity":1000,"Applicability":null,"TriggerPrice":111.115,"OrderId":639236594},"Limit":null}],"Direction":"buy","ExpiryDateTimeUTCDate":null,"LastChangedDateTimeUTCDate":null,"Reference":null,"OcoOrder":null,"Type":null
,"ExpiryDateTimeUTC":null,"Applicability":null,"TriggerPrice":null,"BidPrice":110.144,"AuditId":null,"AutoRollover":false,"MarketId":401449254,"OfferPrice":110.157,"OrderId":639236594,"Currency":null,"Quantity":1000,"QuoteId":null,"LastChangedDateTimeUTC":null,"PositionMethodId":1,"TradingAccountId":401384419,"MarketName":"USD/JPY","Status":null}

regards

tscreators

Share this post


Link to post

Hello,

The problem is that you have set a closing stop order price at 122, which is above the level that the buy trade was entered. The stop order trigger level must be below the price at which you entered the trade since it is a buy trade. I copy/pasted your code, making adjustments for OrderId, TradingAccountId etc. and set the stop level to 109.00, which is below the level at which I placed the trade.

The amendment to the stop value was then accepted successfully.

Kind Regards, PM

Share this post


Link to post

Hi,

Screenshot of my JSON code is below. 

There is a change to the response code you are receiving, it is no longer a HTTP 500 code. Your request is now going through to the servers and you are receiving API response codes.

One thing I noticed in your latest screenshot is that you have PositionMethodId==2, which means Hedging is enabled. I see from your account you now have several active orders in this market now. Is this what you intended? See screenshot at the bottom. 

image.png

 

Active orders on your account.

image.png

 

Share this post


Link to post

Hi,

Use the Limit sub-field within the IfDone section. The Stop sub-field controls the stop loss order and the Limit is for your take profit. 

image.png

 

Kind Regards, PM!

Share this post


Link to post

hi there ,

this one is my json but limit still not working .

{
   "IfDone":[
      {
         "Stop":{
            "ExpiryDateTimeUTC":null,
            "Guaranteed":false,
            "Direction":"sell",
            "Quantity":1000,
            "Applicability":null,
            "TriggerPrice":109,
            "OrderId":0
         },
         "Limit":110.89
      }
   ],
   "Direction":"buy",
   "ExpiryDateTimeUTCDate":null,
   "LastChangedDateTimeUTCDate":null,
   "Reference":null,
   "OcoOrder":null,
   "Type":null,
   "ExpiryDateTimeUTC":null,
   "Applicability":null,
   "TriggerPrice":null,
   "BidPrice":109.613,
   "AuditId":null,
   "AutoRollover":false,
   "MarketId":401449254,
   "OfferPrice":109.626,
   "OrderId":639608826,
   "Currency":null,
   "Quantity":1000,
   "QuoteId":null,
   "LastChangedDateTimeUTC":null,
   "PositionMethodId":2,
   "TradingAccountId":401384419,
   "MarketName":"USD/JPY",
   "Status":null
}

 

regards

tscreators

Share this post


Link to post

Hi,

The Limit order sub-section should be specified in the same way as for the Stop order. The Quantity, Direction, TriggerPrice etc. fields are all required.

Kind Regards, PM 

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
Sign in to follow this  
×