You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-5Lines changed: 26 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
# InteractiveBrokers-Algo-System
2
2
This Java/MySQL framework implements the Interactive Brokers API for algorithmic trading. Included are all essential components to support a basic trading execution system: live price feed, handling for IB price quote limits, order tracking system, margin tracking system, handling for order submission and execution, option chain information request, and kill switches. A system based on this framework, with additional custom modules and proprietary strategies is currently being used to profitably trade US equities and equity options
3
3
- Requires either TWS or IB Gateway (desktop applications provided by IB) and IB Java API 9.71 (API library package). The API scripts initiate a live socket connection to the desktop TWS and IB Gateway application, which routes requests
4
-
- Requires US Securities Snapshot and Futures Value Bundle ($10/month), US Equity and Options Add-On Streaming Bundle ($4.95/month) for live price streams. If solely using the framework for executing orders, then these add on costs are not necessary; it is possible to use another data source for live price streams such as IEX, which is free
4
+
- Requires US Securities Snapshot and Futures Value Bundle ($10/month), US Equity and Options Add-On Streaming Bundle ($4.95/month) for live price feed. If solely using the framework for executing orders, then these add on costs are not necessary; it is possible to use another data source for live price feeds such as IEX, which is free
5
5
- It's recommended to simultaneously run price feed and solely reading processes on an IB Gateway paper trading instance (port 4002 in the example) and trade execution/other writing processes on a TWS instance (port 7496 in the example)
6
6
- API function documentation: http://interactivebrokers.github.io/tws-api/
@@ -28,25 +28,46 @@ Cash, margin and risk balance:
28
28
# Module descriptions
29
29
30
30
### SimplePriceFeed ###
31
-
Read in TickerList.csv - a presaved list of contracts to receive live price streams from. Here, a contract is defined as either a specific option, or stock
31
+
Read in TickerList.csv - a presaved list of contracts to receive live price feeds from. Here, a contract is defined as either a specific option, or stock
32
32
- TickerList.csv fields: Active (T/F) | symbol | secType | exchange | currency | expiry | strike | right | multiplier
33
33
- Output prices to the IBAlgoSystem.price MySQL table
34
34
35
35
### LargePriceFeed ###
36
-
Read in IBAlgoSystem.MasterChainList - a list of options contracts to receive live price streams from
36
+
Read in IBAlgoSystem.MasterChainList - a list of options contracts to receive live price feeds from
37
37
- The number of entries may exceed IB's feed limit (FEED_LIMIT). In that case, this script divides the entries into smaller batches to submit to IB
38
38
- Output prices to IBAlgoSystem.price MySQL table
39
39
40
40
### FetchOptionsChain ###
41
-
Read in TickerList.csv, a presaved list of contracts to receive live price streams from. Here, a contract is defined as either a specific option, or stock
41
+
Read in TickerList.csv, a presaved list of contracts to receive live price feeds from. Here, a contract is defined as either a specific option, or stock
42
42
- TickerList.csv fields: Active (T/F) | symbol | secType | exchange | currency | expiry | strike | right | multiplier
43
43
Read in PennyPilot.csv, a presaved list of Penny Pilot tickers
44
44
- Output option chain to IBAlgoSystem.MasterChainList MySQL table
45
45
46
46
### TradeStrategy ###
47
-
Template to implement trade strategies - call price stream, submit order execution requests, manage orders and risk
47
+
Template to implement trade strategies - call price feed, submit order execution requests, manage orders and risk
48
48
- Output order management to IBAlgoSystem.orderTracking MySQL table
49
49
- Output margin management to IBAlgoSystem.margin MySQL table
50
50
51
51
### KillSwitch ###
52
52
Kills all active orders
53
+
54
+
# Simple walkthrough description
55
+
56
+
### Receive price feed ###
57
+
1. Start an IB Gateway instance on port 4002 (or custom defined port number)
58
+
2. Define the contracts to receive stock and/or option price feeds for in TickerList.csv
59
+
3. Execute SimplePriceFeed to start price feeds for contracts in TickerList.csv
60
+
4. If TickerList.csv contains only stock tickers, execute FetchOptionsChain to generate the option chain for those tickers
61
+
5. Execute LargePriceFeed to start price feeds for option chains
62
+
6. Restart SimplePriceFeed or LargePriceFeed if problems occur
63
+
64
+
### Execute trade strategy ###
65
+
1. Start a TWS instance on port 7496 (or custom defined port number)
66
+
2. Execute TradeStrategy
67
+
68
+
### Trigger KillSwitch ###
69
+
In event of emergency only:
70
+
1. Terminate TradeStrategy
71
+
2. Execute KillSwitch to remove outstanding orders
72
+
73
+
Note the KillSwith does not impact SimplePriceFeed or LargePriceFeed (price feed)
0 commit comments