The following is a list of services provided by the XML API.
Account Information
Service: GetOxSession
Explanation: Returns a session to enable access to the account. This is not the preferred method and it will be removed (the preferred method is GetOxSessionWithSource).
Parameters: sUserName, sPassword, sSessionID(*this parameter is left empty)
Results Notes: An <ErrorMsg> is returned if unable to get a sessionID (i.e. Need to enable account for XML/Software Access in account profile).
Example:
https://oxbranch.optionsxpress.com/accountservice/account.asmx/GetOxSession?sUserName=PeterJohn&sPassword=HJ7D88&sSessionID=
Notes: The account must be enabled for XML. Otherwise, this service will fail.
Service: GetOxSessionWithSource
Explanation: Returns a session to enable access to the account. To get your given sSource contact OptionsXpress.
Parameters: sUserName, sPassword, sSessionID(*this parameter is left empty), sSource
Results Notes: An <ErrorMsg> is returned if unable to get a sessionID (i.e. Need to enable account for XML/Software Access in account profile).
Example: https://oxbranch.optionsxpress.com/accountservice/account.asmx/GetOxSessionWithSource? sUserName=XMLUser&sPassword=HJ7D88&sSessionID=&sSource=Test
Service: GetCustPositions
Explanation: Returns the customer positions
Parameters: sSessionID
Results Notes: A <Message> parameter is returned if there is an error (i.e. Invalid Login or Session). Otherwise no <Message> is returned
Example: https://oxbranch.optionsxpress.com/accountservice/account.asmx/GetCustPositions?sSessionID=5FBD08BE855743989EED5FD229FA11FB
Service: GetCustPositionsSOD
Explanation: Returns the customer positions at the start of the day
Parameters: sSessionID
Results Notes:
Example: https://oxbranch.optionsxpress.com/accountservice/account.asmx/GetCustPositionsSOD?sSessionID=5FBD08BE855743989EED5FD229FA11FB
Service: GetCustBalance
Explanation: Returns the customer's current balance (buying power, cash, option requirements, pending purchases, margin, equity, etc.)
Parameters: sSessionID
Results Notes:
Example: https://oxbranch.optionsxpress.com/accountservice/account.asmx/GetCustBalance?sSessionID=5FBD08BE855743989EED5FD229FA11FB
Service: GetCustOrders
Explanation: Returns the customer orders for the given time period
Parameters: sSessionID, sStartDate, sEndDate
Results Notes:
Example: https://oxbranch.optionsxpress.com/accountservice/account.asmx/GetCustOrders?sSessionID=81548B5916A244DEA0546D479EA6F7BB&sStartDate=09/15/2004&sEndDate=09/22/2004
Service: GetCustActivity
Explanation: Returns the customer activity for the given time period
Parameters: sSessionID, datStartDate, datEndDate
Results Notes:
See the transaction id-transaction description table at the end of the document.
Example: https://oxbranch.optionsxpress.com/accountservice/account.asmx/GetCustActivity?sSessionID=81548B5916A244DEA0546D479EA6F7BB&datStartDate=09/15/2004&datEndDate=09/22/2004
Future Service: GetCustContingentOrders
Explanation: Returns the customer orders for the given time period
Parameters: sSessionID, sStartDate, sEndDate
Results Notes:
Example: https://oxbranch.optionsxpress.com/accountservice/account.asmx/GetCustContingentOrders?sSessionID=81548B5916A244DEA0546D479EA6F7BB&sStartDate=09/15/2004&sEndDate=09/22/2004
Trade
Service: GetGenericQuote
Explanation: Returns quote information about a stock or option (in the future it will allow other quotes such as mutual funds and single stock futures)
Parameters: sSessionID, sSymbol, sSecurityType(this argument will be used in the future), sForceDelayed
Results Notes: Without a session the quotes are delayed. Quotes are also delayed for accounts that do not have real time quotes. <sQuoteType> indicates if the quotes are real time or delayed
Example: https://oxbranch.optionsxpress.com/accountservice/order.asmx/GetGenericQuote?sSessionID=81548B5916A244DEA0546D479EA6F7BB&sSymbol=TLAB&sSecurityType=
Service: PlaceStockOrder
Explanation: Places a stock order for the given account
Parameters: sSessionID, sSymbol, sAction, dQty, sTIF, bAON, sOrderType, dLimitPrice, dStopPrice Results Notes: Returns the order id <lOrderID> (with value>0) or an error message <sError>
Example: https://oxbranch.optionsxpress.com/accountservice/order.asmx/PlaceStockOrder?sSessionID=81548B5916A244DEA0546D479EA6F7BB&sSymbol=TLABS&sAction=BUY&dQty=56&sTIF=day&bAON=false&sOrderType=LIMIT&dLimitPrice=0.5&dStopPrice=0
Service: PlaceStockOrderWithRoute
Explanation: Places a stock order for the given account with a route destination
Parameters: sSessionID, sSymbol, sAction, dQty, sTIF, bAON, sOrderType, dLimitPrice, dStopPrice, sRoute
Results Notes: Returns the order id <lOrderID> (with value>0) or an error message <sError>
Example: https://oxbranch.optionsxpress.com/accountservice/order.asmx/PlaceStockOrder?sSessionID=81548B5916A244DEA0546D479EA6F7BB&sSymbol=TLABS&sAction=BUY&dQty=56&sTIF=day&bAON=false&sOrderType=LIMIT&dLimitPrice=0.5&dStopPrice=0&sRoute=ARCA
Service: PlaceContingentStockOrder
Explanation: Places a stock order contingent on conditions given
Parameters: sSessionID, sSymbol, sAction, dQty, sTIF, bAON, sOrderType, dLimitPrice, dStopPrice, sContingentSymbol, sContingentDirection, dContingentPrice, sContingentTrigger, sContingentTIF, bContingentTime, sContingentBeginTime, sContingentEndTime, dBufferedLimit
Results Notes: Returns the order id <lOrderID> (with value>0) or an error message <sError>
Example:
https://oxbranch.optionsxpress.com/accountservice/order.asmx/PlaceContingentStockOrder?sSessionID=81548B5916A244DEA0546D479EA6F7BB&sSymbol=CSCO&sAction=Buy&dQty=100&sTIF=day&bAON=True&sOrderType=LIMIT&dLimitPrice=2&dStopPrice=0&sContingentSymbol=MSFT&sContingentDirection=greater&dContingentPrice=99&sContingentTrigger=bid&sContingentTIF=GTC&bContingentTime=True&sContingentBeginTime=09:30&sContingentEndTime=16:00&dBufferedLimit=0
Service: PlaceTrailingStopStockOrder
Explanation: Places a trailing stop stock order
Parameters: sSessionID, sSymbol, sAction, dQty, sTIF, bAON, sOrderType, dLimitPrice, dStopPrice, sTrailSymbol, sTrailDirection, dTrailAmount,sTrailType, sTrailTrigger, sTrailTIF, bTrailTime, sTrailBeginTime, sTrailEndTime, dBufferedLimit
Results Notes: Returns the order id <lOrderID> (with value>0) or an error message <sError>
Example:
https://oxbranch.optionsxpress.com/accountservice/order.asmx/PlaceTrailingStopStockOrder?sSessionID=6A20C95C2D004536AC28EFC32A3374A6&sSymbol=XMSR&sAction=Buy&dQty=23&sTIF=DAY&bAON=FALSE&sOrderType=MKT&dLimitPrice=0&dStopPrice=0&sTrailSymbol=T&sTrailDirection=up&dTrailAmount=4&sTrailType=POINT&sTrailTrigger=ask&sTrailTIF=GTC&bTrailTime=True&sTrailBeginTime=09:30&sTrailEndTime=16:00&dBufferedLimit=0
Service: PlaceExtendedHoursOrder
Explanation: Places a stock order to be traded during the "extended hours" period
Parameters: sSessionID, sSymbol, sAction, dQty, dLimitPrice
Results Notes: Returns the order id <lOrderID> (with value>0) or an error message <sError>
Example: https://oxbranch.optionsxpress.com/accountservice/order.asmx/PlaceExtendedHoursOrder?sSessionID=6A20C95C2D004536AC28EFC32A3374A6&sSymbol=csco&sAction=buy&dQty=17&dLimitPrice=12.3
Service: PlaceStockOrderWithoutCheck
Explanation: This service is the same as PlaceStockOrderWithRoute. However, it does not enforce the need to place a BTOC order on short stock. i.e. it allows a buy on a short position.
Service: PlaceOptionOrder
Explanation: Places an option order for the given account
Parameters: sSessionID, sSymbol, sAction, dQty, sTIF, bAON, sOrderType, dLimitPrice, dStopPrice Results Notes: Returns the order id <lOrderID> (with value>0) or an error message <sError>
Example:
https://oxbranch.optionsxpress.com/accountservice/order.asmx/PlaceOptionOrderWithRoute?sSessionID=6A20C95C2D004536AC28EFC32A3374A6&sSymbol=.RCVGC&sAction=BTO&dQty=7&sTIF=day&bAON=False&sOrderType=LIMIT&dLimitPrice=0.05&dStopPrice=0
Service: PlaceOptionOrderWithRoute
Explanation: Places an option order for the given account and directs it to the given exchange (route)
Parameters: sSessionID, sSymbol, sAction, dQty, sTIF, bAON, sOrderType, dLimitPrice, dStopPrice,sRoute Results Notes: Returns the order id <lOrderID> (with value>0) or an error message <sError>
Example:
https://oxbranch.optionsxpress.com/accountservice/order.asmx/PlaceOptionOrderWithRoute?sSessionID=6A20C95C2D004536AC28EFC32A3374A6&sSymbol=.RCVGC&sAction=BTO&dQty=7&sTIF=day&bAON=False&sOrderType=LIMIT&dLimitPrice=0.05&dStopPrice=0&sRoute=CBOE
Service: PlaceContingentOptionOrder
Explanation: Places an option order contingent on conditions given
Parameters: sSessionID, sSymbol, sAction, dQty, sTIF, bAON, sOrderType, dLimitPrice, dStopPrice, sContingentSymbol, sContingentDirection, dContingentPrice, sContingentTrigger, sContingentTIF, bContingentTime, sContingentBeginTime, sContingentEndTime, dBufferedLimit
Results Notes: Returns the order id <lOrderID> (with value>0) or an error message <sError>
Example:
https://oxbranch.optionsxpress.com/accountservice/order.asmx/PlaceContingentOptionOrder?sSessionID=6A20C95C2D004536AC28EFC32A3374A6&sSymbol=.RCVLB&sAction=BTO&dQty=7&sTIF=DAY&bAON=FALSE&sOrderType=LIMIT&dLimitPrice=2&dStopPrice=0&sContingentSymbol=RHAT&sContingentDirection=less&dContingentPrice=1&sContingentTrigger=bid&sContingentTIF=GTC&bContingentTime=True&sContingentBeginTime=10:00&sContingentEndTime=15:30&dBufferedLimit=0
Service: PlaceTrailingStopOptionOrder
Explanation: Places a trailing stop option order
Parameters: sSessionID, sSymbol, sAction, dQty, sTIF, bAON, sOrderType, dLimitPrice, dStopPrice, sTrailSymbol, sTrailDirection, dTrailAmount,sTrailType, sTrailTrigger, sTrailTIF, bTrailTime, sTrailBeginTime, sTrailEndTime, dBufferedLimit
Results Notes: Returns the order id <lOrderID> (with value>0) or an error message <sError>
Example:
https://oxbranch.optionsxpress.com/accountservice/order.asmx/PlaceTrailingStopOptionOrder?sSessionID=6A20C95C2D004536AC28EFC32A3374A6&sSymbol=.rcvsd&sAction=BTO&dQty=7&sTIF=DAY&bAON=FALSE&sOrderType=LIMIT&dLimitPrice=0.2&dStopPrice=0&sTrailSymbol=IBM&sTrailDirection=down&dTrailAmount=6&sTrailType=POINT&sTrailTrigger=ask&sTrailTIF=GTC&bTrailTime=True&sTrailBeginTime=12:00&sTrailEndTime=14:00&dBufferedLimit=0
Service: PlaceSpreadOrder (to be deprecated, use PlaceMultiLegOrder instead)
Explanation: Places a 2 legged option order for the given account (combo, spread, straddle, or strangle)
Parameters: sSessionID, sSymbol(2), sAction(2), dQty(2), sTIF, sOrderType, dLimitPrice, dStopPrice
Note: for the parameters we need to pass 2 symbols, 2 actions and 2 quantities (one per leg)
Results Notes: Returns the spread id <lOrderID> (with value>0) or an error message <sError>
Example:
https://oxbranch.optionsxpress.com/accountservice/Order.asmx/PlaceSpreadOrder?sSessionID=2856859C0290468284F030CFD863D739&sSymbol=.QAVBP&sSymbol=.QAVBR&sAction=bto&sAction=sto&dQty=1&dQty=1&sTIF=day&sOrderType=debit&dLimitPrice=1
Service: PlaceMultiLegOrder
Explanation: This is the preferred service to place any trade with 2 or more legs: combo, spread, straddle, strange, covered_call, protective_put, butterflies, collars or combos.
Parameters: sSessionID, sSymbol(n), sAction(n), dQty(n), sTIF, sOrderType, dLimitPrice, dStopPrice
Notes: for the parameters we need to pass n symbols, n actions and n quantities (one per leg). In general n=2 except for collars (n=3), butterflies (n=3) and condors (n=4).
For trades that have mixed stocks and options (i.e. covered calls, protective puts and collars), the first leg always has to be the stock.
Results Notes: Returns the spread id <lOrderID> (with value>0) or an error message <sError>
Examples:
https://oxbranch.optionsxpress.com/accountservice/Order.asmx/PlaceMultiLegOrder?sSessionID=1387AF0949C24E03AD71275451ED78AC&sSymbol=.qavlz&sSymbol=.qavle&sAction=bto&sAction=sto&dQty=2&dQty=2&sTIF=day&sOrderType=debit&dLimitPrice=0.05&sStrategyType=SPREAD
https://oxbranch.optionsxpress.com/accountservice/Order.asmx/PlaceMultiLegOrder?sSessionID=BFFF2E117E8E4241B08EB6A0A303981F&sSymbol=.rcvuv&sSymbol=.rcvuw&sSymbol=.rcvux&sAction=bto&sAction=sto&sAction=bto&dQty=1&dQty=2&dQty=1&sTIF=day&sOrderType=debit&dLimitPrice=0.05&sStrategyType=BUTTERFLY
https://oxbranch.optionsxpress.com/accountservice/Order.asmx/PlaceMultiLegOrder?sSessionID=1387AF0949C24E03AD71275451ED78AC&sSymbol=rhat&sSymbol=.rcvjc&sAction=buy&sAction=sto&dQty=100&dQty=1&sTIF=day&sOrderType=debit&dLimitPrice=0.05&sStrategyType=COVERED_CALL
https://oxbranch.optionsxpress.com/accountservice/Order.asmx/PlaceMultiLegOrder?sSessionID=707C7553740D4A699F367AF2BBFF00A2&sSymbol=.teqia&sSymbol=.teqiu&sSymbol=.tequv&sSymbol=.tequc&sAction=bto&sAction=sto&sAction=sto&sAction=bto&dQty=3&dQty=3&dQty=3&dQty=3&sTIF=day&sOrderType=MKT&dLimitPrice=0&sStrategyType=CONDOR
Service: CancelSingleOrder
Explanation: Cancels a 1 legged order (i.e. stock or option)
Parameters: sSessionID, lOrderID
Results Notes:
Example:
Service: CancelReplaceSingleOrder
Explanation: Allows to modify an existing single legged order
Parameters: sSessionID, lOrderID, dQty, sTIF, bAON, sOrderType, dLimitPrice, dStopPrice
Results Notes:
Example:
Service: CancelComboOrder
Explanation: Cancels a spread or multi-legged order
Parameters: sSessionID, lComboID
Results Notes:
Example:
Service: CancelReplaceComboOrder
Explanation: Allows to modify a 2-legged option order
Parameters: sSessionID, lComboID,dLimitPrice, sTIF
Results Notes:
Example:
Tools
Service: GetOptionDragon
Explanation: Returns the desired drago query
Parameters: sPageID
Parameter Explanation
sSessionID: A valid OptionsXpress session that can be obtained using the GetOxSession or GetOxSessionWithSource services.
sUserName: The username to be validated with the corresponding password. Must be a valid OptionsXpress username
sPassword: The password for the corresponding username
sSource: The XML client used
sForceDelayed: When set to TRUE, the quotes returned will be delayed regardless of the account type. Note: the session still needs to be a valid session.
sStartDate: The start date for the query. The format should be MM/DD/YYYY, ie. 02/23/2004
datStartDate: Same as sStartDate
sEndDate: The end date for the query. The format should be MM/DD/YYYY, ie. 02/23/2004
datEndDate: Same as sEndDate
sSymbol: Any valid stock or option symbol (e.g. MSFT, .CYQGH). Must be an option or have length 1 to 6 characters.
sSecurityType: Future parameter, for now leave empty.
sAction: The transaction type
For Options:
a. BTO – Buy to Open
b. STO – Sell to Open
c. BTC – Buy to Close
d. STC – Sell to Close
For Stocks:
e. BUY – Buy
f. SELL – Sell
g. SHRT – Sell Short
h. BTOC - Buy to cover
dQty: The quantity or quantities of stock/options for the order. Must be a valid integer.
sTIF: (Time In Force) The duration of the order
a. DAY – Day Order
b. GTC – Good Until Cancelled
bAON:(All Or Nothing).
a. True
b. False
sOrderType:
For Stock and Options use
a. MKT or MARKET = Market Order
b. LMT or LIMIT = Limit Order
c. STP or STOP = Stop Order
d. STP_LMT or STOP_LIMIT = Stop Limit Order
e. MKT_CLOSE = Market on Close
For multi leg orders/spreads
f. MKT or MARKET = Market Order
g. EVN or EVEN = Even trade
h. DEBIT = A debit order
i. CREDIT = A credit order
For contingents/trailing stops in addition we can get an order type of
j. BFL = Buffered Limit
For b, d, h and i the limit price must be greater than 0
For c and d the stop price must be greater than 0
dLimitPrice: A valid positive float value. The value can be 0 except as determined by the OrderType
dStopPrice: A valid positive float value. The value can be 0 except as determined by the OrderType
sRoute(stock): The destination route for the stock: ARCA (any other value will use the default routing)
sRoute(options):The destination exchange
a. NBBO = National best bid or offer
b. CBOE or RAZ
c. AMEX or AMO
d. PSE or POE
e. PHLX or ATM
f. ISE
g. BOX
sContingentSymbol/sTrailSymbol:The symbol on which the contingent rules apply. Valid values are the same as those for sSymbol.
sContingentDirection:
a. greater
b. less
sTrailDirection:
a. up
b. down
dContingentPrice: any value greater than 0
dTrailAmount: any value greater than 0
sTrailType: Determines if the amount is a percentage or absolute points.
a.Point
b.Percent
sContingentTrigger/sTrailTrigger:
a. std - Standard
b. bid
c. ask
d. last
sContingentTIF/sTrailTIF: Same rules as sTIF
bContingentTime/bTrailTime: A boolean value that determines if we use the contingent/trail range times (sContingentBeginTime-sContingentEndTime/ sTrailBeginTime-sTrailEndTime)
a. True
b. False
sContingentBeginTime/sTrailBeginTime: Should be 5 characters eastern time in the form xx:xx.
For example 10:30, 14:30, etc. Begin Time most be prior to end time and in the range 09:30 to 16:15
sContingentEndTime/sTrailEndTime: Same rules as sContingentBeginTime
dBufferedLimit: Any positive value. Used for Order Type of BFL. It determines the buffer limit.
sStrategyType:
a. COVERED_CALL
b. SPREAD
c. STRADDLE
d. BUTTERFLY
e. COLLAR
f. CONDOR
g. COMBO
h. PROTECTIVE_PUT
Parameters for cancel and modify orders
lOrderID: The valid order id to be cancelled / modified
lComboID: The valid spread id of a multi-legged order to be cancelled
To Modify a multi-legged order you can cancel the existing order and place a new one (in the future we will provide modify functionality).
Result Parameters
GetCustActivity returns a TransactionType and TransactionTypeDescr. Here are the possible values:
1 Money Transfer
2 Dividends
3 I.R.
4 Pay Checks
5 Option Trade
6 Stock Trade
7 A=Commission Adjustment
8 C=Cash Record
9 D=Dividend Record (long positions)
10 E=Dividend Record (short positions)
11 F=Cash and Receive/Delivery Record
12 H=Security Master Record
13 J=Receive/Delivery Records-Location
14 K=Receive/Delivery Records-Location
15 O=Open Order Record
16 R=Receive/Deliver Record
17 S=Receive/Delivery Record-Location
18 T=Trade Record
19 U=Split or TTO Commission Records
20 Money Market Sweep
21 Spread Trade
22 Covered Call Trade
23 Straddle Trade
24 Deposit
25 Commission Adjustment
26 Wire Transfer
27 Balance Adjustment
28 Mutual Fund Trade
29 Bond Trade
30 PositionAdjustment
31 Collar Trade
32 Butterfly Trade
33 Interest
34 Condor Trade
35 Combo Trade
36 Held Funds
37 Protective Put Trade
38 SSF Trade
39 Investment Club Deposit
40 Investment Club Withdrawal
41 Assignment
42 Exercise
43 Busting - ReBuild Trade
44 Busted - Canceled Trade
45 ACAT
46 ACH Direct Deposit
47 ACH Direct WithDrawal
48 Wire Deposit
49 Wire Withdrawal
50 Check WithDrawal
51 Funds Received
52 Dividend ReInvest
No comments:
Post a Comment