ClosePosition, UpdatePosition and Live Key connecting to Demo URL

1 post / 0 new
himaniajay1
ClosePosition, UpdatePosition and Live Key connecting to Demo URL

Hi,

I have got 3 issues:

closePosition()
updatePosition() and
Application still using the 'Demo URL' after disabling the Demo Key and enabling the Live Key.

Issue1: closePosition

I am using Java API to close the position. I have applied the workaround that "ajochems" recommended in https://labs.ig.com/node/36 post.

The parameters I am passing are:
dealId, direction,size and orderType.

When I execute the code, the server throws:

POST request for "https://demo-api.ig.com/gateway/deal/positions/otc" resulted in 500 (Internal Server Error); invoking error handler
Error:500 Internal Server Error

I have also tried with "PUT" as someone else suggested that might work.

Issue 2: updatePosition
I get 500 (Internal Server Error); invoking error handler while updating the position.

This is the snippet of code I am using:

UpdateOTCPositionV1Request updatePositionRequest = new UpdateOTCPositionV1Request();
updatePositionRequest.setLimitLevel(new BigDecimal(6720));
updatePositionRequest.setStopLevel(new BigDecimal(6700));

//createPositionRequest.setStopLevel(new BigDecimal(10));

api.updateOTCPositionV1(authenticationContext.getConversationContext(),"DIAAAAAMES5KJA7", updatePositionRequest);

This is the full error log:

PUT request for "https://demo-api.ig.com/gateway/deal/positions/otc/DIAAAAAMES5KJA7" resulted in 500 (Internal Server Error); invoking error handler
Unexpected error:500 Internal Server Error

Issue 3: Application still using the 'Demo URL' after disabling the Demo Key and enabling the Live Key.

Also, when I deactivate the "Demo Account Key" (by going to my account-->web api keys option) and enable the "Live Account Key" in my code, the application is still trying to connect to the demo account. Am I missing any step that will make it work?

Thanks
H