# -*- coding: utf-8 -*-


from iFinDPy import *
from ctypes import *
from time import sleep


ths_login = THS_iFinDLogin('abm006', '666193')
# ths_login = THS_iFinDLogin('ifind_e001', 'ifinde001')

if ths_login != 0:
    print "login error"
else:
    print "login success"

print THS_QuotesPushing('300033.SZ,600000.SH,600004.SH')

while True:
    sleep(1)



# def OnCallback(puser,ID,sResult,length,errorcode,reserve):
#     print sResult
#     return 0
#
# CALLBACKRESULT=CFUNCTYPE(c_int,c_void_p,c_int32,c_wchar_p,c_int32,c_int32,c_int32)
# pCallbackFunc=CALLBACKRESULT(OnCallback)
#
#
# pCallbackFunc = CMPTHSREALTIMEFUNC(OnCallback)

# THS_AsyHighFrequenceS equence('600865.SH,601328.SH', 'close;open',
#                              'CPS:0,MaxPoints:50000',
#                              '2017-07-13 09:15:00', '2017-07-13 15:15:00',
#                              pCallbackFunc,
#                              c_void_p(0),
#                              byref(c_int(0)))

# print THS_QuotesPushing('600865.SH')

# THS_HighFrequenceSequence('600000.SH,600004.SH','open;high;low;close','CPS:0,MaxPoints:50000,Fill:Previous,Interval:1',
#                              '2017-07-13 09:15:00',
#                              '2017-07-13 15:15:00')


# THS_iFinDLogout()
