Quick Start
Please refer to the Preparation first and complete the application for the API Agreements and certificate download。
If you haven't installed the SDK package yet, you can download it from SDK download page. Once you have the SDK package and know the installation path, use the following command to install it:"
Install Package
- Python
- Node.js
- C#
pip install fubon_neo-<version>-cp37-abi3-win_amd64.whl
First, create a folder named 'project' and initialize it using the following command:
npm init
The file downloaded from the official website will be named fubon-neo-<version>.tgz, and place it in the folder you just created
Add a line to the package.json file inside the Node.js project.
"dependencies": {
...
"fubon-neo": "file://<path-to-js-binary>/fubon-neo-<version>.tgz",
...
}
Then enter the following command in the command line
npm install
Node.js version 16 and above are supported
the downloaded file name should look like this FubonNeo.<version>.nupkg
for Visual Studio user, please refer to below tutorial.
-
Method 1 : Visual Studio Nuget Package Manager( Using .NET 7 as an example ) :
After placing the package under the newly added project, click
Tools
->Nuget Package Manager
->Nuget Package Settings
After popup window,
- Click on the upper-right corner
+
- Click on the bottom
...
select the location to store the package - Rename package
- Click
Update
- Click OK
Click
Tools
->Nuget Package Manager
->Manage Nuget Packages for Solution
Next, select
- Package source, select the package name you named in the previous step
- Click Browse
- Click Package
- Select Project
- Install Package
Finish ! You can using Fubon Neo SDK。
- Click on the upper-right corner
-
Method 2 : Visual Studio Nuget Package Manager( Using .NETFrame 4.7.2 as an example ) : After placing the package under the newly added project, click
Tools
->Nuget Package Manager
->Nuget Package Settings
After popup window,
- Click on the upper-right corner
+
- Click on the bottom
...
select the location to store the package - Rename package
- Click
Update
- Click OK
Click On the right-hand side in Solution Explorer
Switch between solutions and available views
( Or you can open it by going to the 'View' menu at the top) , After opening the folder, locate the .csproj fileInside the .csproj file, add an SDK reference (fill in the version according to the version number).
<ItemGroup>
...
<PackageReference Include="FubonNeo" Version="1.0.0" />
...
</ItemGroup>
...Click on the
.sln
file in File Explorer, right-click on the project name, and select Reload ProjectcautionThe current package only supports 64-bit. If your development environment is set to 32-bit by default, you can adjust it following the steps below:
- Click on the top menu
Project
- Select
Project Properties
- Click on 'Build' on the left side, and change the platform target to x64
- Click on the upper-right corner
-
If you're not using Visual Studio NuGet Package Manager, you can use the Command Line as follows:
You can add a new nuget.config file under the project folder:
cd /Your Project path/
cd .>nuget.config #Create nuget.configAnd copy and paste below content in the nuget.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="local" value="./" />
</packageSources>
<config>
<add key="repositoryPath" value="./" />
</config>
<packageSourceMapping>
<!-- key value for <packageSource> should match key values from <packageSources> element -->
<packageSource key="nuget.org">
<package pattern="*" />
</packageSource>
<packageSource key="local">
<package pattern="FubonNeo*" />
</packageSource>
</packageSourceMapping>
</configuration>and then add sdk reference in the .csproj file (Vsesion base on downloaded package)
...
<ItemGroup>
<PackageReference Include="FubonNeo" Version="1.0.0" />
</ItemGroup>
...and then restore the project in the command line
dotnet restore
And you should place the certificate in your folder structure like this:
.
└── 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, Order
from fubon_neo.constant import TimeInForce, OrderType, PriceType, MarketType, 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, BSAction, TimeInForce, OrderType, PriceType, MarketType } = 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 = Order(
buy_sell = BSAction.Buy,
symbol = "2881",
price = None,
quamtity = 2000,
market_type = MarketType.Common,
price_type = PriceType.LimitDown,
time_in_force= TimeInForce.ROD,
order_type = OrderType.Stock,
)
sdk.stock.place_order(acc, order)
const order = {
buySell: BSAction.Buy,
symbol: 2881,
price: "66",
quantity: 2000,
marketType: MarketType.Common,
priceType: PriceType.LimitDown,
timeInForce: TimeInForce.ROD,
orderType: OrderType.Stock,
userDef: "from Js"
};
//
sdk.stock.placeOrder(acc, order);
var order = new Order(
BsAction.Buy,
"2881",
"66",
2000,
MarketType.Common,
PriceType.LimitDown,
TimeInForce.Rod,
OrderType.Stock,
null
);
sdk.Stock.PlaceOrder(acc ,order);