001 /**
002 * Copyright 2007 Mike Kroutikov.
003 *
004 * This program is free software; you can redistribute it and/or modify
005 * it under the terms of the Lesser GNU General Public License as
006 * published by the Free Software Foundation; either version 3 of
007 * the License, or (at your option) any later version.
008 *
009 * This program is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012 * Lesser GNU General Public License for more details.
013 *
014 * You should have received a copy of the Lesser GNU General Public License
015 * along with this program. If not, see <http://www.gnu.org/licenses/>.
016 */
017
018 package org.otfeed.command;
019
020 import org.otfeed.protocol.ICommand;
021
022 /**
023 * Request for the real-time (live) option chain events.
024 * <p/>
025 * Generates {@link org.otfeed.event.OTQuote quote},
026 * {@link org.otfeed.event.OTTrade trade},
027 * {@link org.otfeed.event.OTMMQuote marker-maker quote}, and
028 * {@link org.otfeed.event.OTBBO bbo} events.
029 */
030 public final class OptionChainCommand
031 extends ExchangeSymbolAndQuoteDelegateHolder implements ICommand {
032
033 /**
034 * Creates new option chain command, initializing
035 * all its properties.
036 *
037 * @param exchangeCode exchange code.
038 * @param symbolCode symbol code.
039 * @param expiration expiration.
040 * @param strike strike.
041 * @param volumeStyle volume reporting style.
042 */
043 public OptionChainCommand(String exchangeCode,
044 String symbolCode,
045 MonthAndYear expiration,
046 PriceRange strike,
047 VolumeStyleEnum volumeStyle) {
048 setExchangeCode(exchangeCode);
049 setSymbolCode(symbolCode);
050 setExpiration(expiration);
051 setStrike(strike);
052 setVolumeStyle(volumeStyle);
053 }
054
055 /**
056 * Default constructor. Initializes
057 * {@link #getExpiration expiration} property to
058 * its default value of <code>null</code> (meaning "any").
059 * Initializes {@link #getStrike strike} property to
060 * its default value of <code>null</code> (meaning "any").
061 * Initializes {@link #getVolumeStyle volumeStyle} property to
062 * its default value of {@link VolumeStyleEnum#COMPOUND COMPOUND}.
063 * All other properties must be set explicitly before using
064 * this command object.
065 */
066 public OptionChainCommand() {
067 this(null ,null, null, null, VolumeStyleEnum.COMPOUND);
068 }
069
070 /**
071 * Creates new option chain command, initializing
072 * all its properties, except <code>volumeStyle</code>,
073 * which defaults to <code>COMPOUND</code>.
074 *
075 * @param exchangeCode exchange code.
076 * @param symbolCode symbol code.
077 * @param expiration expiration.
078 * @param strike strike.
079 */
080 public OptionChainCommand(String exchangeCode,
081 String symbolCode,
082 MonthAndYear expiration,
083 PriceRange strike) {
084 this(exchangeCode, symbolCode, expiration, strike,
085 VolumeStyleEnum.COMPOUND);
086 }
087
088 private MonthAndYear expiration;
089
090 /**
091 * Option expiration date (month and year). This property is
092 * optional. Defaults to null, which is interpreted as
093 * "any expiration date".
094 *
095 * @return option expiration date.
096 */
097 public MonthAndYear getExpiration() {
098 return expiration;
099 }
100
101 /**
102 * Sets option expiration date.
103 *
104 * @param val option expiration date.
105 */
106 public void setExpiration(MonthAndYear val) {
107 expiration = val;
108 }
109
110 private PriceRange strike;
111
112 /**
113 * Price range for the option strike. This property
114 * is optional. Defaults to null, which means
115 * "any strike price".
116 *
117 * @return option strike price range.
118 */
119 public PriceRange getStrike() {
120 return strike;
121 }
122
123 /**
124 * Sets option strike price range.
125 *
126 * @param val strike price range.
127 */
128 public void setStrike(PriceRange val) {
129 strike = val;
130 }
131 }