invalid.input error when trying to post working order

5 posts / 0 new
Last post
dn355
invalid.input error when trying to post working order

Hello, I'm having trouble trying to post a new working order via the API, and get the {"errorCode":"invalid.input"} response which isn't very helpful. Is there anyway to get deeper debug info?

I'm using python.... login and http get functions (positions etc.) work fine... but http post for working orders does not.

Can anyone spot anything obvious in the workingOrder json and code below?
What are the reason for 'invalid.input'? Is it just data formats or other reason as well?


print "\nPlace working order..."
wo_url = "https://demo-api.ig.com/gateway/deal/workingorders/otc"
workingOrder = {
"epic": "CS.D.GBPUSD.TODAY.IP",
"expiry": "DFB",
"direction": "SELL",
"size": "1",
"level": "16341.4",
"forceOpen": "false",
"type": "LIMIT",
"currencyCode": "GBP",
"timeInForce": "GOOD_TILL_DATE",
"goodTillDate": "2015:06:06-01:00:00",
"guaranteedStop": "false",
"stopDistance": "10",
"limitDistance": "20"
}
r = requests.post(wo_url, headers=igHeaders, data=json.dumps(workingOrder))
print r.text

Any pointers gratefully received!
Thanks
rgds
Dan

NEY
Hi dn355,

It might be your "goodTillDate" key.
In the documentation, if i understood well the pattern, the date should be: yyyy/mm/dd hh:mm:ss (in your case 2015/06/06 01:00:00)

dn355
Thanks Ney, that's what I

Thanks Ney, that's what I originally thought too, and consequently tried several different formats to no avail.

However, I've finally figured it out! I need 'version' : '2' in the http headers. Not sure that I've seen the version requirement anywhere in the documentation, something like { "errorCode" : "invalid.version" } would be nice!

Now getting this error {"errorCode":"validation.pattern.invalid.goodTillDate"} which points to your suggestion. ;-)

working orders now placed.

Thanks
rgds
Dan

APItrader
There are (currently) two

There are (currently) two versions of some functions and unless specified the version defaults to 1. Neither of the versions are invalid, but they may take different parameters.

spartakkus
Hi,

Hi,

try changing "expiry": "DFB" to "expiry": "-"

Log in or register to post comments