PTL Trader Manual
PTL Trader is a proprietary automated trading system solution for pair trading. See more information here. You can use it to execute your pair trading strategy portfolios you have built using the Pair Trading Lab website Portfolio Manager.
- Windows OS compatible with Java 7 (or newer) is required
- 32-bit Java 7 (1.7) or newer is required. The installer checks this. 64-bit Java is not supported at this moment, but it will be at some point.
- PTL Trader requires Interactive Brokers TWS or IB Gateway, providing an API access. Server IB API version 66 or newer is required.
PTL Trader and Portfolio Manager are only available to Premium Members.
Installation & Setup
In order to use PTL Trader application, you must obtain PTL Trader API keys first. They are used to authenticate the application running at your side against our server, so the application is able to retrieve your portfolio and settings and send back your trading stats (unless confidential mode is used). There are two keys needed - the Access Key and the Secret Key
Steps to do:
- Go to the Pair Trading Lab website and login to your account
- Go to Menu -> PTL Trader -> Setup & Download (if you don't see this, you are not a Premium Member or your membership has expired) (see the screenshot)
- If you don't have API access keys yes, you will see a button Generate PTL Trader keys for me now. Press it, it will generate your keys and setup your PTL Trader access immediately
- When you already have API keys generated, you can see your Access Key already. In order to see your Secret Key press the link saying "click here to see my Secret Key".
- Now, you can download the PTL Trader MSI installer by clicking the button Download PTL Trader. You download should start.
- Check software requirements above
- Run the installer to install the PTL Trader application. The installer checks the Java version, so it won't allow you to install if you don't have Java or if it is outdated
- Run PTL Trader from your start menu
- Go to the Settings tab and fill in your access keys. By pressing Connect button it should authenticate and connect to our website and download your portfolios you created in Portfolio Manager
- Start IB Trading Workstation or IB gateway, enable socket-base API access in settings
- In PTL Trader settings, check the IB ABI Client Id and Port if matches what you need. Client Id can be 1 if PTL Trader is the only application connecting to your API. Default port numbers are 7496 for TWS connection and 4001 for IB Gateway connection.
- Press Connect. It should connect to your IB API now.
- You are ready now to setup your portfolios and account bindings.
Firewall Remark: PTL Trader communicates with PTL server using two TCP ports - 443 (https) and 5671 (amqps). If you use a firewall, please make sure that outbound connections are enabled for these ports, otherwise PTL Trader will not work!
Multiple Instances & Autostart
PTL Trader supports running in multiple instances on the same machine, but each instance must run under a different configuration profile and must connect to different IB account. The default configuration profile name is default, which is used when no command line arguments are used. If you want to start the application using different profile, you have to manually specify the profile in command line arguments. Argument syntax is this:
<profile name> [autostart]
If autostart is specified, PTL Trader will automatically connect to both Pair Trading Lab site and IB account, as long all credentials are already configured in the Settings panel. You can use autostart feature e.g. for automatic system start after your VPS reboots. Please note that the autostart is always the second argument, so if you want to use autostart with default profile, command line arguments will look like this:
Good practice is to create file shortcuts, where you can specify command line arguments directly like on the screenshot on the right. PTL Trader installation comes with two default application shortcuts:
- PTL Trader - profile: default, no autostart
- PTL Trader (second instance) - profile: secondary, no autostart
For instance, you can use the first one for regular trading, the second one for paper trading. You can of course edit those default shortcuts yourself, e.g. to enable autostart feature.
Again - you need to worry about profiles only if you use two or more PTL Trader instances on the same computer. If you run them on different machines, you can stick with default profile.
Remark: if you run multiple instances on the same computer, each instance must connect to a different IB TWS/Gateway instance!
By default, PTL Trader is sending the complete trade history and samples of account equity and position open profit/loss to the Pair Trading Lab. It is stored there inside your account to be used by Reporting feature which will be developed soon, so users will be able to create advanced reports of pair trading strategy performance. Although we guarantee we never disclose any of that data to any 3rd side and we try to maintain as highest level of security as possible, we fully understand this may still be a concern for same users.
So if you really won't want to disclose your trading results and account equities to our side, you can use the Confidential Mode. While enabled, your sensitive data never leaves the PTL Trader application and your computer. However, there are certain implied limitations:
- you will not be able to use the Reporting feature in the future (there are no data to builds reports on)
- whenever you restart PTL Trader, you trading history is gone
Confidential Mode can be enabled in the Setting tab.
The purpose of PTL Trader is to allow you to execute portfolios of pair trading strategies in real-time. Those portfolios are not defined in PTL Trader itself - they are stored on the Pair Trading Lab website under your account. You manage your strategy portfolios using the Portfolio Manager application which is available from the menu as long you log in and as long you are a Premium Member.
Portfolio is just a group of pair trading strategies. You can imagine situation like this:
- Portfolio: Live Portfolio
- MSFT-AAPL, Ratio Model, MA Period: 15, StdDev Period: 15, ...
- MA-V, Ratio Model, MA Period: 25, StdDev Period: 25, ...
- KO-PEP, Residual Model, Linreg Period: 30, ...
- F-GM, Residual Model, Linreg Period: 35, Entry Threshold: 1.5, ...
- Portfolio: Paper Portfolio
- GLD-GDX, Residual Model, Linreg Period: 30, ...
- SPY-QQQ, Ratio Model, MA Period: 15, StdDev Period: 15, ...
- Portfolio: Another portfolio
- INTC-AMD, Ratio Model, MA Period: 15, StdDev Period: 15, ...
PTL Trader has then an access to you portfolios and loads them from your PTL Trader account. Then you can bind particular portfolio to your IB account and start the autotrading of all pair strategies. There is no way to define portfolios or strategies inside PTL Trader - you have to manage them at the website. There is some limited management functionality on PTL Trader though - you can delete strategies and edit some portfolio and strategy properties also from the PTL Trader side. On the contrary - as long you bind portfolio to the account, you cannot edit any properties or components from the website.
So the important part again: you can define as many portfolios and strategies you wish. You do this on the website using the Portfolio Manager. Later, you will be able to perform more operations with portfolios on the website, e.g. backtesting whole portfolios, but this is not there yet. The only purpose of the Portfolio Manager at this moment is to define portfolios for PTL Trader. There will be more features later.
In order to auto-trade the portfolio, you have to bind it to the IB account. You do this in the PTL Trader:
- start PTL Trader and connect to both PTL and IB API
- portfolio list will appear in the left section
- click on the portfolio you want to bind
- in the right side, go to the Settings tab
- you can see the Bind to account section with select and Bind button
- select the IB account you want to trade with and press the Bind button
- after confirmation, the portfolio will bind to the account you selected and the automated trading will start right away
Beware: trading may start immediately after you bind the portfolio to an account!