Instrument factor
The factor of an instrument
The factor of an instrument is a multiplier that applies to any instrument on a market. This factor is the size of the batch of contracts a given order will buy or sell in one go.
For instance, on FTSE, the factor is ten. Therefore, when you issue a buy(1) on FTSE, your order will buy 10 FTSE contracts at once.
The factor influences the price paid per contract. For instance, if you issue a sell(1) on CAC_40 at 4,400 euros, you will sell 10 contracts at 4,400 euros, which brings you back 10 * 4,400 = 44,000 euros.
Useful methods
On any instrument, first place to look at is getFactor() method,
which returns an integer number representing the factor for that
instrument. For instance, lets say you want to know how many
contracts you are going to buy is you issue a buy(1)
in your strategy :
int factor = getInstrument().getFactor();
If you want to know how much a buy(numberOfBuy)
will cost your strategy, you can use this method:
double totalCost = getInstrument().getFactor() * bar.getClose() * numberOfBuy;
Useful informations
To get the full list of attributes for any instrument, remember that you have access to most of the source code for Market Runner. You can have a look at the Futures class, which gives you the factor, currency, tick size, and other useful information on the Futures used in Market Runner.
You can get the list of attributes in the API as well.