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 java.util.Date;
021 import org.otfeed.protocol.ICommand;
022
023 /**
024 * Request for the historical data with tick resolution.
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 * <p/>
031 * For the request to receive aggregated quote data,
032 * see {@link org.otfeed.command.HistDataCommand HistDataCommand}.
033 */
034 public final class HistTicksCommand
035 extends ExchangeSymbolAndQuoteDelegateHolder implements ICommand {
036
037 /**
038 * Creates new Historical ticks command, initializing
039 * all its properties.
040 *
041 * @param exchangeCode exchange code.
042 * @param symbolCode symbol code.
043 * @param startDate start date.
044 * @param endDate end date.
045 * @param volumeStyle style of volume reporting (INDIVIDUAL or COMPOUND).
046 */
047 public HistTicksCommand(String exchangeCode,
048 String symbolCode,
049 Date startDate,
050 Date endDate,
051 VolumeStyleEnum volumeStyle) {
052 setExchangeCode(exchangeCode);
053 setSymbolCode(symbolCode);
054 setStartDate(startDate);
055 setEndDate(endDate);
056 setVolumeStyle(volumeStyle);
057 }
058
059 /**
060 * Default constructor. Sets {@link #getVolumeStyle volumeStyle}
061 * property to its default value of
062 * {@link VolumeStyleEnum#COMPOUND COMPOUND}.
063 * All other properties must be set explicitly before
064 * using this command object.
065 */
066 public HistTicksCommand() {
067 this(null, null, null, null, VolumeStyleEnum.COMPOUND);
068 }
069
070 /**
071 * Creates new Historical ticks command, initializing all properties except
072 * <code>volumeStyle</code> one, which defaults to <code>COMPOUND</code>.
073 *
074 *
075 * @param exchangeCode exchange code.
076 * @param symbolCode symbol code.
077 * @param startDate start date.
078 * @param endDate end date.
079 */
080 public HistTicksCommand(String exchangeCode,
081 String symbolCode,
082 Date startDate,
083 Date endDate) {
084 this(exchangeCode, symbolCode, startDate, endDate,
085 VolumeStyleEnum.COMPOUND);
086 }
087
088 private Date startDate;
089
090 /**
091 * Start date/time for the historical data.
092 *
093 * @return Start date/time.
094 */
095 public final Date getStartDate() {
096 return startDate;
097 }
098
099 /**
100 * Sets start date/time.
101 *
102 * @param val Start date/time.
103 */
104 public final void setStartDate(Date val) {
105 startDate = val;
106 }
107
108 private Date endDate;
109
110 /**
111 * End date/time for the historical data.
112 *
113 * @return End date/time.
114 */
115 public final Date getEndDate() {
116 return endDate;
117 }
118
119 /**
120 * Sets end date/time.
121 *
122 * @param val end date/time.
123 */
124 public final void setEndDate(Date val) {
125 endDate = val;
126 }
127 }