KIS Developers menu

API 문서 HOME API 문서 해외선물옵션시세


해외선물옵션시세

해외선물종목상세 [v1_해외선물-008]

REST

해외선물종목상세 [v1_해외선물-008]

기본정보

  • Method
    GET
  • 실전 Domain
    https://openapi.koreainvestment.com:9443
  • 모의 Domain
    https://openapivts.koreainvestment.com:29443
  • URL
    /uapi/overseas-futureoption/v1/quotations/stock-detail
  • Format
     
  • Content-Type
     

개요

(중요) 해외선물옵션시세 출력값을 해석하실 때 ffcode.mst(해외선물종목마스터 파일)에 있는 sCalcDesz(계산 소수점) 값을 활용하셔야 정확한 값을 받아오실 수 있습니다.

- ffcode.mst(해외선물종목마스터 파일) 다운로드 방법 2가지
1) 한국투자증권 Github의 파이썬 샘플코드를 사용하여 mst 파일 다운로드 및 excel 파일로 정제
https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/overseas_future_code.py

2) 혹은 포럼 - FAQ - 종목정보 다운로드 - 해외선물옵션 클릭하셔서 ffcode.mst(해외선물종목마스터 파일)을 다운로드 후
Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외선물옵션정보.h)를 참고하여 해석

- 소수점 계산 시, ffcode.mst(해외선물종목마스터 파일)의 sCalcDesz(계산 소수점) 값 참고
EX) ffcode.mst 파일의 sCalcDesz(계산 소수점) 값
품목코드 6A 계산소수점 -4 → 시세 6882.5 수신 시 0.68825 로 해석
품목코드 GC 계산소수점 -1 → 시세 19225 수신 시 1922.5 로 해석


[참고자료]
※ 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다.
https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info

LAYOUT

Request

Header

Element 한글명 Type Required Length Description
content-type 컨텐츠타입 String Y 40 application/json; charset=utf-8
authorization 접근토큰 String Y 40 OAuth 토큰이 필요한 API 경우 발급한 Access token
일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)
법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)

※ 토큰 지정시 토큰 타입("Bearer") 지정 필요. 즉, 발급받은 접근토큰 앞에 앞에 "Bearer" 붙여서 호출
EX) "Bearer eyJ..........8GA"
appkey 앱키 String Y 36 한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)
appsecret 앱시크릿키 String Y 180 한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)
personalseckey 고객식별키 String N 180 [법인 필수] 제휴사 회원 관리를 위한 고객식별키
tr_id 거래ID String Y 13 HHDFC55010100
tr_cont 연속 거래 여부 String N 1 공백 : 초기 조회
N : 다음 데이터 조회 (output header의 tr_cont가 M일 경우)
custtype 고객 타입 String Y 1 B : 법인 / P : 개인
seq_no 일련번호 String N 2 법인 : "001" / default 개인: ""
mac_address 맥주소 String N 12 법인고객 혹은 개인고객의 Mac address 값
phone_number 핸드폰번호 String N 12 [법인 필수] 제휴사APP을 사용하는 경우 사용자(회원) 핸드폰번호
ex) 01011112222 (하이픈 등 구분값 제거)
ip_addr 접속 단말 공인 IP String N 12 [법인 필수] 사용자(회원)의 IP Address
hashkey 해쉬키 String N 256 [POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값
* API문서 > hashkey 참조
gt_uid Global UID String N 32 [법인 필수] 거래고유번호로 사용하므로 거래별로 UNIQUE해야 함

Query Parameter

Element 한글명 Type Required Length Description
SRS_CD 종목코드 String Y 32 종목코드

Response

Header

Element 한글명 Type Required Length Description
content-type 컨텐츠타입 String Y 40 application/json; charset=utf-8
tr_id 거래ID String Y 13 요청한 tr_id
tr_cont 연속 거래 여부 String N 1 공백 : 초기 조회
N : 다음 데이터 조회 (output header의 tr_cont가 M일 경우)
gt_uid Global UID String N 32 [법인 필수] 거래고유번호로 사용하므로 거래별로 UNIQUE해야 함

Body

Element 한글명 Type Required Length Description
rt_cd 성공 실패 여부 String Y 1
msg_cd 응답코드 String Y 8
msg1 응답메세지 String Y 80
output 응답상세1 Object N
-exch_cd 거래소코드 String N 10 거래소코드
-tick_sz 틱사이즈 String N 19 틱사이즈
-disp_digit 가격표시진법 String N 10 가격표시진법
-trst_mgn 증거금 String N 19 증거금
-sttl_date 정산일 String N 8 정산일
-prev_price 전일종가 String N 15 전일종가
※ ffcode.mst(해외선물종목마스터 파일)의 sCalcDesz(계산 소수점) 값 참고
-crc_cd 거래통화 String N 10 거래통화
-clas_cd 품목종류 String N 3 품목종류
-tick_val 틱가치 String N 19 틱가치
-mrkt_open_date 장개시일자 String N 8 장개시일자
-mrkt_open_time 장개시시각 String N 6 장개시시각
-mrkt_close_date 장마감일자 String N 8 장마감일자
-mrkt_close_time 장마감시각 String N 6 장마감시각
-trd_fr_date 상장일 String N 8 상장일
-expr_date 만기일 String N 8 만기일
-trd_to_date 최종거래일 String N 8 최종거래일
-remn_cnt 잔존일수 String N 4 잔존일수
-stat_tp 매매여부 String N 1 매매여부
-ctrt_size 계약크기 String N 19 계약크기
-stl_tp 최종결제구분 String N 20 최종결제구분
-frst_noti_date 최초식별일 String N 8 최초식별일
-sprd_srs_cd1 String N 32
-sprd_srs_cd2 String N 32

Example

Request

 {
     "SRS_CD": "6AU22"
 }

Response

{
    "output1": {
        "exch_cd": "CME",
        "clas_cd": "001",
        "crc_cd": "USD",
        "prev_price": "         6722.0",
        "sttl_date": "20220919",
        "trst_mgn": "               2200",
        "disp_digit": "        10",
        "tick_sz": "            0.00005",
        "tick_val": "                  5",
        "mrkt_open_date": "20220919",
        "mrkt_open_time": "070000",
        "mrkt_close_date": "20220920",
        "mrkt_close_time": "060000",
        "trd_fr_date": "20170906",
        "expr_date": "20220919",
        "trd_to_date": "20220919",
        "remn_cnt": "   0",
        "stat_tp": "2",
        "ctrt_size": "             100000",
        "stl_tp": "실물인수도",
        "frst_noti_date": "20220919",
        "sprd_srs_cd1": "",
        "sprd_srs_cd2": ""
    },
    "rt_cd": "0",
    "msg_cd": "MCA00000",
    "msg1": "정상처리 되었습니다."
}

해외선물종목현재가 [v1_해외선물-009]

REST

해외선물종목현재가 [v1_해외선물-009]

기본정보

  • Method
    GET
  • 실전 Domain
    https://openapi.koreainvestment.com:9443
  • 모의 Domain
    https://openapivts.koreainvestment.com:29443
  • URL
    /uapi/overseas-futureoption/v1/quotations/inquire-price
  • Format
     
  • Content-Type
     

개요

(중요) 해외선물옵션시세 출력값을 해석하실 때 ffcode.mst(해외선물종목마스터 파일)에 있는 sCalcDesz(계산 소수점) 값을 활용하셔야 정확한 값을 받아오실 수 있습니다.

- ffcode.mst(해외선물종목마스터 파일) 다운로드 방법 2가지
1) 한국투자증권 Github의 파이썬 샘플코드를 사용하여 mst 파일 다운로드 및 excel 파일로 정제
https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/overseas_future_code.py

2) 혹은 포럼 - FAQ - 종목정보 다운로드 - 해외선물옵션 클릭하셔서 ffcode.mst(해외선물종목마스터 파일)을 다운로드 후
Github의 헤더정보(https://github.com/koreainvestment/open-trading-api/blob/main/stocks_info/해외선물옵션정보.h)를 참고하여 해석

- 소수점 계산 시, ffcode.mst(해외선물종목마스터 파일)의 sCalcDesz(계산 소수점) 값 참고
EX) ffcode.mst 파일의 sCalcDesz(계산 소수점) 값
품목코드 6A 계산소수점 -4 → 시세 6882.5 수신 시 0.68825 로 해석
품목코드 GC 계산소수점 -1 → 시세 19225 수신 시 1922.5 로 해석


[참고자료]
※ 종목코드 마스터파일 파이썬 정제코드는 한국투자증권 Github 참고 부탁드립니다.
https://github.com/koreainvestment/open-trading-api/tree/main/stocks_info

LAYOUT

Request

Header

Element 한글명 Type Required Length Description
content-type 컨텐츠타입 String Y 40 application/json; charset=utf-8
authorization 접근토큰 String Y 40 OAuth 토큰이 필요한 API 경우 발급한 Access token
일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)
법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)

※ 토큰 지정시 토큰 타입("Bearer") 지정 필요. 즉, 발급받은 접근토큰 앞에 앞에 "Bearer" 붙여서 호출
EX) "Bearer eyJ..........8GA"
appkey 앱키 String Y 36 한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)
appsecret 앱시크릿키 String Y 180 한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)
personalseckey 고객식별키 String N 180 [법인 필수] 제휴사 회원 관리를 위한 고객식별키
tr_id 거래ID String Y 13 HHDFC55010000
tr_cont 연속 거래 여부 String N 1 공백 : 초기 조회
N : 다음 데이터 조회 (output header의 tr_cont가 M일 경우)
custtype 고객 타입 String Y 1 B : 법인 / P : 개인
seq_no 일련번호 String N 2 법인 : "001" / default 개인: ""
mac_address 맥주소 String N 12 법인고객 혹은 개인고객의 Mac address 값
phone_number 핸드폰번호 String N 12 [법인 필수] 제휴사APP을 사용하는 경우 사용자(회원) 핸드폰번호
ex) 01011112222 (하이픈 등 구분값 제거)
ip_addr 접속 단말 공인 IP String N 12 [법인 필수] 사용자(회원)의 IP Address
hashkey 해쉬키 String N 256 [POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값
* API문서 > hashkey 참조
gt_uid Global UID String N 32 [법인 필수] 거래고유번호로 사용하므로 거래별로 UNIQUE해야 함

Query Parameter

Element 한글명 Type Required Length Description
SRS_CD 종목코드 String Y 32 종목코드

Response

Header

Element 한글명 Type Required Length Description
content-type 컨텐츠타입 String Y 40 application/json; charset=utf-8
tr_id 거래ID String Y 13 요청한 tr_id
tr_cont 연속 거래 여부 String N 1 공백 : 초기 조회
N : 다음 데이터 조회 (output header의 tr_cont가 M일 경우)
gt_uid Global UID String N 32 [법인 필수] 거래고유번호로 사용하므로 거래별로 UNIQUE해야 함

Body

Element 한글명 Type Required Length Description
rt_cd 성공 실패 여부 String Y 1
msg_cd 응답코드 String Y 8
msg1 응답메세지 String Y 80
output 응답상세1 Object N
-proc_date 최종처리일자 String N 8 최종처리일자
-high_price 고가 String N 15 고가
※ ffcode.mst(해외선물종목마스터 파일)의 sCalcDesz(계산 소수점) 값 참고
-proc_time 최종처리시각 String N 6 최종처리시각
-open_price 시가 String N 15 시가
※ ffcode.mst(해외선물종목마스터 파일)의 sCalcDesz(계산 소수점) 값 참고
-trst_mgn 증거금 String N 19 증거금
-low_price 저가 String N 15 저가
※ ffcode.mst(해외선물종목마스터 파일)의 sCalcDesz(계산 소수점) 값 참고
-last_price 현재가 String N 15 현재가
※ ffcode.mst(해외선물종목마스터 파일)의 sCalcDesz(계산 소수점) 값 참고
-vol 누적거래수량 String N 10 누적거래수량
-prev_diff_flag 전일대비구분 String N 1 전일대비구분
'1':상한 '2':상승 '3':보합 '4':하한 '5':하락
-prev_diff_price 전일대비가격 String N 15 전일대비가격
-prev_diff_rate 전일대비율 String N 10 전일대비율
-bid_qntt 매수1수량 String N 10 매수1수량
-bid_price 매수1호가 String N 15 매수1호가
※ ffcode.mst(해외선물종목마스터 파일)의 sCalcDesz(계산 소수점) 값 참고
-ask_qntt 매도1수량 String N 10 매도1수량
-ask_price 매도1호가 String N 15 매도1호가
※ ffcode.mst(해외선물종목마스터 파일)의 sCalcDesz(계산 소수점) 값 참고
-prev_price 전일종가 String N 15 전일종가
※ ffcode.mst(해외선물종목마스터 파일)의 sCalcDesz(계산 소수점) 값 참고
-exch_cd 거래소코드 String N 10 거래소코드
-crc_cd 거래통화 String N 10 거래통화
-trd_fr_date 상장일 String N 8 상장일
-expr_date 만기일 String N 8 만기일
-trd_to_date 최종거래일 String N 8 최종거래일
-remn_cnt 잔존일수 String N 4 잔존일수
-last_qntt 체결량 String N 10 체결량
-tot_ask_qntt 총매도잔량 String N 10 총매도잔량
-tot_bid_qntt 총매수잔량 String N 10 총매수잔량
-tick_size 틱사이즈 String N 19 틱사이즈
-open_date 장개시일자 String N 8 장개시일자
-open_time 장개시시각 String N 6 장개시시각
-close_date 장종료일자 String N 8 장종료일자
-close_time 장종료시각 String N 6 장종료시각
-sbsnsdate 영업일자 String N 8 영업일자

Example

Request

 {
     "SRS_CD": "6AU22"
 }

Response

{
    "output1": {
        "proc_date": "20220919",
        "proc_time": "090748",
        "open_price": "         6712.5",
        "high_price": "         6730.5",
        "low_price": "         6712.0",
        "last_price": "         6730.5",
        "vol": "194",
        "prev_diff_flag": "2",
        "prev_diff_price": "            8.5",
        "prev_diff_rate": "      0.13",
        "bid_qntt": "         6",
        "bid_price": "         6729.5",
        "ask_qntt": "         6",
        "ask_price": "         6731.0",
        "prev_price": "         6722.0",
        "trst_mgn": "               2200",
        "exch_cd": "CME",
        "crc_cd": "USD",
        "trd_fr_date": "20170906",
        "expr_date": "20220919",
        "trd_to_date": "20220919",
        "remn_cnt": "   0",
        "last_qntt": "2",
        "tot_ask_qntt": "        60",
        "tot_bid_qntt": "        36",
        "tick_size": "            0.00005",
        "open_date": "20220919",
        "open_time": "070000",
        "close_date": "20220920",
        "close_time": "060000",
        "sbsnsdate": "20220919"
    },
    "rt_cd": "0",
    "msg_cd": "MCA00000",
    "msg1": "정상처리 되었습니다."
}

해외선물 분봉조회[해외선물-016]

REST

해외선물 분봉조회[해외선물-016]

기본정보

  • Method
    GET
  • 실전 Domain
    https://openapi.koreainvestment.com:9443
  • 모의 Domain
    모의투자 미지원
  • URL
    /uapi/overseas-futureoption/v1/quotations/inquire-time-futurechartprice
  • Format
     
  • Content-Type
     

개요

해외선물분봉조회 API입니다. 반드시 아래 호출방법을 확인하시고 호출 사용하시기 바랍니다.

※ 해외선물분봉조회 조회 방법
params
. START_DATE_TIME: 공란 입력 ("")
. CLOSE_DATE_TIME: 조회일자 입력 ("20231214")
. QRY_CNT: 120 입력 시, 가장 최근 분봉 120건 조회,
240 입력 시, 240 이전 분봉 ~ 120 이전 분봉 조회
360 입력 시, 360 이전 분봉 ~ 240 이전 분봉 조회

* 따라서 분봉데이터를 기간별로 수집하고자 하실 경우 CLOSE_DATE_TIME, QRY_CNT 값을 수정하시면서 호출하시면 됩니다.

* 파이썬 샘플코드 Github 참고: https://github.com/koreainvestment/open-trading-api/blob/main/rest/get_ovsfut_chart_price.py
(해외선물 상품의 특정 기간동안의 분봉을 받아서 엑셀로 저장하는 파이썬 샘플코드)

LAYOUT

Request

Header

Element 한글명 Type Required Length Description
content-type 컨텐츠타입 String Y 40 application/json; charset=utf-8
authorization 접근토큰 String Y 40 OAuth 토큰이 필요한 API 경우 발급한 Access token
일반고객(Access token 유효기간 1일, OAuth 2.0의 Client Credentials Grant 절차를 준용)
법인(Access token 유효기간 3개월, Refresh token 유효기간 1년, OAuth 2.0의 Authorization Code Grant 절차를 준용)
appkey 앱키 String Y 36 한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)
appsecret 앱시크릿키 String Y 180 한국투자증권 홈페이지에서 발급받은 appkey (절대 노출되지 않도록 주의해주세요.)
personalseckey 고객식별키 String N 180 [법인 필수] 제휴사 회원 관리를 위한 고객식별키
tr_id 거래ID String Y 13 HHDFC55020400
tr_cont 연속 거래 여부 String N 1 공백 : 초기 조회
N : 다음 데이터 조회 (output header의 tr_cont가 M일 경우)
custtype 고객 타입 String Y 1 B : 법인
P : 개인
seq_no 일련번호 String N 2 [법인 필수] 001
mac_address 맥주소 String N 12 법인고객 혹은 개인고객의 Mac address 값
phone_number 핸드폰번호 String N 12 [법인 필수] 제휴사APP을 사용하는 경우 사용자(회원) 핸드폰번호
ex) 01011112222 (하이픈 등 구분값 제거)
ip_addr 접속 단말 공인 IP String N 12 [법인 필수] 사용자(회원)의 IP Address
hashkey 해쉬키 String N 256 [POST API 대상] Client가 요청하는 Request Body를 hashkey api로 생성한 Hash값
* API문서 > hashkey 참조
gt_uid Global UID String N 32 [법인 필수] 거래고유번호로 사용하므로 거래별로 UNIQUE해야 함

Query Parameter

Element 한글명 Type Required Length Description
SRS_CD 종목코드 String Y 32 (ex. 6AZ23)
EXCH_CD 거래소코드 String Y 10 (ex. CME)
START_DATE_TIME 조회시작일시 String Y 12 사용하지 않는 인자값
""(공백) 입력
CLOSE_DATE_TIME 조회종료일시 String Y 12 조회일자 입력(ex. 20231214)
QRY_TP 조회구분 String Y 1 ""(공백) 입력
QRY_CNT 요청개수 String Y 4 호출건당 조회 갯수(1회 호출당 120건까지 호출 가능)
QRY_GAP 묶음개수 String Y 3 1: 1분봉, 5: 5분봉 ...
INDEX_KEY 이전조회KEY String Y 30 ""(공백) 입력

Response

Header

Element 한글명 Type Required Length Description
content-type 컨텐츠타입 String Y 40 application/json; charset=utf-8
tr_id 거래ID String Y 13 요청한 tr_id
tr_cont 연속 거래 여부 String N 1 공백 : 초기 조회
N : 다음 데이터 조회 (output header의 tr_cont가 M일 경우)
gt_uid Global UID String N 32 [법인 필수] 거래고유번호로 사용하므로 거래별로 UNIQUE해야 함

Body

Element 한글명 Type Required Length Description
rt_cd 성공 실패 여부 String Y 1
msg_cd 응답코드 String Y 8
msg1 응답메세지 String Y 80
Output1 응답상세 Object Y array
-data_date 일자 String Y 8
-data_time 시각 String Y 6
-high_price 고가 String Y 15 ffcode.mst(해외선물종목마스터 파일)의 sCalcDesz(계산 소수점) 값 참고
-open_price 시가 String Y 15 ffcode.mst(해외선물종목마스터 파일)의 sCalcDesz(계산 소수점) 값 참고
-low_price 저가 String Y 15 ffcode.mst(해외선물종목마스터 파일)의 sCalcDesz(계산 소수점) 값 참고
-last_price 체결가격 String Y 15 ffcode.mst(해외선물종목마스터 파일)의 sCalcDesz(계산 소수점) 값 참고
-last_qntt 체결수량 String Y 10
-vol 누적거래수량 String Y 10
-prev_diff_flag 전일대비구분 String Y 1
-prev_diff_price 전일대비가격 String Y 15
-prev_diff_rate 전일대비율 String Y 10
Output2 응답상세2 Object Array Y
-ret_cnt 자료개수 String Y 4
-last_n_cnt N틱최종개수 String Y 4
-index_key 이전조회KEY String Y 30

Example

Request

{
"SRS_CD": "6AZ23",
"EXCH_CD": "CME",
"START_DATE_TIME": "",
"CLOSE_DATE_TIME": "20231214",
"QRY_TP": "",
"QRY_CNT": "100",
"QRY_GAP": "1",
"INDEX_KEY": ""
}

Response

{
    "output1": [
        {
            "data_date": "20231214",
            "data_time": "093300",
            "open_price": "           6687",
            "high_price": "         6688.5",
            "low_price": "         6686.5",
            "last_price": "         6687.5",
            "last_qntt": "       142",
            "vol": "      9190",
            "prev_diff_flag": "3",
            "prev_diff_price": "              0",
            "prev_diff_rate": "         0"
        },
        {
            "data_date": "20231214",
            "data_time": "093400",
            "open_price": "           6687",
            "high_price": "           6688",
            "low_price": "         6684.5",
            "last_price": "         6684.5",
            "last_qntt": "       106",
            "vol": "      9402",
            "prev_diff_flag": "5",
            "prev_diff_price": "              3",
            "prev_diff_rate": "-0.0448598"
        }
    ],
    "rt_cd": "0",
    "msg_cd": "MCA00000",
    "msg1": "정상처리 되었습니다."
}