PureBytes Links
Trading Reference Links
|
Hello,
A new version of IBController 1.0.8 automatic
trading interface for AmiBroker has been released.
Documentation & download:
Direct download link:
PLEASE READ ENTIRE DOCUMENTATION BEFORE
DOWNLOADING.
CHANGES FOR VERSION
1.0.8
- GetStatus() function now has optional parameter InclFilled
GetStatus(
string OrderId, [optional] boolean InclFilled )
when InclFilled is
provided and set to true GetStatus function provides statuses for filled,
cancelled and error orders that may have been already deleted from pending
list.
- TimeInForce field in PlaceOrder/ModifyOrder allows now to specify "Good
Till Date" and "Good After Time" date/times)
TimeInForce field in
PlaceOrder/ModifyOrder accepts GTD and GAT specifications
GTD - Good
Till Date - indicates that the order should remain workign untilthe time and
date set.
Good Till Date specification GTD YYYYMMDD HH:MM:SS
TZONE
where: YYYY is 4 digit year, MM is 2 digit month, DD is 2
digit day, HH is 2 digit hour, MM is 2 digit minute, SS is 2 digit second
(OPTIONAL), TZONE is time zone (OPTIONAL)
After regular TimeInForce
specifications (DAY, GTC, GTD) you may add extraGoodAfterTime (GAT) part. GAT
part comes AFTER semicolon. It indicates thattrade should be submitted after
the time and date set:
GAT specifications: DAY;GAT YYYYMMDD HH:MM:SS
TZONE - day order valid after specified date/time GTC;GAT YYYYMMDD HH:MM:SS
TZONE - good till canceled order valid after specified time GTD yyyymmdd
hh:mm:ss tzone;GAT YYYYYMMDD HH:MM:SS TZONE - GTD order valid after specified
time
where: YYYY is 4 digit year, MM is 2 digit month, DD is 2 digit
day, HH is 2 digit hour, MM is 2 digit minute, SS is 2 digit second
(OPTIONAL), TZONE is time zone (OPTIONAL)
Note: there must be NO SPACE
characted between semicolon and GAT
string.
Examples:
ibc.PlaceOrder("MSFT", "BUY",
100, "LMT", 27, 0, "DAY;GAT 20051214 18:00:00 GMT",
True
); - day limit order good after Dec 14,2005, 18:00
GMT
ibc.PlaceOrder("MSFT", "BUY", 100, "LMT", 27, 0, "GTD
20051215 17:00:00 GMT;GAT 20051214 18:00:00 GMT",
True
); - limit order valid from Dec 14,2005 18:00 to Dec 15,2005
17:00 GMT
ibc.PlaceOrder("MSFT", "BUY", 100, "LMT", 27, 0, "GTD
20051215 19:00:00 GMT", True ); -
limit order valid from now until Dec 15,2005 19:00 GMT
- Portfolio page should now display correct exchange for futures (now it
uses reqContractDetails to query for exchange string that is not sent via
accountUpdates by TWS)
- new Transmit( orderID ) method
Transmit( string orderid )- returns
non-zero (true) when orderid has been found on the pending order listand zero
otherwise. It does not necesarily mean that transmit was
successful.
Transmit( orderid) is used to transmit orders previously
placed with transmit flag set to false. Transmit internally is handled by
calling "modify order" function (so you don't need to specify the same
parameters again) but note that TWS has problems with handling modify requests
coming too quickly, so you will NOT be able to call modify/transmit
immediatelly after placing order with transmit = false.In such cases we
recommend using manual trigger that is slow enough not to cause
problems.
- GetPositionList() method added - returns comma separated list of currently
open positions
Example:
list of open positions and their
sizes
ibc = GetTradingInterface("IB");
openpos =
ibc.GetPositionList();
for( i = 0; ( symbol = StrExtract( openpos, i ) ) !=
""; i++ ) {
printf("Position " + i + "\tSymbol: " + symbol + "\tSize: " + ibc.GetPositionSize( symbol ) + "\n" ); }
- GetPendingList( Type, Filter ) - retrieves comma-separated list of orders
from pending list
where: Type - specifies what should be returned 0
- gives ORDERIDs, 1 gives symbol lists Filter - when not empty it tells IBc
that only orders with specified status should be returned when empty - all
orders from pending list are returned.
For example:
symbols = ibc.GetPendingList( 0, "Pending" ); -
returns comma separated list of pending order IDs
symbols = ibc.GetPendingList( 1, "Pending" ); -
returns comma separated list of SYMBOLS that have pending
orders
symbols = ibc.GetPendingList(
0, "Error" ); - returns
list of orderids that have errors
symbols =
ibc.GetPendingList( 0,
"Cancelled"
); - returns cancelled orderids (please keep in mind that
cancelled order are automatically removed from the list after few
seconds)
symbols = ibc.GetPendingList(
0, "" ); - returns list
of all orderIDs present in the "pending list" (may be
pending/error/cancelled/partially filled/submitted, etc)
- added experimental Sleep() method
Sleep( [number] Milliseconds
)
- suspends the execution for specified number of milliseconds.Please
do NOT use this function unless you really have to, because it locksboth
IBController and AmiBroker for specified period of time and both
applicationswon't respond to user actions (such as mouse/keyboard input). If
you suspendexecution for more than few seconds AmiBroker will complain about
OLE server not responding.
- added CloseAllOpenPositons(), CancelAllPendingOrders methods and Panic
button
CloseAllOpenPositions() method - sends MARKET SELL/BUY order for
each and every LONG/SHORT position in the portfolio page - should effectively
close all open positions (provided that closing orders will fill correctly),
note however that it may happen that these closing orders may fail (for
example when markets are closed)
CancelAllPendingOrders - sends cancel
for each and every order displayed in the Pending orders page (with the
exception of orders with Errors)
Panic button in the toolbar - sends
CancelAllPendingOrders() and then CloseAllOpenPositions()
- Bracket orders support. PlaceOrder and ModifyOrder methods have two
additional optional parameters: Attributes and ParentID
PlaceOrder(
string Ticker, string Action, number Quantity, string Type, number LimitPrice,
number StopPrice, string TimeInForce, bool Transmit, [optional] number
TickSize = 100, [optional] string Attributes = "", [optional] string ParentID
= ""
- Attributes - is a string that allows to specify
additional order attributes (comma separated list).
Supported
attributes: rthOnly - if specified means that the order will only be
_filled_ during RTH; this applies to any order type including limit.
ignoreRth - if specified means that order will trigger not only during
Regular Trading Hours (RTH), but also in extended trading (pre/after
market); this applies to stop orders, conditional orders, and alerts; it is
used by the triggering logic. If not specified (false) orders will trigger
ONLY during RTH.
allOrNone - fill all or nothing at all
eTradeOnly - trade with electronic quotes only firmQuoteOnly - trade
with firm quotes only
By default all those flags are INACTIVE (OFF)
Example:
ibc.PlaceOrder("MSFT", "BUY", 1000, "LMT", 27, 0, "GTD
20051215 19:00:00 GMT", True, 100, "allOrNone,rthOnly" );
(Note that optional parameter TickSize MUST be specified if you want to
use Attributes)
- ParentID - is a string that specifies parent order
identifier (returned by previous PlaceOrder call)
allowing you to place
BRACKET orders.
Example:
parentID = ibc.PlaceOrder("MSFT", "BUY", 1000, "LMT", 27, 0, "DAY", True );
ibc.PlaceOrder("MSFT", "SELL", 1000,
"LMT", 28, 0, "GTC", True, 100, "", parentID );
ibc.PlaceOrder("MSFT", "SELL", 1000,
"STP", 0, 26, "GTC", True, 100, "", parentID
);
Best regards, Tomasz
Janeczko amibroker.com
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
SPONSORED LINKS
YAHOO! GROUPS LINKS
|