因應台灣金融法規的要求,新用戶在首次使用服務時,必須先簽署相關文件,方可進入正式環境使用:
美股暫不提供模擬環境測試
Python API Python 執行環境安裝 64位元版本之 Python
【Windows環境】
64位元Windows 10或以上版本
【Linux環境】
Red Hat 7與 Ubuntu 20以上作業系統
| 作業系統 | Red Hat 7 | Ubuntu 20 |
|---|---|---|
| GNU C | gcc 4.8.x | gcc 9.x |
| GNU libc | ldd 2.17 | ldd 2.3x |
請注意python版本限制為3.09~3.13
使用方法
import kgisuperpy as kgi
import pandas as pd
import numpy as np
下單前,您必須申請並啟用CA憑證且憑證有效
設定simulation = False連線至正式環境
使用方法
person_id = '用戶身分證字號'
person_pwd = '用戶帳號密碼'
simulation = False #連線至正式環境
api = kgi.login(person_id ,person_pwd,simulation)
設定完複委託交易帳戶啟用SubOrder及SubAccount功能
使用方法
api.set_SubAccount('account')
使用方法
api.SubOrder.create_order(action= kgi.Action.Buy,
symbol= 'AAPL',
qty= 1,
price= 230
)