com.dxfeed.ipf.option
Class OptionChainsBuilder<T>

java.lang.Object
  extended by com.dxfeed.ipf.option.OptionChainsBuilder<T>
Type Parameters:
T - The type of option instrument instances.

public class OptionChainsBuilder<T>
extends Object

Builder class for a set of option chains grouped by product or underlying symbol.

Threads and clocks

This class is NOT thread-safe and cannot be used from multiple threads without external synchronization.


Constructor Summary
OptionChainsBuilder()
          Creates new option chains builder.
 
Method Summary
 void addOption(T option)
          Adds an option instrument to this builder.
static OptionChainsBuilder<InstrumentProfile> build(Collection<InstrumentProfile> instruments)
          Builds options chains for all options from the given collections of instrument profiles.
 Map<String,OptionChain<T>> getChains()
          Returns a view of chains created by this builder.
 void setAdditionalUnderlyings(String additionalUnderlyings)
          Changes additional underlyings for options, including additional cash.
 void setCFI(String cfi)
          Changes Classification of Financial Instruments code.
 void setExpiration(int expiration)
          Changes day id of expiration.
 void setExpirationStyle(String expirationStyle)
          Returns expiration cycle style, such as “Weeklys”, “Quarterlys”.
 void setLastTrade(int lastTrade)
          Changes day id of last trading day.
 void setMMY(String mmy)
          Changes maturity month-year as provided for corresponding FIX tag (200).
 void setMultiplier(double multiplier)
          Changes market value multiplier.
 void setOptionType(String optionType)
          Changes type of option.
 void setProduct(String product)
          Changes product for futures and options on futures (underlying asset name).
 void setSettlementStyle(String settlementStyle)
          Changes settlement price determination style, such as “Open”, “Close”.
 void setSPC(double spc)
          Changes shares per contract for options.
 void setStrike(double strike)
          Changes strike price for options.
 void setUnderlying(String underlying)
          Changes primary underlying symbol for options.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OptionChainsBuilder

public OptionChainsBuilder()
Creates new option chains builder.

Method Detail

build

public static OptionChainsBuilder<InstrumentProfile> build(Collection<InstrumentProfile> instruments)
Builds options chains for all options from the given collections of instrument profiles.

Parameters:
instruments - collection of instrument profiles.
Returns:
builder with all the options from instruments collection.

setProduct

public void setProduct(String product)
Changes product for futures and options on futures (underlying asset name). Example: “/YG”.

Parameters:
product - product for futures and options on futures (underlying asset name).

setUnderlying

public void setUnderlying(String underlying)
Changes primary underlying symbol for options. Example: “C”, “/YGM9”

Parameters:
underlying - primary underlying symbol for options.

setExpiration

public void setExpiration(int expiration)
Changes day id of expiration. Example: DayUtil.getDayIdByYearMonthDay(20090117).

Parameters:
expiration - day id of expiration.

setLastTrade

public void setLastTrade(int lastTrade)
Changes day id of last trading day. Example: DayUtil.getDayIdByYearMonthDay(20090116).

Parameters:
lastTrade - day id of last trading day.

setMultiplier

public void setMultiplier(double multiplier)
Changes market value multiplier. Example: 100, 33.2.

Parameters:
multiplier - market value multiplier.

setSPC

public void setSPC(double spc)
Changes shares per contract for options. Example: 1, 100.

Parameters:
spc - shares per contract for options.

setAdditionalUnderlyings

public void setAdditionalUnderlyings(String additionalUnderlyings)
Changes additional underlyings for options, including additional cash. It shall use following format:
     <VALUE> ::= <empty> | <LIST>
     <LIST> ::= <AU> | <AU> <semicolon> <space> <LIST>
     <AU> ::= <UNDERLYING> <space> <SPC> 
the list shall be sorted by <UNDERLYING>. Example: “SE 50”, “FIS 53; US$ 45.46”.

Parameters:
additionalUnderlyings - additional underlyings for options, including additional cash.

setMMY

public void setMMY(String mmy)
Changes maturity month-year as provided for corresponding FIX tag (200). It can use several different formats depending on data source:

Parameters:
mmy - maturity month-year as provided for corresponding FIX tag (200).

setOptionType

public void setOptionType(String optionType)
Changes type of option. It shall use one of following values:

Parameters:
optionType - type of option.

setExpirationStyle

public void setExpirationStyle(String expirationStyle)
Returns expiration cycle style, such as “Weeklys”, “Quarterlys”.

Parameters:
expirationStyle - expiration cycle style.

setSettlementStyle

public void setSettlementStyle(String settlementStyle)
Changes settlement price determination style, such as “Open”, “Close”.

Parameters:
settlementStyle - settlement price determination style.

setCFI

public void setCFI(String cfi)
Changes Classification of Financial Instruments code. It is a mandatory field as it is the only way to distinguish Call/Put option type, American/European exercise, Cash/Physical delivery. It shall use six-letter CFI code from ISO 10962 standard. It is allowed to use ‘X’ extensively and to omit trailing letters (assumed to be ‘X’). See ISO 10962 on Wikipedia. Example: “OC” for generic call, "OP" for generic put.

Parameters:
cfi - CFI code.

setStrike

public void setStrike(double strike)
Changes strike price for options. Example: 80, 22.5.

Parameters:
strike - strike price for options.

addOption

public void addOption(T option)
Adds an option instrument to this builder. Option is added to chains for the currently set product and/or underlying to the serie that corresponding to all other currently set attributes. This method is safe in the sense that is ignores illegal state of the builder. It only adds an option when all of the following conditions are met: All the attributes remain set as before after the call to this method, but chains are updated correspondingly.

Parameters:
option - option to add.

getChains

public Map<String,OptionChain<T>> getChains()
Returns a view of chains created by this builder. It updates as new options are added with addOption method.

Returns:
view of chains created by this builder.


Copyright © 2013 Devexperts. All Rights Reserved.