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