事前準備
caution
在開始富邦新一代 API 前,您必須完成以下步驟
- 準備好您的富邦期貨帳戶 (若您還未擁有富邦期貨帳戶,請點連結線上開戶)
- 簽署 API 風險使用聲明書
- 申請憑證
準備好富邦期貨帳戶
使用您的富邦期貨帳戶

簽署 API 使用風險暨聲明書
請使用手機富邦e點通 或 使用電腦版 E+進行API 線上簽署
完成簽署
恭喜您,已簽署完成使用風險暨聲明書
申請憑證
至憑證申請、展期點選立即執行下載富邦證券憑證e總管(TCEM.exe)申請憑證

登入完成並且認證後,輸入手機或電子信箱收取OTP驗證

完成申請,憑證將存放於 C:\CAFubon\(您的身分證字號),並以您的身份證字號為檔名

安裝與版本相容性
安裝步驟與最低版本需求請見安裝與版本相容性,下載 SDK 請至SDK 下載頁面。
開始拓展程式交易之旅
- Python
- Node.js
- C#
from fubon_neo.sdk import FubonSDK, FutOptOrder
from fubon_neo.constant import TimeInForce, FutOptOrderType, FutOptPriceType, FutOptMarketType, CallPut, BSAction
#載入設定檔與登入
sdk = FubonSDK()
accounts = sdk.login("您的身分證號", "您的登入密碼", "您的憑證路徑位置" , "您的憑證密碼")
## accounts = sdk.login("您的身分證號", "您的登入密碼", "您的憑證路徑位置") # 若憑證選用"預設密碼", SDK v1.3.2與較新版本適用
acc = accounts.data[0]
#建立委託物件
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
)
# 下單
order_res = sdk.futopt.place_order(acc, order)
print(order_res)
恭喜您🎊,完成下單,即可看到系統回覆的結果
Result { is_success: True, message: None, data : FutOptOrderResult{ function_type: 0, date : "2023/10/13", seq_no : "00000000016", branch_no : "6460", account : "26", order_no : "bA627", asset_type : 1, market : "TAIMEX", market_type : Future, symbol : "FITX", unit : 1 , currency : "TWD", expiry_date : "202404", strike_price : , call_put : , buy_sell : Buy , price_type : Limit, price : 20800, lot : 3, time_in_force : ROD, order_type : Auto, is_pre_order : False, status : 10, after_price_type : Limit, afterPrice : 20800, after_lot : 2000, filled_lot : 0, filled_money : 0, ... , user_def : "From Pyhton", last_time : "12:19:06.048", error_message : } }
const { FubonSDK, TimeInForce, FutOptOrderType, FutOptPriceType, FutOptMarketType, CallPut, BSAction } = require('fubon-neo');
// 載入設定檔與登入
const sdk = new FubonSDK();
const accounts = sdk.login("您的身分證號", "您的登入密碼", "您的憑證路徑", "您的憑證密碼");
// const accounts = sdk.login("您的身分證號", "您的登入密碼", "您的憑證路徑位置"); // 若憑證選用"預設密碼", SDK v1.3.2與較新版本適用
const acc = accounts.data[0];
// 建立委託物件
const order = {
buySell: BSAction.Buy,
symbol: TXFD4,
price: "20800",
lot: 3,
marketType: FutOptMarketType.Future,
priceType: FutOptPriceType.Limit,
timeInForce: TimeInForce.ROD,
orderType: FutOptOrderType.Auto,
userDef: "from Js"
};
// 下單
sdk.futopt.placeOrder(acc,order);
恭喜您🎊 ,完成下單,即可看到系統回覆的結果
{ isSuccess: true, data:{ functionType : 0, date : '2023/10/13', seqNo : '00000000016', branchNo : '6460', account : '26', orderNo : 'bA627', assetType : 1, market : 'TAIMEX', marketType : Future, symbol : 'FITX', unit : 1 , currency : 'TWD', expiryDate : '202404' , buySell : Buy , priceType : Limit, price : 20800, lot : 3, timeInForce : ROD, orderType : Auto, isPreOrder : False, status : 10, afterPriceType : Limit, afterPrice : 20800, afterLot : 3, filledLot : 0, filledMoney : 0, ... , userDef : 'From JS', lastTime : '12:19:06.048', errorMessage : } }
using FubonNeo.Sdk;
//載入設定檔與登入
var sdk = new FubonSDK();
var acc_obj = sdk.Login("您的身分證號", "您的登入密碼", "您的憑證路徑" ,"您的憑證密碼");
/*
// 若憑證選用"預設密碼", SDK v1.3.2 與較新版本適用
var acc_obj = sdk.Login("您的身分證號", "您的登入密碼", "您的憑證路徑");
*/
var acc = acc_obj.data[0];
//建立委託物件
var order = new FutOptOrder(
BsAction.Buy,
"TXFD4",
"20800",
3,
FutOptMarketType.Future,
FutOptPriceType.Limit,
TimeInForce.Rod,
FutOptOrderType.Auto,
"From C#"
);
// 下單
var order_res = sdk.FutOpt.PlaceOrder(acc, order);
Console.WriteLine(order_res);
恭喜您🎊,完成下單,即可看到系統回覆的結果
{ isSuccess = True, message = , data = FutOptOrderResult{functionType: 0, date = 2023/10/13, seqNo = 00000000016, branchNo = 6460, account = 26, orderNo = bA627, assetType = 1, market = TAIMEX, marketType = Future, symbol = FITX, unit = 1 , currency = TWD, expiryDate = 202404, strikePrice = , callPut = , buySell = Buy , priceType = Limit, price = 20800, lot = 3, timeInForce = ROD, orderType = Auto, isPreOrder = False, status = 10, afterPriceType = Limit, afterPrice = 66, afterLot = 2000, filledLot = 0, filledMoney = 0, ... , userDef = From C#, lastTime = 12:19:06.048, errorMessage = } }