Skip to content

Terms of service

Restricted by Taiwan's financial regulations, new users need to sign relevant documents and complete a test report in the simulation mode before using it in a formal environment.

Sign Documents

Please refer to sign center and read the documents carefully before you sign.
signature

Test Report

To ensure that you fully understand how to use Shioaji, you need to complete the test report in the simulation mode, which includes the following functions:

  • login

Login

import shioaji as sj
api = sj.Shioaji(simulation=True)
api.login(
    person_id="PERSON_ID", #個人專屬帳號 
    passwd="PASSWORD", 
)
  • place_order (version >= 0.3.6.dev7)

  The stock order is a test report for the stock account, and the same is true for futures.

Stock Order

# contract - edit it
contract = api.Contracts.Stocks.TSE["2890"]

# order - edit it
order = api.Order(
    action=sj.constant.Action.Buy,
    price=20, 
    quantity=1, 
    price_type=sj.constant.StockPriceType.LMT,
    order_type=sj.constant.TFTOrderType.ROD,
    account=api.stock_account
)

# place order
trade = api.place_order(contract, order, timeout=0)

Future Order

# near-month TXF - edit it
contract = min(
    [
        x for x in api.Contracts.Futures.TXF 
        if x.code[-2:] not in ["R1", "R2"]
    ],
    key=lambda x: x.delivery_date
)

# order - edit it
order = api.Order(
    action=sj.constant.Action.Buy,
    price=15000, 
    quantity=1, 
    price_type=sj.constant.StockPriceType.LMT,
    order_type=sj.constant.FuturesOrderType.ROD,  
    octype=sj.constant.FuturesOCType.Auto,
    account=api.futopt_account
)

# place order
trade = api.place_order(contract, order, timeout=0)

Attention

In response to the company's information security regulations, the test report service is Monday to Friday 08:00 ~ 20:00

  • 18:00 ~ 20:00: Only allow Taiwan IP
  • 08:00 ~ 18:00: No limit

CA

You must apply and activate the CA before place_order.

Apply CA

  1. Go to SinoPac Securities to download eleader eleader_download
  2. Login eleader
    login eleader
  3. Select (3303)帳號資料設定 from the 帳戶資料 above eleader_account
  4. Click "步驟說明" CA_step
  5. CA Operation steps CA_info

Activate CA

  • If you use simulation account, you don't have to activate CA.
  • If you are a macOS user, you may subject to version-issue. We suggest you to use docker and run shioaji service on docker.

In

result = api.activate_ca(
    ca_path="/c/your/ca/path/Sinopac.pfx",
    ca_passwd="YOUR_CA_PASSWORD",
    person_id="Person of this Ca",
)

print(result)
# True

The Certification Path

In Windows you copy the file path with \ to separate the file, you need to replace it with /.