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
- Python
- Node.js
- C#
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]
If you have never used the SDK for logging in or if you have changed your SDK execution environment,
please create an index.js file in your folder and paste the following content into it, then execute it::
const { FubonSDK, TimeInForce, FutOptOrderType, FutOptPriceType, FutOptMarketType, CallPut, BSAction } = require('fubon-neo');
const sdk = new FubonSDK();
const accounts = sdk.login("Your ID", "Your Password", "Your cert path" , "Your cert password");
// const 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
const acc = accounts.data[0];
If you have never used the SDK for logging in or if you have changed your SDK execution environment,
please create an index.cs file in your folder and paste the following content into it, then execute it::
using FubonNeo.Sdk;
var sdk = new FubonSDK();
var accounts = sdk.Login("Your ID", "Your Password", "Your cert path" , "Your cert password"); // If there are account groupings, multiple account information will be returned
/*
// If you use the "default" password for your certificate, for SDK v1.3.2 and newer versions
var acc_obj = sdk.Login("Your ID", "Your Password", "Your cert path");
*/
var 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.
- Python
- Node.js
- C#
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)
const order = {
buySell: BSAction.Buy,
symbol: "TXFD4",
price: "20800",
lot: 3,
marketType: FutOptMarketType.Future,
priceType: FutOptPriceType.Limit,
timeInForce: TimeInForce.ROD,
orderType: FutOptOrderType.Auto,
userDef: "fromJs"
};
sdk.futopt.placeOrder(acc,order);
var order = new FutOptOrder(
BsAction.Buy,
"TXFD4",
null, // Spread Order Buy / Sell
null, // Spread Order Symbol
"20800",
3,
FutOptMarketType.Future,
FutOptPriceType.Limit,
TimeInForce.Rod,
FutOptOrderType.Auto,
"FromCS"
);
sdk.FutOpt.PlaceOrder(acc, order);