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 option chain events snapshot. Snapshot is the
024 * set of the latest events of the given type.
025 * <p/>
026 * Generates {@link org.otfeed.event.OTQuote quote},
027 * {@link org.otfeed.event.OTTrade trade},
028 * {@link org.otfeed.event.OTMMQuote marker-maker quote}, and
029 * {@link org.otfeed.event.OTBBO bbo} events.
030 */
031 public final class OptionChainSnapshotCommand
032 extends ExchangeSymbolAndQuoteDelegateHolder implements ICommand {
033
034 /**
035 * Creates new option chain snapshot command, initializing
036 * all its properties, except delegates.
037 *
038 * @param exchangeCode exchange code.
039 * @param symbolCode symbol code.
040 * @param expiration expiration.
041 * @param strike strike.
042 * @param volumeStyle volume reporting style.
043 */
044 public OptionChainSnapshotCommand(String exchangeCode,
045 String symbolCode,
046 MonthAndYear expiration,
047 PriceRange strike,
048 VolumeStyleEnum volumeStyle) {
049 setExchangeCode(exchangeCode);
050 setSymbolCode(symbolCode);
051 setExpiration(expiration);
052 setStrike(strike);
053 setVolumeStyle(volumeStyle);
054 }
055
056 /**
057 * Default constructor. Initializes
058 * {@link #getExpiration expiration} property to
059 * its default value of <code>null</code> (meaning "any").
060 * Initializes {@link #getStrike strike} property to
061 * its default value of <code>null</code> (meaning "any").
062 * Initializes {@link #getVolumeStyle volumeStyle}
063 * property to <code>COMPOUND</code>.
064 * All other properties must be set explicitly before using
065 * this command object.
066 */
067 public OptionChainSnapshotCommand() {
068 this(null, null, null, null, VolumeStyleEnum.COMPOUND);
069 }
070
071 /**
072 * Creates new option chain snapshot command, initializing
073 * all its properties, except <code>volumeStyle<code>
074 * property, which defaults to <code>COMPOUND</code>.
075 *
076 * @param exchangeCode exchange code.
077 * @param symbolCode symbol code.
078 * @param expiration expiration.
079 * @param strike strike.
080 */
081 public OptionChainSnapshotCommand(String exchangeCode,
082 String symbolCode,
083 MonthAndYear expiration,
084 PriceRange strike) {
085 this(exchangeCode, symbolCode,
086 expiration, strike, VolumeStyleEnum.COMPOUND);
087 }
088
089 private MonthAndYear expiration;
090
091 /**
092 * Option expiration date (month and year). This property is
093 * optional. Defaults to null, which is interpreted as
094 * "any expiration date".
095 *
096 * @return option expiration date.
097 */
098 public MonthAndYear getExpiration() {
099 return expiration;
100 }
101
102 /**
103 * Sets option expiration date.
104 *
105 * @param val option expiration date.
106 */
107 public void setExpiration(MonthAndYear val) {
108 expiration = val;
109 }
110
111 private PriceRange strike;
112
113 /**
114 * Price range for the option strike. This property
115 * is optional. Defaults to null, which means
116 * "any strike price".
117 *
118 * @return option strike price range.
119 */
120 public PriceRange getStrike() {
121 return strike;
122 }
123
124 /**
125 * Sets option strike price range.
126 *
127 * @param val strike price range.
128 */
129 public void setStrike(PriceRange val) {
130 strike = val;
131 }
132 }