02-06-2022, 03:34 PM
IB Algos
To learn about IB Algos see this overview and their API docs.
IB Algo JSON File
First we need to define the IB Algos we want to use in a JSON file called ibAlgos.json, which should be placed in your APM account directory. Below is an example JSON file that defines two different sets of parameters for the Adaptive IB Algo. Note that we can give each set of Algo parameters whatever name we want (adaptive1 and adaptive2 in this case), but we must fill the field algo_strategy with the correct name for the IB Algo (as specified in the IB API Docs linked above). The parameters for the IB Algo (in this case adaptivePriority) must be specified as strings (and according to IB API docs).
Specifying IB Algos in Signals
To specify that an order should use an IB Algo simply add keyword ALGO followed by the name of the Algo you created. For example
To specify the IB Algo in a CSV file, use the column ALGO.
Notes
To learn about IB Algos see this overview and their API docs.
IB Algo JSON File
First we need to define the IB Algos we want to use in a JSON file called ibAlgos.json, which should be placed in your APM account directory. Below is an example JSON file that defines two different sets of parameters for the Adaptive IB Algo. Note that we can give each set of Algo parameters whatever name we want (adaptive1 and adaptive2 in this case), but we must fill the field algo_strategy with the correct name for the IB Algo (as specified in the IB API Docs linked above). The parameters for the IB Algo (in this case adaptivePriority) must be specified as strings (and according to IB API docs).
{
"adaptive1": {
"algo_strategy" : "Adaptive",
"adaptivePriority": "Patient"
},
"adaptive2": {
"algo_strategy" : "Adaptive",
"adaptivePriority": "Urgent"
}
}
Specifying IB Algos in Signals
To specify that an order should use an IB Algo simply add keyword ALGO followed by the name of the Algo you created. For example
BTO AAPL ALGO adaptive1
BTO SPY ALGO adaptive2
To specify the IB Algo in a CSV file, use the column ALGO.
Notes
- You must disconnect and then reconnect APM to reflect any changes to the IB Algo file.
- It is recommended to run some tests on a paper trading account to make sure that the orders using IB Algos are successfully placed (i.e. you should make sure the JSON file is correctly formatted and that all Algo parameters are specified)