{"id":37413,"date":"2024-11-01T09:57:22","date_gmt":"2024-11-01T09:57:22","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=37413"},"modified":"2024-11-01T11:50:55","modified_gmt":"2024-11-01T11:50:55","slug":"python-automated-trading-development-kiwoom-securities-api-account-opening-and-module-installation","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/37413\/","title":{"rendered":"Python Automated Trading Development, Kiwoom Securities API, Account Opening and Module Installation"},"content":{"rendered":"<p>The automated trading system is one of the rapidly growing fields in financial technology. Many traders are developing algorithm-based automated trading systems to enhance trading efficiency. This article will explain in detail how to use the Kiwoom Securities API required for automated trading development using Python, from opening an account to module installation.<\/p>\n<h2>1. Opening a Kiwoom Securities Account<\/h2>\n<p>To develop an automated trading system, you first need to open a securities account. Here is how to open an account with Kiwoom Securities.<\/p>\n<h3>1.1. Visit the Kiwoom Securities Website<\/h3>\n<p>Access the official Kiwoom Securities website (<a href=\"https:\/\/www.kiwoom.com\">https:\/\/www.kiwoom.com<\/a>) and click on the &#8216;Open Account&#8217; menu.<\/p>\n<h3>1.2. Open Account Online<\/h3>\n<p>To open an account online, you need to complete identity verification. Prepare your digital certificate and identification (resident registration card, driver&#8217;s license).<\/p>\n<h3>1.3. Input Information and Submit Documents<\/h3>\n<p>Enter the required personal information and select the type of securities account. Then, verify your identification and submit the required documents.<\/p>\n<h3>1.4. Account Opening Completed<\/h3>\n<p>Once all procedures are completed, the account will be opened within about 1 to 2 days. After the account is opened, you will be eligible to use the API for automated trading programs.<\/p>\n<h2>2. Installing Kiwoom Securities OPEN API<\/h2>\n<p>To use Kiwoom Securities&#8217; API, specific software is required. This software can be downloaded from Kiwoom&#8217;s website.<\/p>\n<h3>2.1. Download OPEN API<\/h3>\n<p>Kiwoom Securities OPEN API can be found in the &#8216;Download&#8217; menu. Download several files related to the SDK.<\/p>\n<h3>2.2. Check User Manual<\/h3>\n<p>Kiwoom Securities provides a user manual for using the OPEN API. You can learn about the functionalities and usage of the API through the manual.<\/p>\n<h3>2.3. Environment Setup<\/h3>\n<p>After unzipping the downloaded files in an appropriate location, you need to set the environment variables. If you are a Windows user, add the following to the system variables in &#8216;My Computer&#8217; > &#8216;Properties&#8217; > &#8216;Advanced System Settings&#8217; > &#8216;Environment Variables&#8217;:<\/p>\n<pre><code>PATH : C:\\Kiwoom\\OpenAPI\\<\/code><\/pre>\n<h3>2.4. API Authentication Key Issuance<\/h3>\n<p>To use Kiwoom Securities&#8217; API, an authentication key is required. This key can be obtained by contacting Kiwoom Securities&#8217; customer service.<\/p>\n<h2>3. Installing Python and Required Libraries<\/h2>\n<p>In this section, we will learn how to install Python and related libraries.<\/p>\n<h3>3.1. Install Python<\/h3>\n<p>Python can be installed from the official website (<a href=\"https:\/\/www.python.org\/downloads\/\">https:\/\/www.python.org\/downloads\/<\/a>). Make sure to check the &#8216;Add Python to PATH&#8217; option during the installation process.<\/p>\n<h3>3.2. Install PyQt5 and numpy Libraries<\/h3>\n<p>PyQt5 is needed to build the UI of the automated trading program. Additionally, Numpy will be used for data processing. Use the following command in CMD to install:<\/p>\n<pre><code>pip install PyQt5 numpy<\/code><\/pre>\n<h2>4. Integrating Kiwoom Securities API with Python<\/h2>\n<p>Now, let&#8217;s develop a real trading program using the Kiwoom Securities API.<\/p>\n<h3>4.1. Define API Class<\/h3>\n<p>First, we define a class to call Kiwoom Securities&#8217; OpenAPI.<\/p>\n<pre><code>import sys\nfrom PyQt5.QtWidgets import QApplication\nfrom PyQt5.QAxContainer import QAxWidget\n\nclass Kiwoom:\n    def __init__(self):\n        self.app = QApplication(sys.argv)\n        self.kw_app = QAxWidget('KWOpenAPI.KWOpenAPICtrl.1')\n        self.kw_app.OnEventConnect.connect(self.event_connect)\n\n    def event_connect(self, err_code):\n        if err_code == 0:\n            print(\"Connection successful\")\n        else:\n            print(f\"Connection failed: {err_code}\")\n\n    def login(self):\n        self.kw_app.dynamicCall(\"CommConnect()\")\n\nif __name__ == \"__main__\":\n    kiwoom = Kiwoom()\n    kiwoom.login()\n    sys.exit(kiwoom.app.exec_())<\/code><\/pre>\n<h3>4.2. Add Trading Request Function<\/h3>\n<p>Add a function for trading requests.<\/p>\n<pre><code>def buy(self, code, qty):\n    self.kw_app.dynamicCall(\"SendOrder(QString, QString, QString, int, QString, int, double, QString)\", \"buy\", \"YOUR_ACCOUNT\", code, qty, \"\", \"0\", \"0\", \"0\")<\/code><\/pre>\n<h3>4.3. Run and Test the Program<\/h3>\n<p>Run the entire code to check if the trading connection is functioning properly. The environment setup must be correct, and Kiwoom Securities&#8217; API should work appropriately.<\/p>\n<pre><code>if __name__ == \"__main__\":\n    kiwoom = Kiwoom()\n    kiwoom.login()\n    # Trading Test\n    kiwoom.buy(\"005930\", 1)  # Buy one share of Samsung Electronics\n    sys.exit(kiwoom.app.exec_())<\/code><\/pre>\n<h2>5. Conclusion<\/h2>\n<p>This article explained the basics of opening a Kiwoom Securities account, module installation, and API integration for automated trading development using Python. More testing and stability assurance are needed to execute actual trades. Additionally, risk management and various trading strategies are necessary for actual trading.<\/p>\n<p>In the next article, we will explore the implementation of more advanced automated trading systems, data analysis, and algorithm improvement.<\/p>\n<p>We hope that all readers can build a successful automated trading system!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The automated trading system is one of the rapidly growing fields in financial technology. Many traders are developing algorithm-based automated trading systems to enhance trading efficiency. This article will explain in detail how to use the Kiwoom Securities API required for automated trading development using Python, from opening an account to module installation. 1. Opening &hellip; <a href=\"https:\/\/atmokpo.com\/w\/37413\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;Python Automated Trading Development, Kiwoom Securities API, Account Opening and Module Installation&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[147],"tags":[],"class_list":["post-37413","post","type-post","status-publish","format-standard","hentry","category-python-auto-trading"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python Automated Trading Development, Kiwoom Securities API, Account Opening and Module Installation - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/atmokpo.com\/w\/37413\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Automated Trading Development, Kiwoom Securities API, Account Opening and Module Installation - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"The automated trading system is one of the rapidly growing fields in financial technology. Many traders are developing algorithm-based automated trading systems to enhance trading efficiency. This article will explain in detail how to use the Kiwoom Securities API required for automated trading development using Python, from opening an account to module installation. 1. Opening &hellip; \ub354 \ubcf4\uae30 &quot;Python Automated Trading Development, Kiwoom Securities API, Account Opening and Module Installation&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/37413\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:57:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:50:55+00:00\" \/>\n<meta name=\"author\" content=\"root\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:site\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:label1\" content=\"\uae00\uc4f4\uc774\" \/>\n\t<meta name=\"twitter:data1\" content=\"root\" \/>\n\t<meta name=\"twitter:label2\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data2\" content=\"3\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/37413\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37413\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"Python Automated Trading Development, Kiwoom Securities API, Account Opening and Module Installation\",\"datePublished\":\"2024-11-01T09:57:22+00:00\",\"dateModified\":\"2024-11-01T11:50:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37413\/\"},\"wordCount\":570,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"Python Auto Trading\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/37413\/\",\"url\":\"https:\/\/atmokpo.com\/w\/37413\/\",\"name\":\"Python Automated Trading Development, Kiwoom Securities API, Account Opening and Module Installation - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:57:22+00:00\",\"dateModified\":\"2024-11-01T11:50:55+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37413\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/37413\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/37413\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python Automated Trading Development, Kiwoom Securities API, Account Opening and Module Installation\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/atmokpo.com\/w\/#website\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/atmokpo.com\/w\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"contentUrl\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"width\":400,\"height\":400,\"caption\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\"},\"image\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/bebubo4\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\",\"name\":\"root\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"caption\":\"root\"},\"sameAs\":[\"http:\/\/atmokpo.com\/w\"],\"url\":\"https:\/\/atmokpo.com\/w\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python Automated Trading Development, Kiwoom Securities API, Account Opening and Module Installation - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/atmokpo.com\/w\/37413\/","og_locale":"ko_KR","og_type":"article","og_title":"Python Automated Trading Development, Kiwoom Securities API, Account Opening and Module Installation - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"The automated trading system is one of the rapidly growing fields in financial technology. Many traders are developing algorithm-based automated trading systems to enhance trading efficiency. This article will explain in detail how to use the Kiwoom Securities API required for automated trading development using Python, from opening an account to module installation. 1. Opening &hellip; \ub354 \ubcf4\uae30 \"Python Automated Trading Development, Kiwoom Securities API, Account Opening and Module Installation\"","og_url":"https:\/\/atmokpo.com\/w\/37413\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:57:22+00:00","article_modified_time":"2024-11-01T11:50:55+00:00","author":"root","twitter_card":"summary_large_image","twitter_creator":"@bebubo4","twitter_site":"@bebubo4","twitter_misc":{"\uae00\uc4f4\uc774":"root","\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"3\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/37413\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/37413\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"Python Automated Trading Development, Kiwoom Securities API, Account Opening and Module Installation","datePublished":"2024-11-01T09:57:22+00:00","dateModified":"2024-11-01T11:50:55+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/37413\/"},"wordCount":570,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["Python Auto Trading"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/37413\/","url":"https:\/\/atmokpo.com\/w\/37413\/","name":"Python Automated Trading Development, Kiwoom Securities API, Account Opening and Module Installation - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:57:22+00:00","dateModified":"2024-11-01T11:50:55+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/37413\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/37413\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/37413\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"Python Automated Trading Development, Kiwoom Securities API, Account Opening and Module Installation"}]},{"@type":"WebSite","@id":"https:\/\/atmokpo.com\/w\/#website","url":"https:\/\/atmokpo.com\/w\/","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","description":"","publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/atmokpo.com\/w\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/atmokpo.com\/w\/#organization","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","url":"https:\/\/atmokpo.com\/w\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/","url":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","contentUrl":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","width":400,"height":400,"caption":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8"},"image":{"@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/bebubo4"]},{"@type":"Person","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7","name":"root","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","caption":"root"},"sameAs":["http:\/\/atmokpo.com\/w"],"url":"https:\/\/atmokpo.com\/w\/author\/root\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/37413","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/comments?post=37413"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/37413\/revisions"}],"predecessor-version":[{"id":37414,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/37413\/revisions\/37414"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=37413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=37413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=37413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}