How to Fetch Short Selling Trends with CYBOS Plus
Code
CpSysDib.CpSvr7238
requests and receives the trend of short selling by stock. Here’s a Python example to learn how to fetch short selling data of Seegene Inc. If you’re not familiar with CYBOS API, refer to the following guide first.
>>> import win32com.client
>>> instCpStockCode = win32com.client.Dispatch("CpUtil.CpStockCode")
>>> item = instCpStockCode.NameToCode("씨젠")
>>> short = win32com.client.Dispatch("CpSysDib.CpSvr7238")
>>> short.SetInputValue(0, item)
>>> short.BlockRequest()
0
>>> for i in range(10):
... print(short.GetDataValue(5,i))
...
40064
60105
45830
40311
39264
115228
77237
85756
130853
61241
Interestingly, CpSvr7238
does not require many settings; it only needs the stock code. The data types returned by GetDataValue()
include
- 1 - Closing Price
- 2 - Compared to Previous Day
- 4 - Trading Volume
However, if we focus only on the parts related to short selling, then there are only the following three:
- 5 - Short Selling Volume
- 6 - Short Selling Ratio
- 7 - Short Selling Transaction Amount
In the example code, the short selling volume (5) was returned. It successfully fetched data as of July 29, 2021.