한국투자증권 주식매매프로그램 만들기

파이썬 주식매매프로그램 만들기

미국 주식 프로그램 만들기(KIS Developers) 17

17) RSI 지표 추가

import requests import json import yaml import time import websockets #pip install websockets import asyncio import pandas as pd #pip install pandas from pandas import DataFrame with open(r'config.yaml', encoding='UTF-8') as f: _cfg = yaml.load(f, Loader=yaml.FullLoader) APP_KEY = _cfg['APP_KEY'] APP_SECRET = _cfg['APP_SECRET'] ACCESS_TOKEN = "" CANO = _cfg['CANO'] ACNT_PRDT_CD = _cfg['ACNT_PRDT..

16) 이동평균선 추가

import requests import json import yaml import time import websockets #pip install websockets import asyncio import pandas as pd #pip install pandas from pandas import DataFrame with open(r'config.yaml', encoding='UTF-8') as f: _cfg = yaml.load(f, Loader=yaml.FullLoader) APP_KEY = _cfg['APP_KEY'] APP_SECRET = _cfg['APP_SECRET'] ACCESS_TOKEN = "" CANO = _cfg['CANO'] ACNT_PRDT_CD = _cfg['ACNT_PRDT..

15) 일목균형표 지표 추가

import requests import json import yaml import time import websockets #pip install websockets import asyncio import pandas as pd #pip install pandas from pandas import DataFrame with open(r'config.yaml', encoding='UTF-8') as f: _cfg = yaml.load(f, Loader=yaml.FullLoader) APP_KEY = _cfg['APP_KEY'] APP_SECRET = _cfg['APP_SECRET'] ACCESS_TOKEN = "" CANO = _cfg['CANO'] ACNT_PRDT_CD = _cfg['ACNT_PRDT..

14) 해외주식기간별 시세 json -> df

import requests import json import yaml import time import websockets #pip install websockets import asyncio import pandas as pd #pip install pandas from pandas import DataFrame with open(r'config.yaml', encoding='UTF-8') as f: _cfg = yaml.load(f, Loader=yaml.FullLoader) APP_KEY = _cfg['APP_KEY'] APP_SECRET = _cfg['APP_SECRET'] ACCESS_TOKEN = "" CANO = _cfg['CANO'] ACNT_PRDT_CD = _cfg['ACNT_PRDT..

13) 해외주식 지연실시간 체결가격

Q) 지연인 이유 A) 미국 실시간(0분), 홍콩 베트남 중국(15분 지연), 일본(20분 지연) import requests import json import yaml import time import websockets #pip install websockets import asyncio with open(r'config.yaml', encoding='UTF-8') as f: _cfg = yaml.load(f, Loader=yaml.FullLoader) APP_KEY = _cfg['APP_KEY'] APP_SECRET = _cfg['APP_SECRET'] ACCESS_TOKEN = "" CANO = _cfg['CANO'] ACNT_PRDT_CD = _cfg['ACNT_PRDT_CD'] ACTUAL_D..

12) 국내주식 실시간 체결가격

우선 시작하기 앞서 pip install websockets 웹소켓을 설치해야하고 config yaml 수정이 필요하다 #koreainvestment developer info #홈페이지에서 API서비스 신청시 받은 Appkey, Appsecret 값 설정 APP_KEY: "" APP_SECRET: "" #계좌번호 CANO: "" #계좌번호 - 뒷자리 ACNT_PRDT_CD: "01" PHONE: "" #domain info #실전투자 ACTUAL_DOMAIN: "https://openapi.koreainvestment.com:9443" #웹소켓 WEB_SOCKET_DOMAIN: "ws://ops.koreainvestment.com:21000" #모의투자서비스 vts: "https://openapivts..

11) 해외주식 기간별 시세

import requests import json import yaml with open(r'config.yaml', encoding='UTF-8') as f: _cfg = yaml.load(f, Loader=yaml.FullLoader) APP_KEY = _cfg['APP_KEY'] APP_SECRET = _cfg['APP_SECRET'] ACCESS_TOKEN = "" CANO = _cfg['CANO'] ACNT_PRDT_CD = _cfg['ACNT_PRDT_CD'] ACTUAL_DOMAIN = _cfg['ACTUAL_DOMAIN'] # ACCESS TOKEN 발급 def get_access_token(): url = 'oauth2/tokenP' request_url = f"{ACTUAL_DOMAIN..

10) 국내주식기간별시세(일/주/월/년)

import requests import json import yaml with open(r'config.yaml', encoding='UTF-8') as f: _cfg = yaml.load(f, Loader=yaml.FullLoader) APP_KEY = _cfg['APP_KEY'] APP_SECRET = _cfg['APP_SECRET'] ACCESS_TOKEN = "" CANO = _cfg['CANO'] ACNT_PRDT_CD = _cfg['ACNT_PRDT_CD'] ACTUAL_DOMAIN = _cfg['ACTUAL_DOMAIN'] # ACCESS TOKEN 발급 def get_access_token(): url = 'oauth2/tokenP' request_url = f"{ACTUAL_DOMAIN..

9) 국내주식주문(현금매도)

import requests import json import yaml with open(r'config.yaml', encoding='UTF-8') as f: _cfg = yaml.load(f, Loader=yaml.FullLoader) APP_KEY = _cfg['APP_KEY'] APP_SECRET = _cfg['APP_SECRET'] ACCESS_TOKEN = "" CANO = _cfg['CANO'] ACNT_PRDT_CD = _cfg['ACNT_PRDT_CD'] ACTUAL_DOMAIN = _cfg['ACTUAL_DOMAIN'] # ACCESS TOKEN 발급 def get_access_token(): url = 'oauth2/tokenP' request_url = f"{ACTUAL_DOMAIN..

8) 해외주식주문(현금매도)

import requests import json import yaml with open(r'config.yaml', encoding='UTF-8') as f: _cfg = yaml.load(f, Loader=yaml.FullLoader) APP_KEY = _cfg['APP_KEY'] APP_SECRET = _cfg['APP_SECRET'] ACCESS_TOKEN = "" CANO = _cfg['CANO'] ACNT_PRDT_CD = _cfg['ACNT_PRDT_CD'] ACTUAL_DOMAIN = _cfg['ACTUAL_DOMAIN'] # ACCESS TOKEN 발급 def get_access_token(): url = 'oauth2/tokenP' request_url = f"{ACTUAL_DOMAIN..

반응형