logo

CYBOS Plus Installation Tutorial 📂Data Set

CYBOS Plus Installation Tutorial

Environment

  • OS: Windows
  • IDE: VS code

Guide

This tutorial is for installing CYBOS Plus on Windows and checking its connection status with Python. It is assumed that the user is somewhat familiar with Python’s object-oriented nature and dealing with an IDE.


Step 1. Install CYBOS Plus

20210716_105422.png

Let’s download CYBOS Plus from the Daishin Securities Download Center.

20210716_105831.png

In fact, it’s not something you can download separately, as CYBOS Plus is integrated within the CYBOS program, so you have to download CYBOS. Follow the wizard’s instructions for the installation. Once the installation is complete, Visual C++ 2008 Setup will proceed. This step just requires a bit of a wait and isn’t particularly difficult.

20210716_112458.png

If asked whether to reboot, just go ahead and do it.


Step 2. Check CYBOS Plus Connection

The following is a Python code that checks if CYBOS Plus is connected, using the Dispatch() module of win32com.client to bring in instCpCybos, which is the object to use CYBOS. If connected, the IsConnect property will print out 1 at the end. If win32com.client does not exist, install it with pip install pywin32.

import win32com.client
instCpCybos = win32com.client.Dispatch("CpUtil.CpCybos")
print(instCpCybos.IsConnect)

Of course, executing it as is will obviously produce an error like the following. This is because CYBOS Plus was installed but not executed.

>>> instCpCybos = win32com.client.Dispatch("CpUtil.CpCybos")
Traceback (most recent call last):
  File "C:\Users\rmsms\AppData\Local\Programs\Python\Python37\lib\site-packages\win32com\client\dynamic.py", line 81, in _GetGoodDispatch
    IDispatch = pythoncom.connect(IDispatch)
pywintypes.com_error: (-2147221005, '잘못된 클래스 문자열입니다.', None, None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\rmsms\AppData\Local\Programs\Python\Python37\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch
    dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
  File "C:\Users\rmsms\AppData\Local\Programs\Python\Python37\lib\site-packages\win32com\client\dynamic.py", line 98, in _GetGoodDispatchAndUserName
    return (_GetGoodDispatch(IDispatch, clsctx), userName)
  File "C:\Users\rmsms\AppData\Local\Programs\Python\Python37\lib\site-packages\win32com\client\dynamic.py", line 83, in _GetGoodDispatch
    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
pywintypes.com_error: (-2147221005, '잘못된 클래스 문자열입니다.', None, None)

If there are any other errors, the reason is likely one of the following four:

  • There was a typo in the string entered in Dispatch("CpUtil.CpCybos").
  • CYBOS Plus was not executed.
  • The IDE or terminal was not run with administrator rights.
  • Python is not 32-bit.

If any one of the above conditions is not satisfied, there is a high likelihood of an error.


Step 3. Run CYBOS Plus

20210716_114818.png

Run CYBOS and log in by selecting the CYBOS Plus tab as shown in the above screenshot. After a while, a window showing the CYBOS Plus announcements appears.

20210716_120746.png

You can check that the CYBOS Plus Start program is running in the tray.

20210716_120758.png

If you check the connection status again at this point, you’ll still get an error, although it’s different from before.

>>> instCpCybos = win32com.client.Dispatch("CpUtil.CpCybos")
Traceback (most recent call last):
  File "C:\Users\rmsms\AppData\Local\Programs\Python\Python37\lib\site-packages\win32com\client\dynamic.py", line 81, in _GetGoodDispatch
    IDispatch = pythoncom.connect(IDispatch)
pywintypes.com_error: (-2147221021, '작업을 사용할 수 없습니다.', None, None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\rmsms\AppData\Local\Programs\Python\Python37\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch
    dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
  File "C:\Users\rmsms\AppData\Local\Programs\Python\Python37\lib\site-packages\win32com\client\dynamic.py", line 98, in _GetGoodDispatchAndUserName
    return (_GetGoodDispatch(IDispatch, clsctx), userName)
  File "C:\Users\rmsms\AppData\Local\Programs\Python\Python37\lib\site-packages\win32com\client\dynamic.py", line 83, in _GetGoodDispatch
    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
pywintypes.com_error: (-2147221164, '클래스가 등록되지 않았습니다.', None, None)

Step 4. Install Python 32-bit

CYBOS Plus was developed for 32-bit, so no matter what environment you are using, the application calling CYBOS Plus must be 32-bit.

20210716_121639.png

Find and download the 32-bit installer from the Python download page. If you prefer not to use the 64-bit Python you already have, installing Anaconda 32-bit can also be a good choice. Conversely, if you’ve been using conda, trying out pip might be okay.

Version control is not exactly convenient, and for developers who don’t need to use 32-bit besides for CYBOS Plus, installing the opposite version might be much easier. Anyway, here we won’t install Anaconda for simplicity but will manage versions with pip. Going the hardest way is the tutorial’s approach.

Here are the commands used to install Python 3.9.6 32-bit on a computer that was using Python 3.7.2 64-bit and to install the package to use win32com.

C:\Users\rmsms\AppData\Local\Programs\Python\Python39-32\python.exe -m pip install pywin32

Now if you check the connection status, you can see that it doesn’t cause an error but shows 0 because it’s not connected.

Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:04:37) [MSC v.1929 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import win32com.client
>>> instCpCybos = win32com.client.Dispatch("CpUtil.CpCybos")
>>> print(instCpCybos.IsConnect)
0

Step 5. Run IDE or Terminal with Administrator Rights

20210716_125142.png

Run the IDE with administrator rights and check the connection again, and you can confirm that 1 is output as shown below.

Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:04:37) [MSC v.1929 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import win32com.client
>>> instCpCybos = win32com.client.Dispatch("CpUtil.CpCybos")
>>> print(instCpCybos.IsConnect)
1

20210716_125642.png

The connection is established, but to verify if it’s really receiving information, let’s check if the stock code is being fetched by stock name. For instance, for ‘CJEN’, it correctly fetches A096530.

>>> instCpStockCode = win32com.client.Distpatch("CpUtil.CpStockCode")
>>> seegene = instCpStockCode.NameToCode("씨젠"); seegene
'A096530'

Applications of this API can only be used while CYBOS Plus is running.