Skip to main content

Quick Start

First, refer to Preparation to complete the risk disclosure application and certificate download.

Installation and version compatibility

For installation steps and minimum version requirements, see Installation and Version Compatibility. Download the SDK from the SDK download page.

Place your certificate in a folder with the following structure:

.
└── XXXXXXXXXX.pfx

f you have never used the SDK for logging in or if you have changed your SDK execution environment, please create an index.py file in your folder and paste the following content into it, then execute it::

from fubon_neo.sdk import FubonSDK, FutOptOrder
from fubon_neo.constant import TimeInForce, FutOptOrderType, FutOptPriceType, FutOptMarketType, CallPut, BSAction

sdk = FubonSDK()

accounts = sdk.login("Your ID", "Your Password", "Your cert path" , "Your cert password") #If there are account groupings, multiple account information will be returned
## accounts = sdk.login("Your ID", "Your Password", "Your cert path") # If you use the "default" password for your certificate, for SDK v1.3.2 and newer versions

acc = accounts.data[0]

Send Order

Next, add the following example code to demonstrate how to use the Fubon API to place a limit order to buy 1 board lot of Fubon Financial Holding Co., Ltd. (2881) at the fall stop price.

order = FutOptOrder(
buy_sell = BSAction.Sell,
symbol = "TXFD4",
price = "20800",
lot = 3,
market_type = FutOptMarketType.Future,
price_type = FutOptPriceType.Limit,
time_in_force = TimeInForce.ROD,
order_type = FutOptOrderType.Auto,
user_def = "Python" # optional field
)
sdk.futopt.place_order(acc, order)