Page 1 of 1

What DLL functions are available in IB-Plugin?

Posted: Thu Oct 21, 2021 1:22 am
by Zebra25
Dear Sir/Madam,

We have been using TWS-Link for many years with Interactive Brokers (and TradeStation platform) to do automated futures trading.

We are considering upgrading to IB-Plugin but we need IB-Plugin to provide the same DLL functions as TWS-Link?

The TWS-Link functions we are currently using are as follows:

DefineDLLFunc: "TWSLINK2.DLL",int,"REGISTER_CONTRACT",LPSTR,LPSTR,LPSTR,LPSTR,LPSTR,LPSTR,LPSTR,double,LPSTR,int,double;

DefineDLLFunc: "TWSLINK2.DLL",int,"PLACE_ORDER",int,int,LPSTR,LPSTR,int,double,double,LPSTR,int,int;

DefineDLLFunc: "TWSLINK2.DLL",int,"SET_FA_MEMBERS",int,LPSTR,LPSTR,LPSTR,LPSTR,LPSTR,int;

DefineDLLFunc: "TWSLINK2.DLL",int,"CANCEL_ORDER",int,int,LPSTR,int,LPSTR;

DefineDLLFunc: "TWSLINK2.DLL",LPSTR,"GET_ACC_VAL",int,LPSTR,LPSTR,int;

DefineDLLFunc: "TWSLINK2.DLL",double,"GET_POSITIONS",int,LPSTR;

DefineDLLFunc: "TWSLINK2.DLL",int,"CONNECT",LPSTR,int,int,int;

DefineDLLFunc: "TWSLINK2.DLL",int,"GET_ORDER_STATUS",int;

Are the above eight (8) TWS-Link DLL functions also offered in IB-Plugin?

Look forward to your reply.

Kind regards,

Rod Fraser

Re: What DLL functions are available in IB-Plugin?

Posted: Mon Oct 25, 2021 3:31 pm
by board_admin
Best TS/MC tutorial for using IBPlugin is the video discussing example:
https://youtu.be/lH3GE_pDm48?list=PLYD3 ... dcECuxa954

Find the example attached (which is also installed along with IBPlugin)

- REGISTER_CONTRACT
no longer required. As contract id you are using the IBKR conid (unique contract id).

-PLACE_ORDER
ibgORDER_SEND (int connid, int uidc, string action, string otype,int size,double price, double stplmt,double stoploss,double takeprofit, string comment,int id_allocation)
or
ibgORDER_SEND_STR(int connid, int uidc, __int64 uid, string order_attrib_list, int id_allocation)

Note: both functions return a 64 signed integer. This could be a problem in TS/MC.
Use a double instead. In my example this seem to work.

-SET_FA_MEMBERS
int allocid=ibgCREATE_ALLOCATION (int connid, string alloc_type,string alloc_name, string alloc_method, string percentage);
Use the returned id in ibgORDER_SEND...

-CANCEL_ORDER
ibgORDER_DELETE

-GET_ACC_VAL
double __stdcall ibgACCOUNT_INFO (int connid,int idinfo, string account_list);
(mind example: make a snapshot, then cycle over values)

-GET_POSITIONS
double __stdcall ibgPORTFOLIO_INFO(int connid, int uidc, int idportval, string account_list,int aggregate_unsigned);
(mind example: make a snapshot, then cycle over values)

-CONNECT
int __stdcall ibgCONNECT (int connid,string ip,int port,int clientid, int nbr_channels,int timeout);

-GET_ORDER_STATUS
ibgORDER_STATUS