Category Archives: TWSLink

New recommended Interactive Brokers Traders Workstation Version (TWS 972)

Please apologize.  With our recommendation we switch back to this version.  Portfolio data are reported correctly.


User having higher verison and no problem should stick with those verison.


The version 972 has the advantage that it can be kept running using IBController (and IBStarter, a gui for IBController).


Download recommended Trader Workstation (version 972)


Download IB Gateway recommended (version 972)


Order increases leveraged FX position

When using software which works with an Interactive Brokers account, non USA traders may receive this order rejection notice:

Order increases leveraged FX position


The reason for this is may an insufficient margin.  You can try to solve this by logging into Account Management and request cash forex (leveraged forex) permissions.

Perl 5 x64 wrapper for TWSLink

Python 5 x64 wrapper for TWSLink along with Visual Studio wrapper solution and sample

  • 64 bit twslink2pl.dll and included.
  • Visual Studion 2017 solution file included: This is to create your own twslink2 wrapper for other perl versions.
  • Includes also a small sample in the test folder of download.


When the TWSLink2 interfaces should change, which is unlikely, or a new Perl version is out which you want to use, you may want to have a new TWSLink2 wrapper,
so you can call TWSLink from within Perl. In order to build your own wrapper, you need some tools:

The Visual Studio project for this perl wrapper, assumes that swig is in c:\swig. Details about building the wrapper are in the readme.txt of download.

Note: With swig, Visual Studio and TWSLink2 wrapper cpp files (contained in download), you can build wrapper for ANY LANGUAGE contained in the swig world. Just watch the samples in the swig project, to get an idea and use the Perl wrapper Visual Studio project as draft.

View sample code

# --- including libs ---
# twslink module
use twslink2pl;
# module to modify console
#use Win32::Console;

# ----- Object creation -----
print "creating twslink wrapper:\n";
$tws = new twslink2pl::TWSLink2Wrap("",1);
#print "creating console:\n";
#$console = new Win32::Console;

my $stime=gmtime();
print "start time=$stime\n";

print "Connecting . . . \n" ;
$status = $tws->CONNECT("",7496,1,6000) ;
print "Connected=$status\n";
# register a stock; wait at the most 5 seconds until contract has been accpeted by tws

print "Register MSFT\n";
my $uidMSFT = $tws->REGISTER_CONTRACT("MSFT","STK","USD","NASDAQ","","","",0.0,"",0,0.0) ;
print "uid MSFT=$uidMSFT\n";

print "Place buy market 100 MSFT\n";
my $uidOrderMSFT = $tws->PLACE_ORDER($uidMSFT,0,"BUY","MKT",100,0.0,0.0,"GTC",1,0) ;
print "uid order MSFT=$uidOrderMSFT\n";

[ddownload id=”1869″ style=”link” text=”Download TWSLink Perl 5 x64 wrapper”]

TWSLink new version

A new TWSLink version has been uploaded.

  • Bugfix: Adaptive Orders bug fixed.
  • Change: Log extended to record adaptive order attributes.


[ddownload id=”281″ style=”link” text=”Download TWSLink″]


Batch command example adaptive order for TWSLinkBaTe

int uidc=REGISTER_CONTRACT("NVDA","STK","USD","SMART","","","",0,"",0,0)
int uido=PLACE_ORDER(uidc,0,"BUY","LMT",100,186.00,0.0,"DAY",-1,0)
// set rth hours only
// set adaptive order algorithm name
// set adaptive order parameter and transmit order to IB

Download bacth file TWSLinkBaTe