{"action":"created","issue":{"url":"https://api.github.com/repos/sammchardy/python-binance/issues/196","repository_url":"https://api.github.com/repos/sammchardy/python-binance","labels_url":"https://api.github.com/repos/sammchardy/python-binance/issues/196/labels{/name}","comments_url":"https://api.github.com/repos/sammchardy/python-binance/issues/196/comments","events_url":"https://api.github.com/repos/sammchardy/python-binance/issues/196/events","html_url":"https://github.com/sammchardy/python-binance/issues/196","id":299862105,"number":196,"title":"web socket kline socket issue","user":{"login":"bilgecetin","id":10619816,"avatar_url":"https://avatars2.githubusercontent.com/u/10619816?v=4","gravatar_id":"","url":"https://api.github.com/users/bilgecetin","html_url":"https://github.com/bilgecetin","followers_url":"https://api.github.com/users/bilgecetin/followers","following_url":"https://api.github.com/users/bilgecetin/following{/other_user}","gists_url":"https://api.github.com/users/bilgecetin/gists{/gist_id}","starred_url":"https://api.github.com/users/bilgecetin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bilgecetin/subscriptions","organizations_url":"https://api.github.com/users/bilgecetin/orgs","repos_url":"https://api.github.com/users/bilgecetin/repos","events_url":"https://api.github.com/users/bilgecetin/events{/privacy}","received_events_url":"https://api.github.com/users/bilgecetin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-02-23T21:52:55Z","updated_at":"2018-03-03T17:44:46Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\nMy intention is to get the last tick data/kline and feed it to my algorithm. I intended to do that through the websocket with the below code\r\n\r\nbm = BinanceSocketManager(client)\r\nconn_key = bm.start_kline_socket('BTCUSDT', process_message, interval=KLINE_INTERVAL_1MINUTE)\r\nbm.start()\r\n\r\nMy expectation is/was to get one update per minute. However i get continuous updates for the same period (same t/T) with increasing c/h/n/V/Q values. Is there a work around for this? It feels like i am missing something obvious here.\r\n\r\n\r\nbm.start()\r\nmessage type: kline\r\n{'e': 'kline', 'E': 1519422629533, 's': 'BTCUSDT', 'k': {'t': 1519422600000, 'T': 1519422659999, 's': 'BTCUSDT', 'i': '1m', 'f': 21751516, 'L': 21751994, 'o': '9901.04000000', 'c': '9895.81000000', 'h': '9908.57000000', 'l': '9876.00000000', 'v': '64.31203300', 'n': 479, 'x': False, 'q': '635875.32398396', 'V': '28.63972300', 'Q': '283097.49123652', 'B': '0'}}\r\nmessage type: kline\r\n{'e': 'kline', 'E': 1519422632093, 's': 'BTCUSDT', 'k': {'t': 1519422600000, 'T': 1519422659999, 's': 'BTCUSDT', 'i': '1m', 'f': 21751516, 'L': 21751995, 'o': '9901.04000000', 'c': '9895.71000000', 'h': '9908.57000000', 'l': '9876.00000000', 'v': '64.31607500', 'n': 480, 'x': False, 'q': '635915.32244378', 'V': '28.64376500', 'Q': '283137.48969634', 'B': '0'}}\r\nmessage type: kline\r\n{'e': 'kline', 'E': 1519422633333, 's': 'BTCUSDT', 'k': {'t': 1519422600000, 'T': 1519422659999, 's': 'BTCUSDT', 'i': '1m', 'f': 21751516, 'L': 21752001, 'o': '9901.04000000', 'c': '9886.21000000', 'h': '9908.57000000', 'l': '9876.00000000', 'v': '64.59356000', 'n': 486, 'x': False, 'q': '638658.67653625', 'V': '28.65253800', 'Q': '283224.30476017', 'B': '0'}}\r\nmessage type: kline\r\n{'e': 'kline', 'E': 1519422634634, 's': 'BTCUSDT', 'k': {'t': 1519422600000, 'T': 1519422659999, 's': 'BTCUSDT', 'i': '1m', 'f': 21751516, 'L': 21752002, 'o': '9901.04000000', 'c': '9886.10000000', 'h': '9908.57000000', 'l': '9876.00000000', 'v': '64.60560800', 'n': 487, 'x': False, 'q': '638777.78426905', 'V': '28.65253800', 'Q': '283224.30476017', 'B': '0'}}\r\nmessage type: kline\r\n{'e': 'kline', 'E': 1519422636953, 's': 'BTCUSDT', 'k': {'t': 1519422600000, 'T': 1519422659999, 's': 'BTCUSDT', 'i': '1m', 'f': 21751516, 'L': 21752019, 'o': '9901.04000000', 'c': '9888.04000000', 'h': '9908.57000000', 'l': '9876.00000000', 'v': '65.32125200', 'n': 504, 'x': False, 'q': '645853.26091582', 'V': '28.99860800', 'Q': '286646.11360300', 'B': '0'}}\r\nmessage type: kline\r\n{'e': 'kline', 'E': 1519422638976, 's': 'BTCUSDT', 'k': {'t': 1519422600000, 'T': 1519422659999, 's': 'BTCUSDT', 'i': '1m', 'f': 21751516, 'L': 21752044, 'o': '9901.04000000', 'c': '9889.27000000', 'h': '9908.57000000', 'l': '9876.00000000', 'v': '66.41713000', 'n': 529, 'x': False, 'q': '656694.36519283', 'V': '29.80284000', 'Q': '294603.97445759', 'B': '0'}}\r\nmessage type: kline\r\n{'e': 'kline', 'E': 1519422641212, 's': 'BTCUSDT', 'k': {'t': 1519422600000, 'T': 1519422659999, 's': 'BTCUSDT', 'i': '1m', 'f': 21751516, 'L': 21752053, 'o': '9901.04000000', 'c': '9889.32000000', 'h': '9908.57000000', 'l': '9876.00000000', 'v': '66.72798600', 'n': 538, 'x': False, 'q': '659768.97291406', 'V': '29.88193900', 'Q': '295386.67243759', 'B': '0'}}\r\nmessage type: kline\r\n{'e': 'kline', 'E': 1519422643720, 's': 'BTCUSDT', 'k': {'t': 1519422600000, 'T': 1519422659999, 's': 'BTCUSDT', 'i': '1m', 'f': 21751516, 'L': 21752068, 'o': '9901.04000000', 'c': '9890.00000000', 'h': '9908.57000000', 'l': '9876.00000000', 'v': '67.66981900', 'n': 553, 'x': False, 'q': '669083.25447617', 'V': '29.89740500', 'Q': '295539.77887789', 'B': '0'}}\r\n"},"comment":{"url":"https://api.github.com/repos/sammchardy/python-binance/issues/comments/370166029","html_url":"https://github.com/sammchardy/python-binance/issues/196#issuecomment-370166029","issue_url":"https://api.github.com/repos/sammchardy/python-binance/issues/196","id":370166029,"user":{"login":"Chingis-Khan","id":3431318,"avatar_url":"https://avatars2.githubusercontent.com/u/3431318?v=4","gravatar_id":"","url":"https://api.github.com/users/Chingis-Khan","html_url":"https://github.com/Chingis-Khan","followers_url":"https://api.github.com/users/Chingis-Khan/followers","following_url":"https://api.github.com/users/Chingis-Khan/following{/other_user}","gists_url":"https://api.github.com/users/Chingis-Khan/gists{/gist_id}","starred_url":"https://api.github.com/users/Chingis-Khan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Chingis-Khan/subscriptions","organizations_url":"https://api.github.com/users/Chingis-Khan/orgs","repos_url":"https://api.github.com/users/Chingis-Khan/repos","events_url":"https://api.github.com/users/Chingis-Khan/events{/privacy}","received_events_url":"https://api.github.com/users/Chingis-Khan/received_events","type":"User","site_admin":false},"created_at":"2018-03-03T17:44:46Z","updated_at":"2018-03-03T17:44:46Z","author_association":"NONE","body":"build them as you go. The data comes approx every second, but it should be for that time period, updated with new values until the 'candle' is closed.  So for a 1 minute Kline just keep updating your values for the time period above ( 'k': {'t': 1519422600000, 'T': 1519422659999, ) and then when the klines start coming in for the next minute move on to the next, something like this\r\n\r\n```\r\n        k = data['k']\r\n        t_stamp = int(k['t'])\r\n\r\n        if self.ref_frame != t_stamp:\r\n            self.save_frame()           # update data storeage object, list, database etc...\r\n            self.ref_frame = t_stamp    # ref-frame is the current minute at the exchange\r\n```"}}
{"actor":{"display_login":"Chingis-Khan"}}