Sinopac All New Trading Api.
Project description
Shioaji
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.
We are in early-release alpha. Expect some adventures and rough edges.
Installation
Binaries
simple using pip to install
pip install shioaji
Docker Image
simple run with interactive mode in docker
docker run -it sinotrade/shioaji:latest
run with jupyter lab or notebook
docker run -p 8888:8888 sinotrade/shioaji:jupyter
Quickstarts
Initialization
import shioaji as sj
api = sj.Shioaji()
accounts = api.login("YOUR_PERSON_ID", "YOUR_PASSWORD")
api.activate_ca(
ca_path="/c/your/ca/path/Sinopac.pfx",
ca_passwd="YOUR_CA_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.
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.
Place Order
contract = api.Contracts.Stocks["2890"]
order = api.Order(
price=9.6,
quantity=1,
action="Buy",
price_type="LMT",
order_type="ROD",
order_lot="Common",
account=api.stock_account,
)
# or
order = api.Order(
price=9.6,
quantity=1,
action=sj.constant.Action.Buy,
price_type=sj.constant.TFTStockPriceType.LMT,
order_type=sj.constant.TFTOrderType.ROD,
order_lot=sj.constant.TFTStockOrderLot.Common,
account=api.stock_account,
)
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.
Conclusion
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.
More usage detail on document.
Communication
- Gitter: general chat, online discussions, collaboration etc.
- GitHub issues: bug reports, feature requests, install issues, RFCs, thoughts, etc.
Releases and Contributing
Shioaji current state is Pre-Alpha, we expect no obvious bugs. Please let us know if you encounter a bug by filing an issue.
We appreciate all suggestions. If you have any idea want us to implement, please discuss with us in gitter.
The Team
Shioaji is currently maintained by Sally, Yvictor, Sam, Sky Wu and Po Chien Yang with major contributions.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for shioaji-0.2.0.dev8-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 609f82dc1c540826048b93056ead3b46960ca0bb57269094e18736e152e94685 |
|
MD5 | 41cf42d4d9bb97f741ca094b3cc2a091 |
|
BLAKE2b-256 | 5e43d6671871f5e6f7acff77c8ff294922eb9c91fe5623a2877bfea598cabd10 |
Hashes for shioaji-0.2.0.dev8-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5694c6b65e114755e745522df3d7328b78ceabdfcaeaf0660d3f0805fc93c28 |
|
MD5 | c62bed4f77f8be5ce209e537419d3527 |
|
BLAKE2b-256 | 10a6711f7860007f3d6d09594d9504a3d23a41500b1e5322574a91673295cc11 |
Hashes for shioaji-0.2.0.dev8-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 437fe53c93fafce85e5c1abe26540d6b24383a883c78aca022a3dac6846927ce |
|
MD5 | 6c6bd02f555c2db26eda719900ebef90 |
|
BLAKE2b-256 | 0b67a29797253f36bbfabc0d71690cb913e06ccdf2c9c487a5f38d4dca7657f6 |
Hashes for shioaji-0.2.0.dev8-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf63e47a5c91f724167540e7a7b69afd9c075e53eaec90de558d2acd057f195e |
|
MD5 | d5e3df16b51c2deac4f08130b32d6f33 |
|
BLAKE2b-256 | 9aafef5d6b8821db3a2a5ed602342a955e22fda27a6fac253b8806105e315bf3 |
Hashes for shioaji-0.2.0.dev8-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d3803ab7989a9cfd691342c86947f593a7ebc5a16dd6c12ceb8ea331a5a9e20 |
|
MD5 | 5520ac76f1a7019b46414dfa76db967a |
|
BLAKE2b-256 | 3de56c3266a18c5b486a13719162e4ac1f61d0f13028869ca7df20b92cc32d4a |
Hashes for shioaji-0.2.0.dev8-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c7c5936e1e04ce066b645a4320134c2bb19500c588c5b7cb704a1ed8a6f4f58 |
|
MD5 | 41a5c35ddfd2ecd033dd5facc62b1b75 |
|
BLAKE2b-256 | 7a04529f34cd958a8d6ab9875f0da31394877908827748511665f667a486950b |
Hashes for shioaji-0.2.0.dev8-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a28b701898bee41d807c521f43692d3523b610f9fe3ef492a6af2e2fd19d41bc |
|
MD5 | 9c878d8c90cdd88c5133838a31f89430 |
|
BLAKE2b-256 | 00e42c7d6b059d3cbb36b701975b88445d1f3076f7b1e0d1a265c77378ad2c97 |
Hashes for shioaji-0.2.0.dev8-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1efbd945106233e8c0c5980394267be0b8e390ed34bc5281980c2aecc84ba285 |
|
MD5 | ea23d149d6ecd5183c07864d56fca604 |
|
BLAKE2b-256 | d7c62376c526db58994ded5fe8cc222e05a4c70104c5cbe9f9fe57f171ade098 |
Hashes for shioaji-0.2.0.dev8-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3118d46f7d7810e4c2948949c3a77506f87c8de677a6fba0788db52538a90d3 |
|
MD5 | 4795fb7227d2e5b23a057650345af31f |
|
BLAKE2b-256 | e2193d553bc6a5232617ce1d5329823e5bfd6a34f26bdc1e54048d575fe29ad4 |