GithubHelp home page GithubHelp logo

walkengineer / kiwoom-condition-trader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from taekhyang/kiwoom-condition-trader

0.0 0.0 0.0 15 KB

키움 API 를 사용하여 주식 자동 매매를 구현한 프로젝트입니다.

Python 100.00%

kiwoom-condition-trader's Introduction

Kiwoom Condition Trader

2021.01 ~ 2021.02

프로젝트 설명

증권사 키움 API 를 사용하여 주식 자동 매매를 구현한 프로젝트입니다.

키움 HTS 조건식에 등록된 조건을 실시간으로 캐치하여 해당 조건에 맞는 종목을 매수한 뒤

유저가 설정해 둔 상한/하한 손익률 초과시 자동으로 매매하는 프로그램 입니다.

Python 으로 구현했으며, 키움 모의투자 HTS 를 이용하여 프로그램을 직접 테스트했습니다.

기술스택

  • Python 3, SQLite

세부내용

  • 조건식을 캐치하면 해당 종목을 매수하는 Thread, 실시간 현재가를 체크하여 상한/하한 손익률 초과 시 매도하는 Thread, 각각의 매수/매도 Thread 에서 받은 요청을 처리하는 Communicate Thread 로 구분
  • 매수/매도 Thread 에서 command queue 에 callback queue 와 data 를 담아 넘기면, Communicate Thread 에서 data 값을 받아 요청을 처리한 후 다시 callback queue 에 값을 담아 리턴하는 로직 구현
  • SQLite 를 사용하여 유저의 매매 기록 관리
  • Python 의 Rotating Filehandler 를 활용한 Debugger 를 구현하여 시간 별 디버깅 관리
  • 키움 API 요청 모듈화 작업

Kiwoom Condition Trader

2021.01 ~ 2021.02

Project Description

This is a project that uses the Kiwoom(Stock brokage firm) API to implement automatic stock trading.

It is a program that catches the conditions registered in Kiwoom HTS conditional formula in real time, buys stocks that meet the conditions, and automatically sells them when the upper/lower profit or loss rate set by the user is exceeded.

The project was implemented using Python 3 and tested the program using Kiwoom Mock Investment HTS.

Tech Stack

  • Python 3, SQLite

Details

  • We implemented multi-threading as follows: Thread to buy the stock when caught conditional, Thread to check the real-time present price and sell when the upper/lower profit or loss ratio is exceeded, and "Communicate Thread" to handle requests received by each buy/sell Thread.
  • If the buy/sell Thread puts callback queue and data in the command queue, the "Communicate Thread" takes the data value, processes the request, and then returns the value in the callback queue.
  • Used SQLite to manage sales history for users.
  • Clear chronological log management with Debugger implemented with Python's Rotating Filehandler.
  • Modularized Kiwoom API requests.

kiwoom-condition-trader's People

Contributors

taekhyang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.