Jump to content

Search the Community

Showing results for tags 'cancel order'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Gain Capital API FAQ
    • General Questions and Discussion

Found 1 result

  1. Cancel Order

    Hi there, I have a series of unit tests that run against the methods I've written to call various GCAPI methods. One part of this series tests my methods to call the various Trade/Order endpoints. First, I call /order/newstoplimitorder and successfully place a new resting entry order. After a few other things, I call /order/cancel on the entry order (only if the order hasn't already been triggered). This is where I'm getting a little stuck. I'm using all the properties described in the documentation, including the Username and Session token I received on authorization (included both in the POST JSON data, and as separate headers). My OrderId property is the order id I received from opening the entry order, and the TradingAccountId was received from calling /UserAccount/ClientAndTradingAccount. This Account id was also successfully used to place the entry order. Despite all this, I'm still receiving 401 response codes when calling /order/cancel. Here is the POST packet: "{\"OrderId\":724499552,\"Reference\":\"Trade #724499552 setup invalidated\",\"UserName\":\"********\",\"Session\":\"a52f7a51-c01d-4a81-a6db-82eb37c70d06\",\"TradingAccountId\":*********}" Can you tell me what I'm doing wrong? Thanks! Garrett