Modify Order Price
ModifyPrice
First use MakeModifyPriceObj to create a ModifyPriceObj object
| Parameter | Type | Description |
|---|---|---|
| orderResult | OrderResult | The order to be modified |
| price | *string | The modified price |
| priceType | *PriceType | The modified price flag |
caution
When the price field has a value, priceType must be nil. When priceType has a value, price must be nil.
Pass the returned object into the ModifyPrice method.
Input Parameters
| Parameter | Type | Description |
|---|---|---|
| account | Account | Account |
| modifyPriceObj | ModifyPriceObj | Price modification object |
| unblock | *bool (optional) (default = false) | Whether to use non-blocking |
Result Return
| Parameter | Type | Description |
|---|---|---|
| IsSuccess | bool | Whether successful |
| Data | *OrderResult | Returns order information |
| Message | *string | Returns error message when IsSuccess = false |
Modification Information OrderResult Fields
Return type : Object
| Parameter | Type | Description |
|---|---|---|
| FunctionType | *int64 | Function Type: 0 New Order, 10 Execute New Order, 15 Change Price, 20 Change Qty, 30 Cancel Order, 90 Fail |
| Date | *string | Transaction Date |
| SeqNo | *string | Order Sequence Number |
| BranchNo | *string | Branch Code |
| Account | *string | Account |
| OrderNo | *string | Order Number |
| AssetType | *int64 | Asset Type: 0 Securities |
| Market | *string | Market: TAIEX Listed Stocks, TAISDAQ OTC Stocks, TAIEMG Emerging Stocks |
| MarketType | MarketType | Market Type Category: MarketTypeCommon Regular Stock, MarketTypeFixing Fixing, MarketTypeIntradayOdd Intraday Odd Lot, MarketTypeOdd Post-market Odd Lot, MarketTypeEmg Emerging, MarketTypeEmgOdd Emerging Odd Lot |
| StockNo | *string | Stock Symbol |
| BuySell | *BsAction | Buy/Sell Action: BsActionBuy Buy, BsActionSell Sell |
| PriceType | *PriceType | Effective Price Type: PriceTypeLimit Limit, PriceTypeLimitUp Limit Up, PriceTypeLimitDown Limit Down, PriceTypeMarket Market, PriceTypeReference Reference |
| Price | *string | Price |
| Quantity | *int64 | Original Order Quantity |
| TimeInForce | *TimeInForce | Order Condition: TimeInForceRod ROD, TimeInForceFok FOK, TimeInForceIoc IOC |
| OrderType | *OrderType | Order Type: OrderTypeStock Common, OrderTypeMargin Margin, OrderTypeShort Short Sell, OrderTypeDayTrade Day Trade, OrderTypeSbl SBL |
| IsPreOrder | *bool | Is Pre-order |
| Status | *int64 | Order Status: 0 Pre-order, 4 Sending to Backend, 9 Connection Timeout, 10 Order Success, 30 Cancelled Unfilled, 40 Partial Fill/Rest Cancelled, 50 Fully Filled, 90 Fail |
| AfterPriceType | *PriceType | Effective Price Type: PriceTypeLimit Limit, PriceTypeLimitUp Limit Up, PriceTypeLimitDown Limit Down, PriceTypeMarket Market, PriceTypeReference Reference |
| AfterPrice | *string | Effective Order Price |
| Unit | *int64 | Unit |
| AfterQty | *int64 | Effective Order Quantity (including filled part) |
| FilledQty | *int64 | Filled Quantity |
| FilledMoney | *int64 | Filled Amount |
| BeforeQty | *int64 | Effective Qty Before Change |
| BeforePrice | *string | Effective Price Before Change |
| UserDef | *string | User Defined Field |
| LastTime | *string | Last Modified Time |
| Details | *string | Order History (Value exists only when querying OrderResultDetail or OrderHistory) |
| ErrorMessage | *string | Error Message |
Request Example
package main
import (
"fmt"
"fubon"
)
func main() {
// Initialize SDK and login
sdk := fubon.NewSDK()
// ... Login, connection, and other initialization steps ...
// Get the order to modify first
ordResult, err := sdk.Stock.GetOrderResults(account)
if err != nil {
fmt.Printf("❌ Get Order Results Format/Parse Error: %v\n", err)
return
}
var modifyOrder fubon.OrderResult
if ordResult.Data != nil && len(*ordResult.Data) > 0 {
modifyOrder = (*ordResult.Data)[0]
fmt.Println("Selected order for price modification")
fmt.Printf("OrderNo: %s, Current Price: %s\n", *modifyOrder.OrderNo, *modifyOrder.Price)
// Create Modify Price Object
newPrice := "41.1"
modifyPriceObj, err := sdk.Stock.MakeModifyPriceObj(modifyOrder, &newPrice, nil)
if err != nil {
fmt.Printf("❌ Make Modify Price Format/Parse Error: %v (Type: %T)\n", err, err)
return
}
// Execute Modify Price
unblock := false
modifyPriceRes, err := sdk.Stock.ModifyPrice(account, modifyPriceObj, &unblock)
if err != nil {
fmt.Printf("❌ Modify Price Format/Parse Error: %v (Type: %T)\n", err, err)
return
}
// Check Success
if !modifyPriceRes.IsSuccess {
message := "No message"
if modifyPriceRes.Message != nil {
message = *modifyPriceRes.Message
}
fmt.Printf("Modify Price failed. Message: %s\n", message)
return
}
// Output Modification Result
if modifyPriceRes.Data != nil {
fmt.Println("✅ Price modified successfully!")
fmt.Printf("BeforePrice: %s -> AfterPrice: %s\n",
*modifyPriceRes.Data.BeforePrice, *modifyPriceRes.Data.AfterPrice)
} else {
fmt.Println("Modify Price succeeded but no data returned.")
}
} else {
fmt.Println("⚠️ No orders found for price modification")
}
}
Response Example
// ModifyPrice Return Structure
Result{
IsSuccess: true,
Message: nil,
Data: &OrderResult{
FunctionType: 15, // Function Type (15=Change Price)
Date: "2023/11/22", // Transaction Date
SeqNo: "00000308866", // Order Sequence Number
BranchNo: "6460", // Branch Code
Account: "26", // Account
OrderNo: "x0011", // Order Number
AssetType: 0, // Asset Type
Market: "TAIEX", // Market Type
MarketType: MarketTypeCommon, // Market Type Category
StockNo: "1101", // Stock Symbol
BuySell: BsActionSell, // Buy/Sell Action
PriceType: PriceTypeLimit, // Original Price Type
Price: "41.2", // Price
Quantity: 5000, // Original Order Quantity
TimeInForce: TimeInForceRod, // Order Condition
OrderType: OrderTypeStock, // Order Type
IsPreOrder: false, // Is Pre-order
Status: 10, // Order Status
AfterPriceType: PriceTypeLimit, // Effective Price Type
AfterPrice: "41.1", // Effective Price (After modification)
Unit: 1000, // Unit
AfterQty: 2000, // Effective Order Quantity
FilledQty: 0, // Filled Quantity
FilledMoney: 0, // Filled Amount
BeforeQty: nil, // Effective Qty Before Change
BeforePrice: "41.3", // Effective Price Before Change
UserDef: "12345678", // User Defined Field
LastTime: "10:56:57.713", // Last Modified Time
Details: nil, // Order History
ErrorMessage: "", // Error Message
},
}