Place Order
placeOrder
Input Parameters
| Parameter | Type | Meaning |
|---|---|---|
| account | Account | Account |
| orderObject | OrderObject | Order Object |
| unblock | bool ? (default = false) | Whether to use non-blocking mode |
Result
| Parameter | Type | Meaning |
|---|---|---|
| isSuccess | bool | Whether successful |
| data | Object | OrderResult list is returned |
| message | string ? (optional) | Error message returned when isSuccess = false |
OrderResult Parameter
Return type : Object
| Parameter | Type | Meaning |
|---|---|---|
| functionType | number | Function Type : 0 New Order, 10 New Order Executed, 15 Change Price, 20 Change Quantity, 30 Cancel, 90 Failed |
| date | string | Transaction date |
| seqNo | string | Order serial number |
| branchNo | string | Branch number |
| account | string | Account |
| orderNo | string | Order number |
| assetType | number | Asset type : 0 Stock |
| market | string | Market type : TAIEX Listed, TAISDAQ OTC, TAIEMG EMG |
| marketType | js:string / ts:MarketType | Trading session type : Common, Fixing, IntradayOdd, Odd, Emg, EmgOdd |
| stockNo | string | Symbol |
| buySell | js:string / ts:BSAction | Buy/Sell Type : Buy, Sell |
| priceType | js:string / ts:PriceType | Original order price type : Limit, LimitUp, LimitDown, Market, Reference |
| price | number | Order Price |
| quantity | number | Original order quantity |
| timeInForce | js:string / ts:TimeInForce | Time In Force ROD, FOK, IOC |
| orderType | js:string / ts:OrderType | Order Type : Stock, Margin, Short Short sale, DayTrade, SBL |
| isPreOrder | bool | Reservation Flag |
| status | number | Order status, for details please refer to STATUS |
| afterPriceType | js:string / ts:PriceType | Valid order price type : Limit, LimitUp, LimitDown, Market, Reference |
| afterPrice | number | Valid order price |
| unit | number | Trading Unit |
| afterQty | number | Valid Order Quantity (filled quantity included) |
| filledQty | number | Filled Quantity |
| filledMoney | number | Filled Value |
| beforeQty | number | Before the Quantity Modification |
| beforePrice | number | Before the Price Modification |
| user_def | string | Custom Fields |
| lastTime | string | Last Modification Time |
| details | list | Order Process (Return value when query orderResultDetail or orderHistory ) |
| errorMessage | string | Error 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'
}
}