twsOrder: Create twsOrder Object

Description Usage Arguments Details Value Note Author(s) References See Also

Description

Create twsOrder object for placeOrder API call.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
twsOrder(orderId,
         action = "BUY", 
         totalQuantity = "10", 
         orderType = "LMT",
         lmtPrice = "0.0", 
         auxPrice = "0.0",
         tif = "",
         outsideRTH = "0",
         openClose = "O",
         origin = .twsOrderID$CUSTOMER,
         ocaGroup = "",
         account = "",
         orderRef = "",
         transmit = TRUE,
         parentId = "0",
         blockOrder = "0",
         sweepToFill = "0",
         displaySize = "0",
         triggerMethod = "0",
         hidden = "0",
         discretionaryAmt = "0.0",
         goodAfterTime = "",
         goodTillDate = "",
         faGroup = "", 
         faMethod = "",
         faPercentage = "",
         faProfile = "",
         shortSaleSlot = "0",
         designatedLocation = .twsOrderID$EMPTY_STR,
         ocaType = "0",
         rule80A = "",
         settlingFirm = "",
         clearingAccount = "",
         clearingIntent = "",
         allOrNone = "0",
         minQty = "",
         percentOffset = "",
         eTradeOnly = "0",
         firmQuoteOnly = "0",
         nbboPriceCap = "",
         auctionStrategy = "0",
         startingPrice = "",
         stockRefPrice = "",
         delta = "",
         stockRangeLower = "",
         stockRangeUpper = "",
         overridePercentageConstraints = "0",
         volatility = "",
         volatilityType = "",
         deltaNeutralOrderType = "",
         deltaNeutralAuxPrice = "",
         continuousUpdate = "0",
         referencePriceType = "",
         trailStopPrice = "",
         basisPoints = "",
         basisPointsType = "",
         scaleInitLevelSize = "",
         scaleSubsLevelSize = "",
         scalePriceIncrement = "",
         notHeld = FALSE,
         algoStrategy = "",
         algoParams = NULL,
         whatIf = FALSE,
         clientId = "",
         permId = "")

Arguments

orderId

The id for the order. Use reqIds.

action

Identifies the side. ( BUY, SELL, SSHORT )

totalQuantity

Order quantity.

orderType

Order type. ( MKT, MKTCLS, LMT, LMTCLS, PEGMKT, SCALE, STP, STPLMT, TRAIL, REL, VWAP, TRAILLIMIT )

lmtPrice

The LIMIT price for LMT, STPLMT and REL orderType

auxPrice

The STOP price for STPLMT (stop-limit) orders, and the offset for REL (relative) orders

tif

Time in force. (DAY, GTC, IOC, GTD)

outsideRTH

Allow orders to trigger outside of regular trading hours.

openClose

Specify whether order is open or close only. (Institutional Accounts Only)

origin

The order origin. 0=customer, 1=firm (Institutional Accounts Only)

ocaGroup

Identifies OCA group.

account

The account (Institutional Accounts Only)

orderRef

The order reference (Institutional Accounts Only)

transmit

Specify whether the order is transmitted to the TWS. If FALSE, order is created but not sent. (not implemented)

parentId

The orderId of the parent order, used for bracket and auto trailing stop orders.

blockOrder

ISE block order?

sweepToFill

Sweep to fill order?

displaySize

Publicly disclosed order size for Iceberg orders.

triggerMethod

How should simulated orders be triggered. Valid values are 0-8. See the official API for details.

hidden

Hide order on ISLAND?

discretionaryAmt

Amount off limit for discretionary orders.

goodAfterTime

Trades Good After Time: YYYYMMDD hh:mm:ss or ""

goodTillDate

Trades Good Till Date: YYYYMMDD hh:mm:ss or ""

faGroup

NA

faMethod

NA

faPercentage

NA

faProfile

NA

shortSaleSlot

1 or 2

designatedLocation

Only when shortSaleSlot=2

ocaType

Cancel on Fill with Block = 1 Reduce on Fill with Block = 2 Reduce on Fill without Block = 3

rule80A

Valid values: I, A, W, J, U, M, K, Y, N. See API.

settlingFirm

(Institutional Only)

clearingAccount

IBExecution customers only.

clearingIntent

IBExecution customers only.

allOrNone

yes=1, no=0

minQty

Minimum quantity order type.

percentOffset

Percent offset for REL (relative) orders.

eTradeOnly

Trade with electronic quotes. yes=1, no=0.

firmQuoteOnly

Trade with firm quotes. yes=1, no=0.

nbboPriceCap

The maximum Smart order distance from the NBBO.

auctionStrategy

BOX only. See API.

startingPrice

BOX only. See API.

stockRefPrice

The stock reference price. VOL orders. See API.

delta

BOX only. See API.

stockRangeLower

See API.

stockRangeUpper

See API.

overridePercentageConstraints

See API.

volatility

See API.

volatilityType

See API.

deltaNeutralOrderType

See API.

deltaNeutralAuxPrice

See API.

continuousUpdate

See API.

referencePriceType

See API.

trailStopPrice

For TRAILLIMIT orders only.

basisPoints

EFP orders only.

basisPointsType

EFP orders only.

scaleInitLevelSize

For Scale orders. See API.

scaleSubsLevelSize

For Scale orders. See API.

scalePriceIncrement

For Scale orders. See API.

notHeld

See API and guess.

algoStrategy

See API and guess.

algoParams

See API and guess.

whatIf

Use to request pre-trade commissions and margin information. TRUE/FALSE

clientId

Id of the client that placed the order.

permId

TWS id used to identify orders. Constant over a session.

Details

Read the API documentation, code, and experiment with the paper accounts. And good luck!

Value

Called for its side-effects.

Note

Documentation is far from complete on this topic. Experiment and share your experiences.

Author(s)

Jeffrey A. Ryan

References

Order API: http://www.interactivebrokers.com/php/apiUsersGuide/apiguide/java/order.htm

See Also

placeOrder


hadar2703/ibrokers documentation built on May 17, 2019, 9:42 a.m.