Skip to main content

Place Order

placeOrder

Input Parameters

ParameterTypeMeaning
accountAccountAccount
orderObjectOrderObjectOrder Object
unblockbool ? (default = false)Whether to use non-blocking mode

Result

ParameterTypeMeaning
isSuccessboolWhether successful
dataObjectOrderResult list is returned
messagestring ? (optional)Error message returned when isSuccess = false

OrderResult Parameter

Return type : Object

ParameterTypeMeaning
functionTypenumberFunction Type : 0 New Order, 10 New Order Executed, 15 Change Price, 20 Change Quantity, 30 Cancel, 90 Failed
datestringTransaction date
seqNostringOrder serial number
branchNostringBranch number
accountstringAccount
orderNostringOrder number
assetTypenumberAsset type : 0 Stock
marketstringMarket type : TAIEX Listed, TAISDAQ OTC, TAIEMG EMG
marketTypejs:string / ts:MarketTypeTrading session type : Common, Fixing, IntradayOdd, Odd, Emg, EmgOdd
stockNostringSymbol
buySelljs:string / ts:BSActionBuy/Sell Type : Buy, Sell
priceTypejs:string / ts:PriceTypeOriginal order price type : Limit, LimitUp, LimitDown, Market, Reference
pricenumberOrder Price
quantitynumberOriginal order quantity
timeInForcejs:string / ts:TimeInForceTime In Force ROD, FOK, IOC
orderTypejs:string / ts:OrderTypeOrder Type : Stock, Margin, Short Short sale, DayTrade, SBL
isPreOrderboolReservation Flag
statusnumberOrder status, for details please refer to STATUS
afterPriceTypejs:string / ts:PriceTypeValid order price type : Limit, LimitUp, LimitDown, Market, Reference
afterPricenumberValid order price
unitnumberTrading Unit
afterQtynumberValid Order Quantity (filled quantity included)
filledQtynumberFilled Quantity
filledMoneynumberFilled Value
beforeQtynumberBefore the Quantity Modification
beforePricenumberBefore the Price Modification
user_defstringCustom Fields
lastTimestringLast Modification Time
detailslistOrder Process (Return value when query orderResultDetail or orderHistory )
errorMessagestringError Message

Request Example

const order = {
buySell: BSAction.Buy,
symbol: "2888",
price: "8.90",
quantity: 2000,
marketType: MarketType.Common,
priceType: PriceType.Limit,
timeInForce: TimeInForce.ROD,
orderType: OrderType.Stock,
userDef: "fromJs"
};

sdk.stock.placeOrder(accounts.data[0],order,false);

Response Example

{
isSuccess: true,
data:
{
functionType: 0,
date: '2023/10/23',
seqNo: '00000000016',
branchNo: '6460',
account: '26',
orderNo: 'bA716',
assetType: 0,
market: 'TAIEX',
marketType: Common,
stockNo: '2888',
buySell: Buy,
priceType: Limit,
price: 9,
quantity: 2000,
timeInForce: ROD,
orderType: 0,
isPreOrder: false,
status: 10,
afterPriceType: Limit,
afterPrice: 9,
unit: 1000,
afterQty: 2000,
filledQty: 0,
filledMoney: 0,
beforeQty: 0,
beforePrice: 9,
userDef: 'fromJs',
lastTime: '13:36:38.317'
}
}