今天在測試一樣東西還沒成功,
所以先讓我暫時偷懶一下,
把Scanners API做一些參數變化。
(1)匯入需要的庫
import pandas as pd
import shioaji as sj
(2)登入永豐證券帳密
api = sj.Shioaji(simulation=True)
api.login(
person_id='PAPIUSER01',
passwd='2222',
contracts_cb=lambda security_type: print(f"{repr(security_type)} fetch done.")
)
(3)Percent Rank 的範例
scanner = api.scanners(
scanner_type = sj.constant.ScannerType.ChangePercentRank,
count = 5
)
pd.set_option('display.width',200)
pd.set_option('display.max_rows',None)
pd.set_option('display.max_columns',None)
scanner_df = pd.DataFrame(scanner)
scanner_df.ts = pd.to_datetime(scanner_df.ts)
print(scanner_df)
(3)Day ange Rank 的範例
scanner = api.scanners(
scanner_type = sj.constant.ScannerType.DayRangeRank,
count = 5
)
pd.set_option('display.width',200)
pd.set_option('display.max_rows',None)
pd.set_option('display.max_columns',None)
scanner_df = pd.DataFrame(scanner)
scanner_df.ts = pd.to_datetime(scanner_df.ts)
print(scanner_df)
明天我看看能不能把client的部分弄出來