kisopenapi-package {kisopenapi} | R Documentation |
kisopenapi: Korea Investment & Securities (KIS) Open Trading API
Description
This package allows users to easily access various financial services using
the trading open API provided by Korea Investment & Securities (KIS).
the KIS open API provides request/reponse information and error messages.
To use this package, you will first need to open a Korea investment &
securities account, and get your app key and app secret from the website
https://apiportal.koreainvestment.com/.
Once you have your app key and app secret, you can save those as environment
variables for the current session using the set_trading_env
functions.
Alternatively, you can set those permanently by adding the following line to
your .Renviron file:
For real trading
KIS_CANO="YOUR ACCOUNT NUMBER" (your account)
KIS_ACNT_PRDT_CD="01" (your account product code, mainly 01
)
KIS_APP_KEY="YOUR APP KEY"
KIS_APP_SECRET="YOUR APP SECRET"
For paper trading
KIS_PAPER_CANO="YOUR PAPER ACCOUNT NUMBER" (your paper account)
KIS_PAPER_ACNT_PRDT_CD="01" (your paper account product code mainly 01
)
KIS_PAPER_APP_KEY="YOUR PAPER APP KEY"
KIS_PAPER_APP_SECRET="YOUR PAPER APP SECRET"
Any functions that require your environemt variables try to retrieve those via
Sys.getenv("KIS_CANO")
Sys.getenv("KIS_ACNT_PRDT_CD")
Sys.getenv("KIS_APP_KEY")
Sys.getenv("KIS_APP_SECRET")
Sys.getenv("KIS_PAPER_CANO")
Sys.getenv("KIS_PAPER_ACNT_PRDT_CD")
Sys.getenv("KIS_PAPER_APP_KEY")
Sys.getenv("KIS_PAPER_APP_SECRET")
unless account number, account product code, app key and app secret are explicitly specified as function arguments. and if you've already registered both trading environment variables(live and paper), you can easily change the environment and use the same functions.
Author(s)
Maintainer: Seokhoon Joo seokhoonj@gmail.com