- Class: FugleTrade
- Constructor: new FugleTrade(options)
- fugle.login()
- fugle.logout()
- fugle.placeOrder(order)
- fugle.replacePrice(order, price)
- fugle.replaceQuantity(order, quantity)
- fugle.cancelOrder(order)
- fugle.getOrders()
- fugle.getTransactions(options)
- fugle.getInventories()
- fugle.getSettlements()
- fugle.getBalance()
- fugle.getTradeStatus()
- fugle.getMarketStatus()
- fugle.getKeyInfo()
- fugle.getMachineTime()
- fugle.getCertInfo()
- fugle.streamer
- fugle.streamer.connect()
- fugle.streamer.disconnect()
- Class: Order
- Class property: Order.Side
- Class property: Order.ApCode
- Class property: Order.PriceFlag
- Class property: Order.BsFlag
- Class property: Order.TradeType
- Constructor new Order(payload)
- order.setSymbol(symbol)
- order.setSide(side)
- order.setPrice(price)
- order.setQuantity(quantity)
- order.setApCode(apCode)
- order.setPriceFlag(priceFlag)
- order.setBsFlag(bsFlag)
- order.setTrade(trade)
- order.toObject()
This class represents a client that uses remote services from the server.
options
{Object} Set of configurable options to set on theFugleTrade
. Note that one and only one of theconfigPath
orconfig
options must be specified.configPath
{string} To load configuration file by path.config
{Object} Set configuration variables. Available properties are:apiUrl
{string} FugleTrade API URL.apiKey
{string} FugleTrade API key.apiSecret
{string} FugleTrade API secret.certPath
{string} The path of certificate.certPass
{string} The certificate password.aid
{string} The account ID.password
{string} The account password.
Create a new FugleTrade
instance.
- Returns: {Promise} Fulfills with
undefined
upon success.
Log in to the remote server to begin using services.
- Returns: {Promise} Fulfills with
undefined
upon success.
Log out and remove the credentials of the logged in account.
order
{Order} The order to be placed.- Returns: {Promise} Fulfills with an {PlaceOrderResponse} upon success.
Place an order for the logged in account.
order
{PlacedOrder | Order.PriceFlag} The working order to be replaced.price
{number} The price of replace.- Returns: {Promise} Fulfills with an {ReplaceOrderResponse} upon success.
Replace the order to change price for the logged in account.
order
{PlacedOrder} The working order to be replaced.quantity
{number} The price of replace.- Returns: {Promise} Fulfills with an {ReplaceOrderResponse} upon success.
Replace the order to change quantity for the logged in account.
order
{PlacedOrder} The working order to be replaced.options
{Object} Set of configurable options to replace the order.price
{number | Order.PriceFlag} The price of replace.quantity
{number} The quantity of replace.
- Returns: {Promise} Fulfills with an {ReplaceOrderResponse} upon success.
Replace the order for the logged in account. Note that one and only one of the price
or quantity
options must be specified.
order
{PlacedOrder} The working order to be canceled.- Returns: {Promise} Fulfills with an {ReplaceOrderResponse} upon success.
Cancel the order for the logged in account.
- Returns: {Promise} Fulfills with {PlacedOrder[]} upon success.
Gets existing orders of the logged account.
options
{Object} Set of configurable options to get transactions.duration
{string} Available duration is0d
,3d
,1m
or3m
.startDate
{string} The start date.endDate
{string} The end date.
- Returns: {Promise} Fulfills with {Trade[]} upon success.
Gets transactions of the logged account.
- Returns: {Promise} Fulfills with {Stock[]} upon success.
Gets inventories of the logged account.
- Returns: {Promise} Fulfills with {Settlement[]} upon success.
Gets incoming settlements of the logged account.
- Returns: {Promise} Fulfills with an {BalanceStatus} upon success.
Gets bank account balance of the logged account.
- Returns: {Promise} Fulfills with an {TradeStatus} upon success.
Gets trading quota and margin transaction information of the logged account.
- Returns: {Promise} Fulfills with an {MarketStatus} upon success.
Gets market open status.
- Returns: {Promise} Fulfills with an {KeyInfo} upon success.
Gets API key information of the logged account.
- Returns: {Promise} Fulfills with {string} upon success.
Gets machine time of the remote server. If the time difference between the local time and the remote machine is too large, the verification process will fail.
- Returns: {Promise} Fulfills with {CertInfo} upon success.
Gets the certificate information.
- {Streamer}
A class instance includes EventEmitter
and ws.WebSocket
to handle WebSocket connection.
Emitted when the connection is established.
Emitted when the connection is closed.
data
{string} The message content of the order confirmation.
Emitted when an order is confirmed. The data
is the message content of the order confirmation.
data
{string} The message content of the execution report.
Emitted when an order is executed. The data
is the message content of the execution report.
data
{string} The message content.
Emitted when a message is received.
error
{Error}
Emitted when an error occurs.
Establish a connection to the remote server.
Disconnect from the remote server.
This class represents an order to be placed.
- {enum}
Key | Value | Description |
---|---|---|
Buy |
'B' |
Buy side |
Sell |
'S' |
Sell side |
- {enum}
Key | Value | Description |
---|---|---|
Common |
'1' |
Regular trading |
AfterMarket |
'2' |
After-hour fixed-price trading |
Odd |
'3' |
After-hour odd Lot trading |
Emg |
'4' |
Emerging stock trading |
IntradayOdd |
'5' |
Intraday odd lot trading |
- {enum}
Key | Value | Description |
---|---|---|
Limit |
'0' |
Limit price |
Flat |
'1' |
Reference price |
LimitDown |
'2' |
Limit down price |
LimitUp |
'3' |
Limit up price |
Market |
'4' |
Market price |
- {enum}
Key | Value | Description |
---|---|---|
ROD |
'R' |
Rest of day |
IOC |
'I' |
Immediate or cancel |
FOK |
'F' |
Fill or kill |
- {enum}
Key | Value | Description |
---|---|---|
Cash |
'0' |
Cash trading |
Margin |
'3' |
Margin purchase / Margin sale |
Short |
'4' |
Short sale / Short covering |
DayTrading |
'9' |
Day trading |
DayTradingSell |
'A' |
Sell-and-then-buy day trading |
payload
{Object} Set payload of the order.stockNo
{string} The symbol of the equity.buySell
{Order.Side} The buy/sell side.price
{number} The price of the order.quantity
{number} The quantity of the order.apCode
{Order.ApCode} The trading system.priceFlag
{Order.PriceFlag} The price flag.bsFlag
{Order.BsFlag} The order type.trade
{Order.TradeType} The trade type.
Create a new Order
instance.
- {Object}
stockNo
{string} The symbol of the equity.buySell
{Order.Side} The buy/sell side.price
{number} The price of the order.quantity
{number} The quantity of the order.apCode
{Order.ApCode} The trading system.priceFlag
{Order.PriceFlag} The price flag.bsFlag
{Order.BsFlag} The order type.trade
{Order.TradeType} The trade type.
The payload of the order.
symbol
{string} The symbol of the equity.- Returns: {this}
Sets stockNo
value for the order payload.
side
{Order.Side} The buy/sell side.- Returns: {this}
Sets buySell
value for the order payload.
price
{number} The price of the order.- Returns: {this}
Sets price
value for the order payload.
quantity
{number} The quantity of the order.- Returns: {this}
Sets quantity
value for the order payload.
apCode
{Order.ApCode} The trading system.- Returns: {this}
Sets apCode
value for the order payload.
priceFlag
{Order.PriceFlag} The price flag.- Returns: {this}
Sets priceFlag
value for the order payload.
bsFlag
{Order.BsFlag} The order type.- Returns: {this}
Sets bsFlag
value for the order payload.
tradeType
{Order.TradeType} The trade type.- Returns: {this}
Sets trade
value for the order payload.
- Returns: {OrderObject}
Converts to OrderObject
of the @fugle/trade-core
.