Shioaji is sinopac provide the most pythonic api for trading the taiwan and global financial market. You can use your favorite Python packages such as numpy, scipy, pandas, pytorch or tensorflow to build your own trading model with intergrated the shioaji api on cross platform.
大家好 我是新手 想請問 pip install shioaji 一直出現錯誤 問題是出在哪呢? 謝謝
ERROR: Could not find a version that satisfies the requirement shioaji
ERROR: No matching distribution found for shioaji
按照前面的討論串,應該是python安裝成32bit,要安裝64bit python。另外,如果使用windows,那python要安裝3.8以下,不然會有DLL的問題,我是安裝WIN7 (64bit) 安裝python 3.7.8 (64bit)可以正常安裝執行
大家好我也是剛接觸shioaji的新手,覺得python使用起來確實方便許多非常感謝大大們的開發!另外想請問各位大大目前是不是暫時還沒有提供盤後零股下單的api功能呢? 還是說api.Order IntradayOdd或有甚麼function可以辦到嗎?
如果我沒弄錯,odd應該就是盤後零股,這是保留舊有的設定,去年年底才多加了intraday odd
ts | amount | average_price | buy_price | buy_volume | change_price | change_rate | change_type | close | code | exchange | high | low | open | sell_price | sell_volume | tick_type | total_amount | total_volume | volume | volume_ratio | yesterday_volume |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2020/12/28 01:30:00 PM | 1.1E+09 | 513.47 | 514 | 131 | 4 | 0.78 | Up | 515 | 2330 | TSE | 515 | 509 | 512 | 515 | 299 | Buy | 9.71E+09 | 18917 | 2130 | 14.15 | 1337 |
2020/12/28 01:30:00 PM | 2.57E+08 | 92.28 | 91.8 | 652 | 0 | 0 | Unchanged | 91.8 | 2317 | TSE | 93 | 91.8 | 92.4 | 91.9 | 58 | Sell | 6.18E+09 | 66999 | 2796 | 3.73 | 17956 |
2020/12/28 01:45:00 PM | 28874 | 14394.15 | 14436 | 2 | 133 | 0.93 | Up | 14437 | TXFA1 | TAIFEX | 14444 | 14320 | 14329 | 14437 | 6 | Buy | 1.18E+09 | 81663 | 2 | 11.58 | 7053 |
import shioaji as sj
import pandas as pd
# account info
SIMULATION_ID = "PAPIUSER01"
SIMULATION_ID_PASSWORD = "2222"
# login
api = sj.Shioaji(simulation=True)
accounts = api.login(person_id=SIMULATION_ID, passwd=SIMULATION_ID_PASSWORD, contracts_cb=print)
# snapshots
contracts = [api.Contracts.Stocks['2330'], api.Contracts.Stocks['2317'], api.Contracts.Futures["TXF"]["TXF202101"]]
snapshots = api.snapshots(contracts)
# convert to DataFrame
df = pd.DataFrame(snapshots)
df.ts = pd.to_datetime(df.ts)
df.set_index('ts', inplace=True)
# save as csv file
filename = "snapshots.csv"
df.to_csv(filename)