{"action":"closed","issue":{"url":"https://api.github.com/repos/ccxt/ccxt/issues/6225","repository_url":"https://api.github.com/repos/ccxt/ccxt","labels_url":"https://api.github.com/repos/ccxt/ccxt/issues/6225/labels{/name}","comments_url":"https://api.github.com/repos/ccxt/ccxt/issues/6225/comments","events_url":"https://api.github.com/repos/ccxt/ccxt/issues/6225/events","html_url":"https://github.com/ccxt/ccxt/issues/6225","id":533514144,"node_id":"MDU6SXNzdWU1MzM1MTQxNDQ=","number":6225,"title":"cex.py parse_order transpilation error","user":{"login":"7iW","id":58014736,"node_id":"MDQ6VXNlcjU4MDE0NzM2","avatar_url":"https://avatars0.githubusercontent.com/u/58014736?v=4","gravatar_id":"","url":"https://api.github.com/users/7iW","html_url":"https://github.com/7iW","followers_url":"https://api.github.com/users/7iW/followers","following_url":"https://api.github.com/users/7iW/following{/other_user}","gists_url":"https://api.github.com/users/7iW/gists{/gist_id}","starred_url":"https://api.github.com/users/7iW/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/7iW/subscriptions","organizations_url":"https://api.github.com/users/7iW/orgs","repos_url":"https://api.github.com/users/7iW/repos","events_url":"https://api.github.com/users/7iW/events{/privacy}","received_events_url":"https://api.github.com/users/7iW/received_events","type":"User","site_admin":false},"labels":[{"id":604886964,"node_id":"MDU6TGFiZWw2MDQ4ODY5NjQ=","url":"https://api.github.com/repos/ccxt/ccxt/labels/bug","name":"bug","color":"ee0701","default":true,"description":null}],"state":"closed","locked":false,"assignee":{"login":"kroitor","id":1294454,"node_id":"MDQ6VXNlcjEyOTQ0NTQ=","avatar_url":"https://avatars3.githubusercontent.com/u/1294454?v=4","gravatar_id":"","url":"https://api.github.com/users/kroitor","html_url":"https://github.com/kroitor","followers_url":"https://api.github.com/users/kroitor/followers","following_url":"https://api.github.com/users/kroitor/following{/other_user}","gists_url":"https://api.github.com/users/kroitor/gists{/gist_id}","starred_url":"https://api.github.com/users/kroitor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kroitor/subscriptions","organizations_url":"https://api.github.com/users/kroitor/orgs","repos_url":"https://api.github.com/users/kroitor/repos","events_url":"https://api.github.com/users/kroitor/events{/privacy}","received_events_url":"https://api.github.com/users/kroitor/received_events","type":"User","site_admin":false},"assignees":[{"login":"kroitor","id":1294454,"node_id":"MDQ6VXNlcjEyOTQ0NTQ=","avatar_url":"https://avatars3.githubusercontent.com/u/1294454?v=4","gravatar_id":"","url":"https://api.github.com/users/kroitor","html_url":"https://github.com/kroitor","followers_url":"https://api.github.com/users/kroitor/followers","following_url":"https://api.github.com/users/kroitor/following{/other_user}","gists_url":"https://api.github.com/users/kroitor/gists{/gist_id}","starred_url":"https://api.github.com/users/kroitor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kroitor/subscriptions","organizations_url":"https://api.github.com/users/kroitor/orgs","repos_url":"https://api.github.com/users/kroitor/repos","events_url":"https://api.github.com/users/kroitor/events{/privacy}","received_events_url":"https://api.github.com/users/kroitor/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2019-12-05T18:15:54Z","updated_at":"2019-12-06T00:18:03Z","closed_at":"2019-12-06T00:18:03Z","author_association":"NONE","body":"- OS: MacOS\r\n- Programming Language version: CPython 3.8.0\r\n- CCXT version: 1.20.35\r\n- Exchange: CEX.IO\r\n- Method: `cex.parse_order`, which is called by `cex.fetch_order`\r\n\r\nThere is a transpilation issue in `cex.py`, in the `parse_order` method.\r\n\r\nIn `cex.js` we have `if (!item['price']) ...` on [line 677](https://github.com/ccxt/ccxt/blob/master/js/cex.js#L677).\r\nIn `cex.py` this gets incorrectly transpiled as `if not item['price']: ...` on [line 648](https://github.com/ccxt/ccxt/blob/master/python/ccxt/cex.py#L648).\r\nThis causes python to throw a `KeyError` when the `'price'` key cannot be found.\r\n\r\nVerbose output is below:\r\n\r\n```\r\nRequest: POST https://cex.io/api/get_order_tx/ {'Content-Type': 'application/json', 'User-Agent': 'python-requests/2.22.0', 'Accept-Encoding': 'gzip, deflate'} {\"key\":\"CENSORED\",\"signature\":\"CENSORED\",\"nonce\":\"1575568751579\",\"id\":\"11043738845\"}\r\n\r\nResponse: POST https://cex.io/api/get_order_tx/ 200 <CIMultiDictProxy('Date': 'Thu, 05 Dec 2019 17:59:12 GMT', 'Content-Type': 'text/json', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Content-Security-Policy-Report-Only': \"default-src 'self';connect-src 'self' https://maps.googleapis.com https://cex.io wss://ws.cex.io/ws;frame-src 'self' * ext.cex.io;font-src 'self' data: 'unsafe-inline' https://fonts.googleapis.com https://fonts.gstatic.com https://static.cex.io;img-src 'self' data: https://static.cex.io;style-src 'self' 'unsafe-inline' https://*.googleapis.com https://code.jquery.com https://static.cex.io;script-src 'self' 'unsafe-inline' 'unsafe-eval' https://static.cex.io;report-uri https://cex.io/cspr;\", 'X-Frame-Options': 'DENY', 'Vary': 'Accept-Encoding', 'Content-Encoding': 'gzip', 'CF-Cache-Status': 'DYNAMIC', 'Expect-CT': 'max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"', 'Server': 'cloudflare', 'CF-RAY': '5407e9996e36e212-ORD')> {\"e\":\"get_order_tx\",\"ok\":\"ok\",\"data\":{\"id\":\"11043738845\",\"type\":\"buy\",\"time\":1575568746195,\"lastTxTime\":1575568746195,\"lastTx\":\"11043738855\",\"pos\":null,\"user\":\"up127082496\",\"status\":\"d\",\"symbol1\":\"BTC\",\"symbol2\":\"USD\",\"amount\":\"0.00200000\",\"kind\":\"api\",\"price\":\"8000\",\"tfacf\":\"1\",\"remains\":\"0.00000000\",\"tfa:USD\":\"0.04\",\"tta:USD\":\"14.80\",\"a:BTC:cds\":\"0.00200000\",\"a:USD:cds\":\"16.04\",\"f:USD:cds\":\"0.04\",\"tradingFeeMaker\":\"0.16\",\"tradingFeeTaker\":\"0.25\",\"tradingFeeStrategy\":\"userVolumeAmount\",\"tradingFeeUserVolumeAmount\":\"3063819\",\"orderId\":\"11043738845\",\"next\":false,\"vtx\":[{\"id\":\"11043738855\",\"type\":\"buy\",\"time\":\"2019-12-05T17:59:06.195Z\",\"user\":\"up127082496\",\"c\":\"user:up127082496:a:USD\",\"d\":\"order:11043738845:a:USD\",\"a\":\"1.20000000\",\"amount\":\"-14.84000000\",\"balance\":\"26.75000000\",\"symbol\":\"USD\",\"order\":\"11043738845\",\"buy\":null,\"sell\":null,\"pair\":null,\"pos\":null,\"office\":\"UK\",\"cs\":\"26.75\",\"ds\":0},{\"id\":\"11043738851\",\"type\":\"buy\",\"time\":\"2019-12-05T17:59:06.195Z\",\"user\":\"up127082496\",\"c\":\"user:up127082496:a:BTC\",\"d\":\"order:11043738845:a:BTC\",\"a\":\"0.00200000\",\"amount\":\"0.00200000\",\"balance\":\"0.01040566\",\"symbol\":\"BTC\",\"order\":\"11043738845\",\"buy\":\"11043738845\",\"sell\":\"11043738326\",\"pair\":null,\"pos\":null,\"office\":\"UK\",\"cs\":\"0.01040566\",\"ds\":0,\"price\":7400.7,\"symbol2\":\"USD\",\"fee_amount\":\"0.04\"}]}}\r\n\r\nTraceback (most recent call last):\r\n  File \"/Users/7iW/arb/src/private_ccxt/orchestrate.py\", line 147, in handle_placed_orders\r\n    updated_orders = await asyncio.gather(\r\n  File \"/Users/7iW/.pyenv/versions/arb/lib/python3.8/site-packages/ccxt/async_support/cex.py\", line 827, in fetch_order\r\n    return self.parse_order(response['data'])\r\n  File \"/Users/7iW/.pyenv/versions/arb/lib/python3.8/site-packages/ccxt/async_support/cex.py\", line 648, in parse_order\r\n    if not item['price']:\r\nKeyError: 'price'\r\n```"}}
{"actor":{"display_login":"kroitor"}}