ls증권 히스토리 구독 넣음
This commit is contained in:
67
sample_python/tr/tr_master.py
Normal file
67
sample_python/tr/tr_master.py
Normal file
@@ -0,0 +1,67 @@
|
||||
|
||||
import os
|
||||
the_path=os.path.dirname(__file__)
|
||||
#XAQueryEvents
|
||||
class Tr_master:
|
||||
master_arr=[]
|
||||
master_dict={}
|
||||
query_state = False
|
||||
def OnReceiveData(self, tr_code):
|
||||
Tr_master.query_state = True
|
||||
block_count=self.GetBlockCount("t8430OutBlock")
|
||||
#print('block_count: ',block_count)
|
||||
|
||||
if block_count is not None:
|
||||
|
||||
|
||||
for i in range(block_count):
|
||||
hname = self.GetFieldData("t8430OutBlock", "hname", i).strip()
|
||||
shcode = self.GetFieldData("t8430OutBlock", "shcode", i).strip()
|
||||
gubun = self.GetFieldData("t8430OutBlock", "gubun", i).strip() #1은 코스피, 2는 코스닥
|
||||
self.master_dict[shcode]={
|
||||
'hname':hname,
|
||||
'shcode':shcode,
|
||||
'gubun':gubun
|
||||
}
|
||||
self.master_dict[hname]={
|
||||
'hname':hname,
|
||||
'shcode':shcode,
|
||||
'gubun':gubun
|
||||
}
|
||||
|
||||
# print('삼전: ',self.master_dict['005930'])
|
||||
#print('삼전2: ',self.master_dict['삼성전자'])
|
||||
|
||||
self.tr_0424.init_get_account(self.balance_window)#잔고
|
||||
self.tr_pending.get_pending(self.balance_window)#미체결
|
||||
|
||||
self.tr_0424.init_sc1()
|
||||
|
||||
# hname = self.GetFieldData("t8430OutBlock", "hname", 0)
|
||||
# shcode = self.GetFieldData("t8430OutBlock", "shcode", 0)
|
||||
# #print('tr_code: ',tr_code)
|
||||
# #print('hname: ',hname)
|
||||
# #print('shcode: ',shcode)
|
||||
|
||||
# param['hname']=hname
|
||||
# param['shcode']=shcode
|
||||
def OnReceiveMessage(self, error, nMessageCode, szMessage):
|
||||
# #print('OnReceiveMessage: ',szMessage)
|
||||
pass
|
||||
|
||||
def single_request(self,tr_0424,balance_window,tr_pending):
|
||||
# self.ResFileName = "C:\\eBEST\\xingAPI\\Res\\t8430.res"
|
||||
self.tr_0424=tr_0424
|
||||
self.tr_pending=tr_pending
|
||||
self.balance_window=balance_window
|
||||
the_path=os.environ.get('ROOT_FILE_PATH')
|
||||
self.ResFileName = the_path+"\\Res\\t8430.res"
|
||||
#print('the_path2: ',the_path+"\\Res\\t8430.res")
|
||||
self.SetFieldData("t8430InBlock", "gubun", 0, 0)
|
||||
err_code = self.Request(False)
|
||||
|
||||
if err_code is not None:
|
||||
|
||||
if err_code < 0:
|
||||
#print("error... {0}".format(err_code))
|
||||
pass
|
||||
Reference in New Issue
Block a user