{"action":"opened","issue":{"url":"https://api.github.com/repos/ccxt/ccxt/issues/1925","repository_url":"https://api.github.com/repos/ccxt/ccxt","labels_url":"https://api.github.com/repos/ccxt/ccxt/issues/1925/labels{/name}","comments_url":"https://api.github.com/repos/ccxt/ccxt/issues/1925/comments","events_url":"https://api.github.com/repos/ccxt/ccxt/issues/1925/events","html_url":"https://github.com/ccxt/ccxt/issues/1925","id":297929098,"number":1925,"title":"Lack of txid in Kraken order response not handled","user":{"login":"justinxjx","id":1429470,"avatar_url":"https://avatars3.githubusercontent.com/u/1429470?v=4","gravatar_id":"","url":"https://api.github.com/users/justinxjx","html_url":"https://github.com/justinxjx","followers_url":"https://api.github.com/users/justinxjx/followers","following_url":"https://api.github.com/users/justinxjx/following{/other_user}","gists_url":"https://api.github.com/users/justinxjx/gists{/gist_id}","starred_url":"https://api.github.com/users/justinxjx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinxjx/subscriptions","organizations_url":"https://api.github.com/users/justinxjx/orgs","repos_url":"https://api.github.com/users/justinxjx/repos","events_url":"https://api.github.com/users/justinxjx/events{/privacy}","received_events_url":"https://api.github.com/users/justinxjx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-16T21:43:55Z","updated_at":"2018-02-16T21:43:55Z","closed_at":null,"author_association":"NONE","body":"- OS: Windows 10\r\n- Programming Language version: Python 3.6.3 :: Anaconda custom (64-bit)\r\n- CCXT version: 1.10.1128\r\n- Exchange: Kraken\r\n- Method: ```create_order```\r\n\r\nIt appears that kraken.py does not handle the case when txids are not returned in the response from Kraken. According to their API docs, the txid array is only added if an order was added successfully. In my case, I was sending the ```params = {'validate': 'true'}``` for testing my order configuration. Since this optional parameter is for input validation only, no order is actually submitted. You can see in the response posted below, that the 'descr' order info was received, but no txid was included. This resulted in the KeyError within kraken.py.\r\n\r\nMy call:\r\n```\r\norder_resp = my_exchange.create_order(my_pair, my_order_type, my_side,\r\n                                              my_amount, limit_price, {'validate': 'true'})\r\n```\r\nVerbose output:\r\n```\r\nPOST https://api.kraken.com/0/private/AddOrder\r\nRequest: {'API-Key': 'keykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeyke', 'API-Sign': 'signsignsignsignsignsignsignsignsignsignsignsignsignsignsignsignsignsignsignsignsignsign', 'Content-Type': 'application/x-www-form-urlencoded', 'User-Agent': 'python-requests/2.18.4', 'Accept-Encoding': 'gzip, deflate'} nonce=1518815637482&pair=XXLMXXBT&type=sell&ordertype=market&volume=301.0&validate=true\r\nPOST https://api.kraken.com/0/private/AddOrder\r\nResponse: {'Date': 'Fri, 16 Feb 2018 21:13:58 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Set-Cookie': '__cfduid=d0047edfafe0bc32a83d558b28d9cc63c1518815637; expires=Sat, 16-Feb-19 21:13:57 GMT; path=/; domain=.kraken.com; HttpOnly', 'Content-Encoding': 'gzip', 'Vary': 'Accept-Encoding', 'Expect-CT': 'max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"', 'Server': 'cloudflare', 'CF-RAY': '3ee38388cc0452b4-MIA'} {\"error\":[],\"result\":{\"descr\":{\"order\":\"sell 301.00000000 XLMXBT @ market\"}}}\r\nTraceback (most recent call last):\r\n  File \"S:\\Crypto\\Programming\\Python\\test_script.py\", line 83, in <module>\r\n    my_amount, limit_price, {'validate': 'true'})\r\n  File \"C:\\Program Files\\Python36\\lib\\site-packages\\ccxt\\kraken.py\", line 563, in create_order\r\n    length = len(response['result']['txid'])\r\nKeyError: 'txid'\r\n```\r\n\r\nFrom kraken.py:\r\n```\r\nresponse = self.privatePostAddOrder(self.extend(order, params))\r\nlength = len(response['result']['txid'])\r\nid = response['result']['txid'] if (length > 1) else response['result']['txid'][0]\r\nreturn {\r\n    'info': response,\r\n    'id': id,\r\n}\r\n``` "}}
{"actor":{"display_login":"justinxjx"}}