translation

This is an AI translated post.

(로또 사는 아빠) 살림 하는 엄마

Korea Investment & Securities API Development Reference

Select Language

  • English
  • 汉语
  • Español
  • Bahasa Indonesia
  • Português
  • Русский
  • 日本語
  • 한국어
  • Deutsch
  • Français
  • Italiano
  • Türkçe
  • Tiếng Việt
  • ไทย
  • Polski
  • Nederlands
  • हिन्दी
  • Magyar

Summarized by durumis AI

  • This document summarizes the process of collecting information needed to develop the Korea Investment & Securities API.
  • Information was obtained through various materials such as the official website, KIS Developer Center, github, and Wikidocs, and the github repository was particularly helpful.
  • I had difficulties in handling real-time data, but I was able to solve the problem by referring to the source code shared by other developers on github.

Previously, we explored why we are trying to create an automated trading program using the Korea Investment & Securities API and what benefits it offers.

This time, I would like to share the process of collecting the information required for developing the Korea Investment & Securities API. There are already many experienced users who have shared the Korea Investment & Securities API, making it easy to find information. However, I would like to briefly comment on what I was able to learn and hope this information is helpful to you. (It's best to start with the github repository!!)


Official Website

Korea Investment & Securities Official Website

Basic information can be obtained through the official website. Through the Korea Investment & Securities official website, you can perform tasks such as ID and account settings, mock trading applications, and overseas trading applications. Also, the official website provides easy links to sites for development.

Among the menus of Korea Investment & Securities, development-related contents are in the Trading menu.



KIS Developer Developer Center

The KIS Developer site is a site that you need to keep an eye on while developing the API. You can check the detailed contents of the API document.

This is the API for issuing the most basic access token.


This is a detailed description of the request and response values ​​of the API. Refer to these values ​​to call and receive responses for processing.



github - koreainvestment/open-trading-api

This is the Open Trading API github repository. The README.md file provides a friendly step-by-step guide. Therefore, as mentioned above, it would be good to start with github.

This is a github repository.



Wikidocs

Finally, here is a Wikidocs that you can refer to when developing python. Since the author is Korea Investment & Securities, most of the content is reliable. The reason I say "most" is that there is no additional content added over time, and personally, I got stuck in the real-time data section while following it and couldn't find a solution.

The development guide is well documented on Wikidocs.



Additional References

If you refer to the contents up to this point and make it quickly, it would be great, but I don't have the skills to do that, so I had a lot of difficulties. So, I searched for many things and will list the additional references that I received help from. Since this is what I found, you will be able to find it easily as well.

Jocoding's YouTube video (23:41 seconds)

Through this video, I was able to understand the advantages of the Korea Investment & Securities API from a user perspective. And as expected, it was easier to understand because the working source code was explained in the video. If you have a general understanding of what's available through the official website, I recommend watching Jocoding's video (23:41 seconds) quickly.


Websockets

As mentioned briefly earlier, I got stuck in the real-time data handling part, but Wikidocs used python's websockets. However, I didn't understand what websocket was. In such cases, you need to ask. +_+


ChatGPT Help

It seems like it would be a big deal if ChatGPT disappeared.


It seems like a method for communication and once connected, you can receive data continuously. After looking at this, my understanding is that REST API is a one-time request and one-time response, while Websocket registers a request once and then receives responses continuously related to it. To create an automated trading program, both of these need to be implemented well and combined.


However, I got stuck with the example in Wikidocs. It was good that I was able to request using websocket, but then it immediately became while True: and stayed in that state. There must be a way, but for someone like me who's a beginner, it's not easy to grasp how to solve it since I'm not familiar with the concept. So, I searched github to see if there was any source code implemented differently.


Github Repository

  • python-kis - Soju06/python-kis: 📈 파이썬 한국투자증권 REST 기반 Trading API 라이브러리 (github.com)
  • pykis - pjueon/pykis: 한국투자증권 신규 Open Trade API 를 쉽게 사용하기 위한 python 패키지 (github.com)
  • mojito - sharebook-kr/mojito: python wrapper for the KIS (github.com)

I realized once again that there are so many experienced users. I checked three repositories, but the one I used this time was the first one, python-kis. I took the logic and referred to the websocket part. As a result, I used the websocket and websocket-client libraries, not the websockets library. I would like to take this opportunity to thank Soju06 and all the others who share great source code on github.

Now I can develop with reference to this information. I did have some trial and error, but I will separately organize and share information about it. Next, I would like to list what I have thought about regarding the "structure of automated stock trading", which might be a bit fundamental. Based on this, I hope to reduce trial and error in the future and easily reuse the parts that have already been developed.

김진혁
(로또 사는 아빠) 살림 하는 엄마
아빠는 로또를 사면서 대박을 기원합니다. 엄마가 살림 하면서 얻은 정보를 공유합니다.
김진혁
A record of the development trials and tribulations of Korea Investment & Securities API This blog post is for developers who want to create an automated trading program using Korea Investment & Securities API. It introduces the difficulties encountered in the development process, such as account opening, unsupported mock trading, and Websock

April 23, 2024

Building an Automated Trading Program Using Korea Investment & Securities API Korea Investment & Securities API is the only one in Korea that supports overseas stock investment, and it is possible to develop in various environments such as Windows, Mac, and Linux without installing a program through REST API and Websocket methods.

April 22, 2024

Difficulties Encountered While Developing the Korea Investment & Securities API This blog post delves into the challenges and solutions encountered during the development process of the Korea Investment & Securities API. It shares a developer's experiences and tips, covering topics like account opening, ISA account transfer, unsuppor

April 23, 2024

Where can I learn coding? : Collection of web coding online courses This article introduces various free and paid online courses for coding beginners. From free lectures such as Life Coding, Khan Academy, and EBS to paid services such as Code States, Inprun, and Fast Campus, systematic learning is possible. It covers a wi
길리
길리
길리
길리

March 29, 2024

[Non-major, Survive as a Developer] 16. New Developer Portfolio Writing Tips New developers (especially non-majors) need to clearly explain not only the technology but also the developed services or functions when writing a portfolio. For example, if the project is a "job seeker community", you need to include specific job descrip
투잡뛰는 개발 노동자
투잡뛰는 개발 노동자
투잡뛰는 개발 노동자
투잡뛰는 개발 노동자

April 3, 2024

[Book Review] Capitalism: How to Use Economic News for Adults This book helps even beginners understand economic news easily. It provides detailed explanations of key terms in articles and interprets their significance. Concepts related to housing loans, such as LTV, DTI, and DSR, are also well organized with specif
길리
길리
길리
길리
길리

April 16, 2024

[Non-Major, Developer Survival] 17. New Developer Portfolio, How Far? A new developer's portfolio should focus on development skills. It is more effective to complete basic CRUD functions and build external API integration experience than to implement Infra. You can use Naver Login, Naver Map API, Public Data Portal API, et
투잡뛰는 개발 노동자
투잡뛰는 개발 노동자
투잡뛰는 개발 노동자
투잡뛰는 개발 노동자

April 3, 2024

Easy and safe US stocks US stocks offer safe and steady growth, and are an honest market that operates according to market principles without the intervention of big players. By purchasing good US stocks at a low price and holding them for life, you can generate stable returns t
eskwon
eskwon
eskwon
eskwon
eskwon

February 7, 2024

ETF Meaning, Types, Advantages, Investment Methods ETF (Exchange Traded Fund) is an investment product that combines the advantages of stocks and funds, with low management fees and high liquidity. There are various types of ETFs, including domestic stocks, overseas stocks, bonds, and commodities, and you
세상 모든 정보
세상 모든 정보
세상 모든 정보
세상 모든 정보

April 4, 2024