Skip to main content

Preparation

caution

Before starting with the Fubon Neo API, you must complete the following steps:

  1. Have your Fubon Securities account ready. (If you don't already have a Fubon Securities account, please click the link: Open Account
  2. Apply the digital certificate
  3. Sign the API agreements: Guide to Signing API Agreements and Connection Test + Complete the connection test: Connection Test Helper (Windows)

Get Started

If you already have a Fubon Securities account, please skip this step. If you don’t have a Fubon Securities account, please open an account now.

Your Fubon Securities account

Apply the Digital Certificate

Go to the apply certificate page and download the CATool.

Certificate apply

After logging in and completing the authentication, enter your mobile number or email to receive OTP code and complete the OTP verification.

OTP

After completing the application, the certificate by default will be stored in the folder C:\CAFubon\(Your ID Number). The certificate filename is (Your ID Number).pfx.

CertLocation

Sign the API Agreements and Connection Test

Sign the API Aggreements Online

Follow the example provided in the link below
Guide to Signing API Agreements and Connection Test

Sign the agreements online

Connection Test

Use the connection test helper (for Windows), or directly use FubonNeo API for connection and login.

Connection Test Helper

Install the SDK package

Use the following console command to install the SDK (please be advised that modify the .whl filename to the corresponding version downloaded).

pip install fubon_neo-<version>-cp37-abi3-win_amd64.whl

Support Python version 3.7 (~v1.3.2)、3.8、3.9、3.10、3.11 and 3.12 (v2.0.1~)

C# develop .NET Standard 2.0 for the base , Suggest using .netcoreapp 3.1 and above; If using .NETFramework,suggest using .NETFramework 4.7.2 and above.

Start Your Program Trading Journey

from fubon_neo.sdk import FubonSDK, Order
from fubon_neo.constant import TimeInForce, OrderType, PriceType, MarketType, BSAction

# Connect and login
sdk = FubonSDK()

accounts = sdk.login("Your ID", "Your Password", "Your cert path", "Your cert password")
## 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]

# Create order object
order = Order(
buy_sell = BSAction.Buy,
symbol = "2881",
price = "66",
quamtity = 2000,
market_type = MarketType.Common,
price_type = PriceType.Limit,
time_in_force= TimeInForce.ROD,
order_type = OrderType.Stock,
user_def = "From_Py"
)

# Place an order
order_res = sdk.stock.place_order(acc, order)
print(order_res[0])

Congratulations 🎊 after placing your order, you will be able to see the system's response.

Result {  is_success: True, message: None, data : { date: "2023/10/13", seq_no: "00000000015", branch_no: "6460", account: "26", order_no: "bA626", asset_type: 0, market: "TAIEX", market_type: Common, stock_no: "2881", buy_sell: Buy, price_type: Limit, price: 66.0, quantity: 2000, time_in_force: ROD, order_type: Stock, is_pre_order: false, status: 10, after_price_type: Limit, after_price: 66.0, unit: 1000, after_qty: 2000, filled_qty: 0, filled_money: 0, before_qty: 0, before_price: 66.0, user_def: "From_Py", last_time: "16:48:09.247", error_message: None} }