Skip to content

Quick Start


import shioaji as sj

api = sj.Shioaji()
accounts = api.login("YOUR_PERSON_ID", "YOUR_PASSWORD")
    person_id="Person of this Ca",
Just import our API library like other popular python library and new the instance to start using our API. Login your account and activate the certification then you can start placing order.

The Certification Path

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

Streaming Market Data

api.quote.subscribe(api.Contracts.Stocks["2330"], quote_type="tick")
api.quote.subscribe(api.Contracts.Stocks["2330"], quote_type="bidask")
api.quote.subscribe(api.Contracts.Futures["TXFC0"], quote_type="tick")

Subscribe the real time market data. Simplely pass contract into quote subscribe function and give the quote type will receive the streaming data.

Quote Type

Currently we support two quote type you can see in shioaji.constent.QuoteType. The best way to use that is directly pass this enum into subscribe function.

Place Order

contract = api.Contracts.Stocks["2890"]
order = api.Order(
trade = api.place_order(contract, order)

Like the above subscribing market data using the contract, then need to define the order. Pass them into place_order function, then it will return the trade that describe the status of your order.


This quickstart demonstrates how easy to use our package for native Python users. Unlike many other trading API is hard for Python developer. We focus on making more pythonic trading API for our users.