Skip to main content

Modify Order Price

ModifyPrice

First use MakeModifyPriceObj to create a ModifyPriceObj object

ParameterTypeDescription
orderResultOrderResultThe order to be modified
price*stringThe modified price
priceType*PriceTypeThe 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

ParameterTypeDescription
accountAccountAccount
modifyPriceObjModifyPriceObjPrice modification object
unblock*bool (optional) (default = false)Whether to use non-blocking

Result Return

ParameterTypeDescription
IsSuccessboolWhether successful
Data*OrderResultReturns order information
Message*stringReturns error message when IsSuccess = false

Modification Information OrderResult Fields

Return type : Object

ParameterTypeDescription
FunctionType*int64Function Type: 0 New Order, 10 Execute New Order, 15 Change Price, 20 Change Qty, 30 Cancel Order, 90 Fail
Date*stringTransaction Date
SeqNo*stringOrder Sequence Number
BranchNo*stringBranch Code
Account*stringAccount
OrderNo*stringOrder Number
AssetType*int64Asset Type: 0 Securities
Market*stringMarket: TAIEX Listed Stocks, TAISDAQ OTC Stocks, TAIEMG Emerging Stocks
MarketTypeMarketTypeMarket Type Category: MarketTypeCommon Regular Stock, MarketTypeFixing Fixing, MarketTypeIntradayOdd Intraday Odd Lot, MarketTypeOdd Post-market Odd Lot, MarketTypeEmg Emerging, MarketTypeEmgOdd Emerging Odd Lot
StockNo*stringStock Symbol
BuySell*BsActionBuy/Sell Action: BsActionBuy Buy, BsActionSell Sell
PriceType*PriceTypeEffective Price Type: PriceTypeLimit Limit, PriceTypeLimitUp Limit Up, PriceTypeLimitDown Limit Down, PriceTypeMarket Market, PriceTypeReference Reference
Price*stringPrice
Quantity*int64Original Order Quantity
TimeInForce*TimeInForceOrder Condition: TimeInForceRod ROD, TimeInForceFok FOK, TimeInForceIoc IOC
OrderType*OrderTypeOrder Type: OrderTypeStock Common, OrderTypeMargin Margin, OrderTypeShort Short Sell, OrderTypeDayTrade Day Trade, OrderTypeSbl SBL
IsPreOrder*boolIs Pre-order
Status*int64Order 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*PriceTypeEffective Price Type: PriceTypeLimit Limit, PriceTypeLimitUp Limit Up, PriceTypeLimitDown Limit Down, PriceTypeMarket Market, PriceTypeReference Reference
AfterPrice*stringEffective Order Price
Unit*int64Unit
AfterQty*int64Effective Order Quantity (including filled part)
FilledQty*int64Filled Quantity
FilledMoney*int64Filled Amount
BeforeQty*int64Effective Qty Before Change
BeforePrice*stringEffective Price Before Change
UserDef*stringUser Defined Field
LastTime*stringLast Modified Time
Details*stringOrder History (Value exists only when querying OrderResultDetail or OrderHistory)
ErrorMessage*stringError 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
},
}