因應台灣金融法規的要求,新用戶在首次使用服務時,必須先簽署相關文件,方可進入正式環境使用:
若有功能測試需求,可以與相關單位申請測試帳號,於模擬環境進行測試,並遵循以下注意事項:
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.14
使用方法
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)
設定完國外期貨交易帳戶啟用OvFutOrder及OvFutAccount功能
使用方法
api.set_OvfutAccount('account')
使用方法
api.OvfutOrder.create_order(exchange= 'CME_CBT' ,
action=kgi.Action.Buy,
com_id='ZN',
cp =kgi.CP.Futures,
com_ym='202609',
strike_price='',
qty =3,
price=109.50,
price_type=kgi.PriceType.LMT
)