Skip to content

Instantly share code, notes, and snippets.

@esstory
esstory / Form1101.vb
Last active August 23, 2017 01:37
PLUS API - 현재가 통신 샘플 (VB)
Public Class Form1101
Private _parent As Main
Public WithEvents _stockMst As DSCBO1Lib.StockMst
Public WithEvents _stockCur As DSCBO1Lib.StockCur
Dim _stockTable As DataTable = New DataTable
Private Sub Form1101_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
Me.Unsubscribe(TextBoxCode.Text)
import win32com.client
# 연결 여부 체크
objCpCybos = win32com.client.Dispatch("CpUtil.CpCybos")
bConnect = objCpCybos.IsConnect
if (bConnect == 0):
print("PLUS가 정상적으로 연결되지 않음. ")
exit()
@esstory
esstory / StockOrderBuyEx.py
Created August 31, 2017 01:42
PLUS API EX - 파이썬 매수 주문
import win32com.client
# 연결 여부 체크
objCpCybos = win32com.client.Dispatch("CpUtil.CpCybos")
bConnect = objCpCybos.IsConnect
if (bConnect == 0):
print("PLUS가 정상적으로 연결되지 않음. ")
exit()
@esstory
esstory / StockWeekEx.py
Created August 31, 2017 01:46
PLUS API EX - 파이썬 주식 일자별 데이터 구하는 샘플
import win32com.client
def ReqeustData(obj):
# 데이터 요청
obj.BlockRequest()
# 통신 결과 확인
rqStatus = obj.GetDibStatus()
rqRet = obj.GetDibMsg1()
print("통신상태", rqStatus, rqRet)
@esstory
esstory / StockCurTest.py
Last active August 31, 2017 09:08
PLUS API EX - 파이썬 현재가 실시간 조회
import sys
from PyQt5.QtWidgets import *
import win32com.client
import types
class CpEvent:
instance = None
def OnReceived(self):
time = CpEvent.instance.GetHeaderValue(3) # 시간
@esstory
esstory / StockMst2.py
Created September 1, 2017 00:09
PLUS API EX - 파이썬 현재가 실시간 예제
import sys
from PyQt5.QtWidgets import *
import win32com.client
class CpEvent:
instance = None
def OnReceived(self):
# time = CpEvent.instance.GetHeaderValue(3) # 시간
@esstory
esstory / MultiCurEx.py
Last active September 1, 2017 06:19
PLUS API EX - 파이썬 복수종목 현재가 통신 예제
import sys
from PyQt5.QtWidgets import *
import win32com.client
class CpEvent:
def set_params(self, client):
self.client = client
def OnReceived(self):
@esstory
esstory / MarketeyeEx.py
Created September 4, 2017 00:49
PLUA API EX - 파이썬 마켓아이 & 실시간 조회
import sys
from PyQt5.QtWidgets import *
import win32com.client
# 복수 종목 실시간 조회 샘플 (조회는 없고 실시간만 있음)
class CpEvent:
def set_params(self, client):
self.client = client
def OnReceived(self):
@esstory
esstory / MACDEX.PY
Created September 5, 2017 01:07
PLUS API EX - 파이썬 MACD 지표 실시간 계산
import sys
from PyQt5.QtWidgets import *
import win32com.client
# 요약: MACD 지표 데이터 실시간 구하기
# : 차트 OBJECT 를 통해 차트 데이터를 받은 후
# : 지표 실시간 계산 OBJECT 를 통해 지표 데이터를 계산
class CpEvent:
def set_params(self, client, objCaller):
@esstory
esstory / tr7223.py
Last active March 2, 2020 07:59
PLUS API EX - 파이썬 - #7223 업종별 투자자 매매 현황 조회 샘플
import win32com.client
# 연결 여부 체크
objCpCybos = win32com.client.Dispatch("CpUtil.CpCybos")
bConnect = objCpCybos.IsConnect
if (bConnect == 0):
print("PLUS가 정상적으로 연결되지 않음. ")
exit()