![translation](https://cdn.durumis.com/common/trans.png)
This is an AI translated post.
A record of the development trials and tribulations of Korea Investment & Securities API
- Writing language: Korean
- •
-
Base country: All countries
- •
- Information Technology
Select Language
Summarized by durumis AI
- This article shares the difficulties encountered in developing an automated trading program using Korea Investment & Securities API, particularly explaining the process of solving the Websockets problem for receiving real-time data.
- The difficulties encountered in the development process were mainly due to the developer's lack of skills and experience. However, searching the github repository, we found Soju06's python-kis repository and got a clue to solve the problem.
- There are still difficulties with the trading methodology, but we were able to gain a lot of experience in understanding and implementing the client's trading criteria.
I have almost finished developing the Korea Investment & Securities API. It's becoming a real series, isn't it? I'm feeling self-loathing and sad because of the tough process, even though no one said anything. I guess those who are good at this will create something like this in one go. I envy their intelligence and talent. Still, I remind myself that life is not made up of only good people and comfort myself.
This is the 5th article, but there's nothing special. It's a cynical story about the process of creating an automatic trading program using the Korea Investment & Securities API. Still, I'm really grateful to those who read it. +_+
When you can't solve the problem, try the solutions you've prepared until you solve it. try except
I've written about the difficulties I've encountered while developing the Korea Investment & Securities API. Some of them are not due to Korea Investment & Securities, some of them are right, but if I summarize the difficulties again, they are as follows.
- Opening a Korea Investment & Securities account (ISA account transfer failure case)
- Mock trading not supported
- Websockets - Receiving real-time data
- Trading methodology
I opened an account by visiting a nearby branch. Luckily, there was a branch 40 minutes away, so I was able to open it. If you are not in the metropolitan area...not in a metropolitan city...and you live in a place where the water and air are clean, I really hope that you can open an account non-face-to-face. Anyway, you need to open an account to try developing using the API, so open it according to your situation.
The lack of mock trading isn't really a critical issue. It's just a little uncomfortable. What if I get a margin call when I buy? What if I keep creating real-time investment tokens and my account gets blocked? ... It's a feeling of nervousness. But those who are good at developing wouldn't worry too much about this. It's due to my lack of skill and experience in stock programming. Also, Websockets didn't work as I expected because of my lack of programming skills. It's all my fault. ㅠ_ㅠ
Websockets were the problem. My lack of skills was caused by Websockets!! But it was really hard to get a feel for how to solve it with the existing examples provided. In this situation, I thought there were "several options for the next action."
- Learn Websockets to smash this problem!!
- Find out how others solved this problem!!
The easy way is to search. Of course, I chose option 2. I searched on the Korea Investment & Securities KIS Developer site using several keywords, but I couldn't find a good answer. (Almost all of them were secret questions. What the heck..) Next is ChatGPT's turn. But I don't know what to ask. "I'm using Websockets to receive real-time data while developing the Korea Investment & Securities API. The following is the source code currently being applied. But in this state, I want to add and delete the transaction price, bid price, and transaction information in real time. What should I do?"
I can't do anything without ChatGPT...
It's so good to have sample code... But the sample code seems to have the same result...
As a last resort, I searched the Github repository.
I love github. It's so lucky that there are so many people who practice sharing in the world.
I searched for "koreainvestment" and a lot of repositories came up. The first one is Korea Investment & Securities' official Github, so I passed it. The second one is JoCoding's repository, which you can naturally pass if you've watched the 20-minute YouTube video earlier. The third name is really appealing. Soju06's python-kis!! (I don't know if you like Soju or if your name is Soju, but I'd like to thank you again for your kindness. ❤️) I went into this repository and explored it, and it seemed like work was done on domestic stocks, but it seemed like overseas stocks hadn't been worked on, so I was going to skip it, but I saw a clue to solving the Websockets problem right now. No, no. After testing it with domestic stocks, I realized that the Websockets problem was solved and working. +_+ I decided to take this and make it work for overseas stocks as well. And I tried to see the source, but my Python skills were not enough to understand what Soju06 had done. But I found out that it uses websocket, websocket-client instead of Websockets, and I was able to solve the problem by using only this part. It's great to know deeply, but not knowing deeply doesn't mean you can't create something. I felt that again. (Life is beautiful because of that~ 🎶)
Out of the difficulties mentioned earlier, the trading methodology remains. Trading methodology is still difficult. And if there was an answer, the person who knew the answer would have taken all the wealth in the world. This doesn't mean that we should look at trading methodology pessimistically. We need a buying/selling criteria to automate stock trading. That's what the trading methodology is. There's no right answer, but it's something logical that's needed. What the heck, the words are getting strange. Anyway, it's still difficult to understand the trading methodology. Still, it's good to think about why the person who requested it wants to take this criteria, because it gives me a lot of experience.
I've gone through this kind of trial and error, and I'll continue to go through it, but I hope it helps if you're having similar worries. Or if you know a better way, please help a foolish being with a mind to enlighten him. I welcome any comments, emails, or open chats.
- Email : ssjokelife@naver.com
- Open chat : https://open.kakao.com/o/gCim3mle
In addition, I accept requests to create automated stock trading programs. In order to implement your own trading strategy that you've been thinking about, you need to implement the logic, which is a really difficult process to learn programming. That's why you end up covering it with money. But even if you want to cover it with money, it's difficult to find someone who will create it exactly as you think. I'm not saying I'm that kind of person, but if you feel like I have some potential, feel free to ask. The cost will be determined when we decide to actually develop after discussing the trading methodology thoroughly. One of the good ways to organize your trading strategy in your head is to explain it to someone. That way, you can be more specific. I'll help you. I'll be getting help too. ❤️