Skip to content

hodlgap/krx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

krx

CodeQL GitHub release

Get the prices of Korean stocks in KOSPI, KOSDAQ market

Usage

package main

import (
	"time"
	
	"github.com/hodlgap/krx"
)

func main() {
	// KRX only provides data up to the previous business day.
	yesterday := time.Now().AddDate(0, 0, -1)

	// Issuing temporary tokens for download
	code, err := krx.GetDownloadCode(yesterday)
	if err != nil {
		panic(err)
	}

	buf, err := krx.GetStockFile(code)
	if err != nil {
		panic(err)
	}

	// Parse to entity
	stocks, err := krx.ParseStockBuf(buf)
	if err != nil {
		panic(err)
	}
	
	for _, stock := range stocks {
        println(stock.StockName)
    }
}

CSV

http://data.krx.co.kr/contents/MDC/MDI/mdiLoader/index.cmd?menuId=MDC0201020101

About

Get stock prices via Golang

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published