Synthetic spread definitions are treated as instruments. Before you can launch your synthetic spread, you first need to fetch its definition as detailed in Working with Instruments. Specifically, you follow the same steps as you would to fetch an exchange native instrument, except you:
Fetching Autospreader Spread Definitions
The following code snippet demonstrates how to fetch the list of all Autospreader spread definitions.
Once you have the instrument corresponding to your spread definition, you can subscribe for market data and route orders for these instruments by following the same steps as you would for an exchange native instrument.
Note: As Autospreader orders are filled, you will receive fill messages for each leg order as well as fill messages for the parent order. These parent fill messages will have an ExecType of ‘Trade’ and an OrdStatus of ‘PartiallyFilled’. When the Autospreader order is fully filled, you will receive a deletion event with an ExecType of ‘Canceled’ and an OrdStatus of ‘Filled’. It is done in this manner to account for possible overfill scenarios when quoting more than one leg.
Creating Autospreader Spread Definitions
You can also create new Autospreader spread definitions from scratch as follows.
Once you have created the Autospreader spread definition, you can manipulate it as demonstrated in the code snippets below.
There are methods to get/set the leg accounts. # To set the leg account by using the Account Object, use SetLegAccount(index, Account object)
Assigning Rules to a Spread
Retrieve a list of available spread rules using AutospreaderManager.GetSpreadRules(). A rule can be located in this global collection of available rules and assigned to a spread. Then the rule can be configured on a leg by leg basis.
Use the following sample code as a guide.
Setting the Account on Different Legs of the Spread
There are three (3) methods to get/set the account on the different legs of the spread:
Note: When setting the value for index, remember that the value begins with 0. So to set the account on the first leg, set index equal to 0, the second leg, index equals 1 and so on.