Jump to content
Sign in to follow this  
josé muñiz

Closing orders does not always work

Recommended Posts

Sometimes, when I try to close a position in our application I get the messsage “Cannot create new position when closing specific order serial number(s)”, but trying to close the position with the Flex ITP succeeds. It’s worth mentioning that most positions are closed correctly by our app. I’ve copied a sample of the JSON DTOs we send (first one) and the ones sent by Flex. Most of the extra fields with nulls and zeros are autogenerated and we have no control over them. I’ve tried removing them in the test harness but it changes nothing.

{
  "OrderId": 0,
  "MarketId": 400494179,
  "Currency": null,
  "AutoRollover": true,
  "Direction": "sell",
  "Quantity": 10000.0,
  "QuoteId": null,
  "BidPrice": 1.00100,
  "OfferPrice": 1.00132,
  "AuditId": "sbPreProdFX12839254",
  "TradingAccountId": 400195958,
  "IfDone": null,
  "Close": [469637454]
}

{
  "BidPrice":0.82845,
  "Close":[469636669],
  "Direction":"sell",
  "AuditId":"634596294531260447",
  "OfferPrice":0.82878,
  "TradingAccountId":400195958,
  "Quantity":10000,
  "MarketId":400481146,
  "QuoteId":null
}

As an example of this behavior, I’m unable to close the position # 469637454. I haven’t tried closing it with Flex because it usually succeeds, so I don’t want to spoil the last piece of evidence I have about this issue. I’m using the account XX790537 for these tests.

Are we missing something?

Share this post


Link to post
Guest mrdavidlaing

Sometimes, when I try to close a position in our application I get the messsage “Cannot create new position when closing specific order serial number(s)”, but trying to close the position with the Flex ITP succeeds. It’s worth mentioning that most positions are closed correctly by our app. I’ve copied a sample of the JSON DTOs we send (first one) and the ones sent by Flex. Most of the extra fields with nulls and zeros are autogenerated and we have no control over them. I’ve tried removing them in the test harness but it changes nothing.

{
  "OrderId": 0,
  "MarketId": 400494179,
  "Currency": null,
  "AutoRollover": true,
  "Direction": "sell",
  "Quantity": 10000.0,
  "QuoteId": null,
  "BidPrice": 1.00100,
  "OfferPrice": 1.00132,
  "AuditId": "sbPreProdFX12839254",
  "TradingAccountId": 400195958,
  "IfDone": null,
  "Close": [469637454]
}

{
  "BidPrice":0.82845,
  "Close":[469636669],
  "Direction":"sell",
  "AuditId":"634596294531260447",
  "OfferPrice":0.82878,
  "TradingAccountId":400195958,
  "Quantity":10000,
  "MarketId":400481146,
  "QuoteId":null
}

As an example of this behavior, I’m unable to close the position # 469637454. I haven’t tried closing it with Flex because it usually succeeds, so I don’t want to spoil the last piece of evidence I have about this issue. I’m using the account XX790537 for these tests.

Are we missing something?

Debugging this is going to be really tricky unless you can provide a set of steps that reproduce the error consistently. Please can you create a separate test application, or include the set of calls in the JS test harness (https://ciapipreprod.cityindex.co.uk/tradingapi) that show the error happening. Unless a City Index developer has a way to trigger the error, they have no hope of trawling through the 100’s of MBs of server side logs to find out what is going wrong.

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  
×