Created
December 21, 2016 11:17
-
-
Save anonymous/4c2d37bbde3baa86bda4843b6f8f0b6f to your computer and use it in GitHub Desktop.
kite connect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kiteconnect import WebSocket | |
import DB_Method as DBM | |
api_key = "#######################" | |
api_sec = "#######################" | |
public_token = '###########################' | |
user_id = 'DS3102' | |
data = DBM.DataRtrvl() # database for saving and retriving Info | |
kws = WebSocket(api_key, public_token, user_id) | |
instrument = [41729 , 54273 , 60417 , 103425, 112129, 134657, 141569, 215553, 232961, 261889, 325121, 340481,\ | |
341249, 348929, 359937, 377857, 408065, 415745, 424961, 470529, 492033, 511233, 519937, 633601,\ | |
738561, 758529, 779521, 784129, 857857, 877057, 884737, 895745, 897537, 951809, 975873, 1195009,\ | |
1207553, 1214721, 1270529, 1510401, 1723649, 1837825, 1850625, 2170625, 2393089, 2714625, 2730497,\ | |
2747905, 2752769, 2763265, 2815745, 2863105, 2880769, 2939649, 2977281, 3050241, 3076609, 3375873,\ | |
3463169, 3465729, 3637249, 3677697, 3721473, 3771393, 3834113, 3861249, 3906305, 3924993, 3930881,\ | |
4451329, 4454401, 5215745, 6386689, 7458561, 7712001] | |
def on_tick(tick, ws): | |
print len(tick) | |
data.sav(tick) | |
def on_connect(ws): | |
ws.subscribe(instrument) | |
ws.set_mode(ws.MODE_FULL, instrument) | |
kws.on_tick = on_tick | |
kws.on_connect = on_connect | |
print "Started" | |
kws.connect() | |
#next line should not be executed | |
print "Stopped" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment