Configuration

Configuring Underlying

The first thing to configure when you are trading options is underlying. Every option has an underlying contract which must be delivered when a derivative is exercised. Underlying is a stock, index or a future contract like S&P 200, AAPL or KOSPI 200 Index. The underlying configuration specifies its name, exchange where it’s traded, currency, tick tables, commission, etc. There are some pre-defined configurations which you can pick. Alternatively, leave the underlying blank and provide your own configuration.

Example of underlying configuration for KOSPI 200 Index:

<underlying name='K200' exchange='KSE' currency='KRW'>
        <base>
                <percentageCommission percent='0.00004' minimum='0'/>
                <midPrice/>
                <priceFormat price='0.00' theo='0.000' greeks='0.000'/>
                <tickTable>
                        <rule price="0.01" size="0.01"/>
                </tickTable>
        </base>
        <options>
                <percentageCommission percent='0.002' minimum='1000'/>
                <midPrice/>
                <priceFormat price='0.00' theo='0.000' greeks='0.000'/>
                <tickTable>
                        <rule price='0.01' size='0.01'/>
                        <rule price='3.00' size='0.05'/>
                </tickTable>
        </options>
        <riskFreeCurve rate='0.035'/>
        <dividendCurve rate='0.0'/>
</underlying>

Configuration of underlying consists of the following elements.

The tag underlying specifies the underlying contract with the following attributes.

name
The name of underlying contract. The name should match symbol name in TWS.
exchange
The exchange where the contract is trading.
currency
The currency which used to trade the contract.

Tags base and options are nested into underlying and specify contract properties - commission, algorithm for calculation of theoretical price, price format for displaying and tick table. The base tag sets base contract properties. A base contract is the contract or contracts which options are based on. Those contracts are usually used for hedging. The properties are:

Commission

Commission is modelled for simulation and back-testing purposes. AlgoEye does not charge users a commission. Commission can be either flat or percentage based.

Flat commission is configured by flatContractCommission tag which has one parameter commission. The final commission is calculated as a product of the number of contracts traded and the value of commission attribute. The following example sets commission to 10 cents per contract.

<flatContractCommission commission="0.10"/>

Percentage-based commission is configured by percentageCommission tag which has two parameters: percent and minimum. The commission is calculated as a percentage of the total value of traded contracts with a minimum value enforced by minimum attribute. The example below uses 20 basis points (0.2%) as commission with the minimum of 1000 Korean Wons.

<percentageCommission percent='0.002' minimum='1000'/>
Price Calculation
Can be either midPrice (takes mid-point of bid/ask spread) or balancedPrice (weighted volume bid/ask price).
Price Format

Sets the number of digits to display when showing price or greeks.

price
Controls the format of bid, ask and quote price.
theo
Controls the format of theoretical price calculated by price calculation algorithm.
greeks
Controls the format of the values of greeks like delta, gamma, vega, etc.
tick table

Some exchanges quote price using a single tick size which does not change. Others increase tick size with increasing price. This table sets tick size for different price levels. The example below sets a single tick size of 1 cent starting at price of 1 cent.

<tickTable>
        <rule price="0.01" size="0.01"/>
</tickTable>

The following example tells price calculation algorithms to use 1 cent tick size for prices above 1 cent but below 3 dollars and use 5 cent tick size for all price levels above 3 dollars.

<tickTable>
        <rule price='0.01' size='0.01'/>
        <rule price='3.00' size='0.05'/>
</tickTable>

The rules are scanned in the order they mentioned in the config and the last rule with the price greater than the order price is picked up.

Interest rate (risk free rate) and dividend rates are specified by riskFreeCurve and dividendCurve correspondingly. At the moment only a flat curve is supported, i.e. just an annual rate as a percentage point. The below example sets risk free rate to 2.5%.

<riskFreeCurve rate='0.025'/>