{"action":"created","issue":{"url":"https://api.github.com/repos/bitshares/bitshares-core/issues/1295","repository_url":"https://api.github.com/repos/bitshares/bitshares-core","labels_url":"https://api.github.com/repos/bitshares/bitshares-core/issues/1295/labels{/name}","comments_url":"https://api.github.com/repos/bitshares/bitshares-core/issues/1295/comments","events_url":"https://api.github.com/repos/bitshares/bitshares-core/issues/1295/events","html_url":"https://github.com/bitshares/bitshares-core/issues/1295","id":355215245,"node_id":"MDU6SXNzdWUzNTUyMTUyNDU=","number":1295,"title":"[ES plugin] Wrong value of additional_data.fill_data.fill_order ","user":{"login":"Zapata","id":490068,"node_id":"MDQ6VXNlcjQ5MDA2OA==","avatar_url":"https://avatars2.githubusercontent.com/u/490068?v=4","gravatar_id":"","url":"https://api.github.com/users/Zapata","html_url":"https://github.com/Zapata","followers_url":"https://api.github.com/users/Zapata/followers","following_url":"https://api.github.com/users/Zapata/following{/other_user}","gists_url":"https://api.github.com/users/Zapata/gists{/gist_id}","starred_url":"https://api.github.com/users/Zapata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zapata/subscriptions","organizations_url":"https://api.github.com/users/Zapata/orgs","repos_url":"https://api.github.com/users/Zapata/repos","events_url":"https://api.github.com/users/Zapata/events{/privacy}","received_events_url":"https://api.github.com/users/Zapata/received_events","type":"User","site_admin":false},"labels":[{"id":892679259,"node_id":"MDU6TGFiZWw4OTI2NzkyNTk=","url":"https://api.github.com/repos/bitshares/bitshares-core/labels/1b%20User%20Story","name":"1b User Story","color":"0052cc","default":false},{"id":892711059,"node_id":"MDU6TGFiZWw4OTI3MTEwNTk=","url":"https://api.github.com/repos/bitshares/bitshares-core/labels/3d%20Bug","name":"3d Bug","color":"b60205","default":false},{"id":942714807,"node_id":"MDU6TGFiZWw5NDI3MTQ4MDc=","url":"https://api.github.com/repos/bitshares/bitshares-core/labels/6%20Plugin","name":"6 Plugin","color":"5319e7","default":false}],"state":"closed","locked":false,"assignee":{"login":"oxarbitrage","id":21685097,"node_id":"MDQ6VXNlcjIxNjg1MDk3","avatar_url":"https://avatars0.githubusercontent.com/u/21685097?v=4","gravatar_id":"","url":"https://api.github.com/users/oxarbitrage","html_url":"https://github.com/oxarbitrage","followers_url":"https://api.github.com/users/oxarbitrage/followers","following_url":"https://api.github.com/users/oxarbitrage/following{/other_user}","gists_url":"https://api.github.com/users/oxarbitrage/gists{/gist_id}","starred_url":"https://api.github.com/users/oxarbitrage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oxarbitrage/subscriptions","organizations_url":"https://api.github.com/users/oxarbitrage/orgs","repos_url":"https://api.github.com/users/oxarbitrage/repos","events_url":"https://api.github.com/users/oxarbitrage/events{/privacy}","received_events_url":"https://api.github.com/users/oxarbitrage/received_events","type":"User","site_admin":false},"assignees":[{"login":"oxarbitrage","id":21685097,"node_id":"MDQ6VXNlcjIxNjg1MDk3","avatar_url":"https://avatars0.githubusercontent.com/u/21685097?v=4","gravatar_id":"","url":"https://api.github.com/users/oxarbitrage","html_url":"https://github.com/oxarbitrage","followers_url":"https://api.github.com/users/oxarbitrage/followers","following_url":"https://api.github.com/users/oxarbitrage/following{/other_user}","gists_url":"https://api.github.com/users/oxarbitrage/gists{/gist_id}","starred_url":"https://api.github.com/users/oxarbitrage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oxarbitrage/subscriptions","organizations_url":"https://api.github.com/users/oxarbitrage/orgs","repos_url":"https://api.github.com/users/oxarbitrage/repos","events_url":"https://api.github.com/users/oxarbitrage/events{/privacy}","received_events_url":"https://api.github.com/users/oxarbitrage/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/bitshares/bitshares-core/milestones/15","html_url":"https://github.com/bitshares/bitshares-core/milestone/15","labels_url":"https://api.github.com/repos/bitshares/bitshares-core/milestones/15/labels","id":3530618,"node_id":"MDk6TWlsZXN0b25lMzUzMDYxOA==","number":15,"title":"201810 - Feature Release","description":"Next feature release after 201808.","creator":{"login":"abitmore","id":9946777,"node_id":"MDQ6VXNlcjk5NDY3Nzc=","avatar_url":"https://avatars1.githubusercontent.com/u/9946777?v=4","gravatar_id":"","url":"https://api.github.com/users/abitmore","html_url":"https://github.com/abitmore","followers_url":"https://api.github.com/users/abitmore/followers","following_url":"https://api.github.com/users/abitmore/following{/other_user}","gists_url":"https://api.github.com/users/abitmore/gists{/gist_id}","starred_url":"https://api.github.com/users/abitmore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abitmore/subscriptions","organizations_url":"https://api.github.com/users/abitmore/orgs","repos_url":"https://api.github.com/users/abitmore/repos","events_url":"https://api.github.com/users/abitmore/events{/privacy}","received_events_url":"https://api.github.com/users/abitmore/received_events","type":"User","site_admin":false},"open_issues":15,"closed_issues":60,"state":"open","created_at":"2018-07-29T21:19:51Z","updated_at":"2018-10-03T21:43:15Z","due_on":"2018-10-26T07:00:00Z","closed_at":null},"comments":5,"created_at":"2018-08-29T15:28:22Z","updated_at":"2018-10-03T21:43:15Z","closed_at":"2018-10-03T21:43:15Z","author_association":"NONE","body":"**Bug Description**\r\n\r\nValue of `additional_data.fill_data.fill_order` is equal on both ways of a filled order and do not take asset precision into account:\r\n\r\nUSD -> BTS:\r\n\r\n```\r\n      {\r\n        \"_source\": {\r\n          \"operation_history\": {\r\n            \"op\": \"\"\"[4,{\"fee\":{\"amount\":75,\"asset_id\":\"1.3.121\"},\"order_id\":\"1.7.183476663\",\"account_id\":\"1.2.1034686\",\"pays\":{\"amount\":7714442,\"asset_id\":\"1.3.0\"},\"receives\":{\"amount\":75708,\"asset_id\":\"1.3.121\"},\"fill_price\":{\"base\":{\"amount\":10000000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":98138,\"asset_id\":\"1.3.121\"}},\"is_maker\":true}]\"\"\"\r\n          },\r\n          \"operation_type\": 4,\r\n          \"block_data\": {\r\n            \"block_num\": 29969255,\r\n            \"block_time\": \"2018-08-27T04:25:27\",\r\n            \"trx_id\": \"a642253ffd3c2601164086df9004ae06bc85c960\"\r\n          },\r\n          \"additional_data\": {\r\n            \"fill_data\": {\r\n              \"order_id\": \"1.7.183476663\",\r\n              \"account_id\": \"1.2.1034686\",\r\n              \"pays_asset_id\": \"1.3.0\",\r\n              \"pays_amount\": 7714442,\r\n              \"receives_asset_id\": \"1.3.121\",\r\n              \"receives_amount\": 75708,\r\n              \"fill_price\": \"101.89732825205322797\",\r\n              \"is_maker\": true\r\n            }\r\n          }\r\n        }\r\n      },\r\n```\r\n\r\nBTS -> USD:\r\n\r\n```\r\n        \"_source\": {\r\n          \"operation_history\": {\r\n            \"op\": \"\"\"[4,{\"fee\":{\"amount\":0,\"asset_id\":\"1.3.0\"},\"order_id\":\"1.7.183701401\",\"account_id\":\"1.2.162629\",\"pays\":{\"amount\":35721,\"asset_id\":\"1.3.121\"},\"receives\":{\"amount\":3624847,\"asset_id\":\"1.3.0\"},\"fill_price\":{\"base\":{\"amount\":3624847,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":35721,\"asset_id\":\"1.3.121\"}},\"is_maker\":false}]\"\"\"\r\n          },\r\n          \"operation_type\": 4,\r\n          \"block_data\": {\r\n            \"block_num\": 29972527,\r\n            \"block_time\": \"2018-08-27T07:09:30\",\r\n            \"trx_id\": \"d623a127e6fe5ed9f205944dc312c134d288cfa3\"\r\n          },\r\n          \"additional_data\": {\r\n            \"fill_data\": {\r\n              \"order_id\": \"1.7.183701401\",\r\n              \"account_id\": \"1.2.162629\",\r\n              \"pays_asset_id\": \"1.3.121\",\r\n              \"pays_amount\": 35721,\r\n              \"receives_asset_id\": \"1.3.0\",\r\n              \"receives_amount\": 3624847,\r\n              \"fill_price\": \"101.47663839198230562\",\r\n              \"is_maker\": false\r\n            }\r\n          }\r\n        }\r\n      },\r\n```\r\n\r\nThe fill_price is same in both ways of the deals, wheras pay/recieve assets are inverted.\r\n\r\n**Impacts**\r\nDescribe which portion(s) of BitShares Core may be impacted by this bug. Please tick at least one box.\r\n- [ ] API (the application programming interface)\r\n- [ ] Build (the build process or something prior to compiled code)\r\n- [ ] CLI (the command line wallet)\r\n- [ ] Deployment (the deployment process after building such as Docker, Travis, etc.)\r\n- [ ] DEX (the Decentralized EXchange, market engine, etc.)\r\n- [ ] P2P (the peer-to-peer network for transaction/block propagation)\r\n- [ ] Performance (system or user efficiency, etc.)\r\n- [ ] Protocol (the blockchain logic, consensus, validation, etc.)\r\n- [ ] Security (the security of system or user data, etc.)\r\n- [ ] UX (the User Experience)\r\n- [X ] Other (please add below)\r\n\r\nElastic Search database content. \r\nIt is not trivial to compute an average price from filed orders using an Elastic Search query.\r\nStats displayed in Kibana or Open Explorer might be wrong.\r\n\r\n\r\n**Steps To Reproduce**\r\n\r\n* Setup an Elastic Search service\r\n* Run witness node using Elastic Search plugin and `elasticsearch-visitor=true` \r\n* Check filled orders:\r\n```\r\nGET /bitshares-*/data/_search?pretty=true\r\n{\r\n  \"size\": 10,  \r\n  \"query\": {\r\n    \"constant_score\": {\r\n      \"filter\": {\r\n        \"bool\": {\r\n          \"must\": [\r\n            { \"term\": { \"operation_type\": \"4\" } },\r\n            { \"term\": { \"additional_data.fill_data.pays_asset_id\": \"1.3.121\" } },\r\n            { \"term\": { \"additional_data.fill_data.receives_asset_id\": \"1.3.0\" } },\r\n            { \"range\": { \r\n                \"block_data.block_time\": { \r\n                  \"gte\": \"2018-08-27T00:00:00\", \r\n                  \"lte\": \"2018-08-28T00:00:00\"\r\n                } \r\n              } \r\n            }\r\n          ]\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n**Expected Behavior**\r\n\r\n`additional_data.fill_data.fill_order` should be `(recieves_asset_amount/recieves_asset_precision) / (pays_asset_amount / pays_asset_precision)`.\r\n\r\n\r\n## CORE TEAM TASK LIST\r\n- [ ] Evaluate / Prioritize Bug Report\r\n- [ ] Refine User Stories / Requirements\r\n- [ ] Define Test Cases\r\n- [ ] Design / Develop Solution\r\n- [ ] Perform QA/Testing\r\n- [ ] Update Documentation\r\n"},"comment":{"url":"https://api.github.com/repos/bitshares/bitshares-core/issues/comments/426813968","html_url":"https://github.com/bitshares/bitshares-core/issues/1295#issuecomment-426813968","issue_url":"https://api.github.com/repos/bitshares/bitshares-core/issues/1295","id":426813968,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNjgxMzk2OA==","user":{"login":"oxarbitrage","id":21685097,"node_id":"MDQ6VXNlcjIxNjg1MDk3","avatar_url":"https://avatars0.githubusercontent.com/u/21685097?v=4","gravatar_id":"","url":"https://api.github.com/users/oxarbitrage","html_url":"https://github.com/oxarbitrage","followers_url":"https://api.github.com/users/oxarbitrage/followers","following_url":"https://api.github.com/users/oxarbitrage/following{/other_user}","gists_url":"https://api.github.com/users/oxarbitrage/gists{/gist_id}","starred_url":"https://api.github.com/users/oxarbitrage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oxarbitrage/subscriptions","organizations_url":"https://api.github.com/users/oxarbitrage/orgs","repos_url":"https://api.github.com/users/oxarbitrage/repos","events_url":"https://api.github.com/users/oxarbitrage/events{/privacy}","received_events_url":"https://api.github.com/users/oxarbitrage/received_events","type":"User","site_admin":false},"created_at":"2018-10-03T21:43:15Z","updated_at":"2018-10-03T21:43:15Z","author_association":"NONE","body":"closed by https://github.com/bitshares/bitshares-core/pull/1351"}}
{"actor":{"display_login":"oxarbitrage"}}