How to Load Stock Codes with CYBOS Plus CpUtil.CpStockCode
Guide 1
CpUtil.CpStockCode
provides methods related to the stock codes.
NameToCode()
: Takes a stock name as a string and returns the code as a string.CodeToName()
: Takes a code as a string and returns the stock name as a string.
Let’s run the following Python code using Seegene (096530) as an example.
>>> import win32com.client
>>> instCpStockCode = win32com.client.Dispatch("CpUtil.CpStockCode")
>>> instCpStockCode.NameToCode("씨젠")
'A096530'
>>> instCpStockCode.CodeToName("A096530")
'씨젠'
Indeed, we can confirm that the stock name and code of Seegene match well. Note that each numeric code is preceded by a letter such as A (stock), U (sector), or J (ELW).