登入凱基帳號

登錄您的帳戶並啟用CA 憑證,後續你將有權限訂閲行情及歷史數據,並執行下單。
成功登入後將自動顯示帳號資訊。

Example

input
import kgisuperpy as kgi
import pandas as pd
import numpy as np

person_id = '用戶身份證字號'
person_pwd = '用戶帳號密碼'
simulation = True

api = kgi.login(person_id ,person_pwd ,simulation)
output
----- TradeCom Python API detect : Windows platform ----- 
Load[C:\Users\mdbs-user\Downloads\kgisuperpy/tradecom_windows_bridge64.dll] 
Package install directory: C:\Users\mdbs-user\Downloads\kgisuperpy
Current working directory: C:\Users\mdbs-user\Downloads\pythonAPI程式包 
[系統訊息] 路徑設定完成(環境=虛擬下單環境)。
INFO - Successfully retrieved ranking for uid: 用戶身份證字號, level: A+
INFO - [v6.2.04]開始執行 TokenManager
INFO - 開始執行 貓頭鷹 Token 取得流程
INFO - 成功取得 貓頭鷹 Token
-------------- OnConnected() -------------- 
-------------- OnLogonResponse() -------------- 
--- IsSucceed:True ReplyString:登入成功
[{'account': 'xxxxxxx', 'account_flag': '證券', 'broker_id': 'YYYY'}, 
 {'account': 'xxxxxxx ', 'account_flag': '期貨', 'broker_id': 'YYYYYYYY'}, 
 {'account': 'xxxxxxx ', 'account_flag': '複委託', 'broker_id': 'YYYY'}] 
[系統訊息] MSMP 物件初始化完成。
[系統訊息] USMSMP 物件初始化完成。
[系統訊息] CA 驗證通過,帳務與下單功能已初始化。
[系統訊息] API 加載完成,歡迎使用。

Attribute

參數 資料型態 說明
person_id str 用戶身分證字號。
person_pwd str 帳號密碼。
simulation bool 默認為True,為設定連線至測試環境
可輸入參數為
- True:連線至測試環境
- False:連線至正式環境