ls증권 히스토리 구독 넣음
This commit is contained in:
82
ls_sample/sample_python/tr/tr_sc2.py
Normal file
82
ls_sample/sample_python/tr/tr_sc2.py
Normal file
@@ -0,0 +1,82 @@
|
||||
|
||||
# from tr.tr_0424 import Tr_0424
|
||||
# tr_0424=Tr_0424()
|
||||
import os
|
||||
|
||||
class Tr_sc2:
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
def OnReceiveRealData(self,code): # event handler
|
||||
"""
|
||||
이베스트 서버에서 ReceiveRealData 이벤트 받으면 실행되는 event handler
|
||||
"""
|
||||
# self.count += 1
|
||||
#print('yeah')
|
||||
#print('자기소개2: ',dir(self))
|
||||
|
||||
|
||||
# stock_code = self.GetFieldData("OutBlock", "Isuno")[3:-3]
|
||||
# stock_name = self.GetFieldData("OutBlock", "Isunm")
|
||||
ord_qty = self.GetFieldData("OutBlock", "ordqty")#주문수량
|
||||
ord_price = self.GetFieldData("OutBlock", "ordprc")#주문가격
|
||||
ord_no = self.GetFieldData("OutBlock", "ordno")#주문번호
|
||||
orgordno = self.GetFieldData("OutBlock", "orgordno")#원주문번호
|
||||
# bnstp = self.GetFieldData("OutBlock", "bnstp")#매매구분 1 매도 2 매수
|
||||
# side=''
|
||||
|
||||
# if bnstp=='1':
|
||||
# side='매도'
|
||||
# else:
|
||||
# side='매수'
|
||||
|
||||
|
||||
|
||||
|
||||
# print('##bnstp: ',bnstp)
|
||||
# print('##stock_code: ',stock_code)
|
||||
# print('##stock_name: ',stock_name)
|
||||
# print('##ord_qty: ',ord_qty)
|
||||
# print('##ord_price: ',ord_price)
|
||||
# print('##ord_no: ',ord_no)
|
||||
# print('##orgordno: ',orgordno)
|
||||
|
||||
# self.process_pending_fix_echo(orgordno,ord_qty,ord_price)
|
||||
|
||||
|
||||
|
||||
|
||||
def initialize_process_balance_change(self,process_balance_change):
|
||||
#print('k3 initialize_process_balance_change @#@#@#@#@#@#@#')
|
||||
self.process_balance_change=process_balance_change
|
||||
|
||||
def start(self):
|
||||
# self.process_pending_fix_echo=process_pending_fix_echo
|
||||
# print('정정 리얼 스타트: ')
|
||||
#print('자기소개: ',dir(self))
|
||||
"""
|
||||
이베스트 서버에 실시간 data 요청함.
|
||||
"""
|
||||
|
||||
|
||||
the_path=os.environ.get('ROOT_FILE_PATH')
|
||||
self.ResFileName = the_path+"\\Res\\SC2.res"
|
||||
|
||||
self.ResFileName = "C:\\eBEST\\xingAPI\\Res\\SC2.res" # RES 파일 등록
|
||||
# self.SetFieldData("InBlock", "shcode", stock_code)
|
||||
self.AdviseRealData() # 실시간데이터 요청
|
||||
# self.AdviseLinkFromHTS() # 실시간데이터 요청
|
||||
#print('접수 리얼 스타트 끝: ')
|
||||
|
||||
def add_item(self, stockcode):
|
||||
# 실시간데이터 요청 종목 추가
|
||||
self.SetFieldData("InBlock", "shcode", stockcode)
|
||||
|
||||
self.AdviseRealData()
|
||||
|
||||
def remove_item(self, stockcode):
|
||||
# stockcode 종목만 실시간데이터 요청 취소
|
||||
self.UnadviseRealDataWithKey(stockcode)
|
||||
|
||||
def end(self):
|
||||
self.UnadviseRealData() # 실시간데이터 요청 모두 취소
|
||||
Reference in New Issue
Block a user