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
022 import org.otfeed.event.IDataDelegate;
023 import org.otfeed.event.OTBookCancel;
024 import org.otfeed.event.OTBookChange;
025 import org.otfeed.event.OTBookDelete;
026 import org.otfeed.event.OTBookExecute;
027 import org.otfeed.event.OTBookOrder;
028 import org.otfeed.event.OTBookPriceLevel;
029 import org.otfeed.event.OTBookPurge;
030 import org.otfeed.event.OTBookReplace;
031 import org.otfeed.protocol.ICommand;
032
033 /**
034 * Request for the historical book data with tick resolution.
035 * <p/>
036 * Generates {@link OTBookOrder order}, {@link OTBookChange},
037 * {@link OTBookCancel}, {@link OTBookReplace replace}, {@link OTBookDelete delete},
038 * {@link OTBookExecute execute}, and {@link OTBookPriceLevel price level}
039 * events.
040 */
041 public final class HistBooksCommand
042 extends ExchangeSymbolAndDatesHolder implements ICommand {
043
044 /**
045 * Creates new book command, initializing all
046 * its properties.
047 *
048 * @param exchangeCode exchange code.
049 * @param symbolCode symbol code.
050 * @param startDate start date.
051 * @param endDate end date.
052 */
053 public HistBooksCommand(String exchangeCode,
054 String symbolCode,
055 Date startDate,
056 Date endDate) {
057 setExchangeCode(exchangeCode);
058 setSymbolCode(symbolCode);
059 setStartDate(startDate);
060 setEndDate(endDate);
061 }
062
063 /**
064 * Default constructor.
065 * All properties must be explicitly set before
066 * using this command object.
067 */
068 public HistBooksCommand() {
069 this(null, null, null, null);
070 }
071
072 private IDataDelegate<OTBookOrder> orderDelegate;
073 public IDataDelegate<OTBookOrder> getOrderDelegate() {
074 return orderDelegate;
075 }
076 public void setOrderDelegate(IDataDelegate<OTBookOrder> val) {
077 orderDelegate = val;
078 }
079
080 private IDataDelegate<OTBookChange> changeDelegate;
081 public IDataDelegate<OTBookChange> getChangeDelegate() {
082 return changeDelegate;
083 }
084 public void setChangeDelegate(IDataDelegate<OTBookChange> val) {
085 changeDelegate = val;
086 }
087
088 private IDataDelegate<OTBookReplace> replaceDelegate;
089 public IDataDelegate<OTBookReplace> getReplaceDelegate() {
090 return replaceDelegate;
091 }
092 public void setReplaceDelegate(IDataDelegate<OTBookReplace> val) {
093 replaceDelegate = val;
094 }
095
096 private IDataDelegate<OTBookCancel> cancelDelegate;
097 public IDataDelegate<OTBookCancel> getCancelDelegate() {
098 return cancelDelegate;
099 }
100 public void setCancelDelegate(IDataDelegate<OTBookCancel> val) {
101 cancelDelegate = val;
102 }
103
104 private IDataDelegate<OTBookPurge> purgeDelegate;
105 public IDataDelegate<OTBookPurge> getPurgeDelegate() {
106 return purgeDelegate;
107 }
108 public void setPurgeDelegate(IDataDelegate<OTBookPurge> val) {
109 purgeDelegate = val;
110 }
111
112 private IDataDelegate<OTBookExecute> executeDelegate;
113 public IDataDelegate<OTBookExecute> getExecuteDelegate() {
114 return executeDelegate;
115 }
116 public void setExecuteDelegate(IDataDelegate<OTBookExecute> val) {
117 executeDelegate = val;
118 }
119
120 private IDataDelegate<OTBookDelete> deleteDelegate;
121 public IDataDelegate<OTBookDelete> getDeleteDelegate() {
122 return deleteDelegate;
123 }
124 public void setDeleteDelegate(IDataDelegate<OTBookDelete> val) {
125 deleteDelegate = val;
126 }
127
128 private IDataDelegate<OTBookPriceLevel> priceLevelDelegate;
129 public IDataDelegate<OTBookPriceLevel> getPriceLevelDelegate() {
130 return priceLevelDelegate;
131 }
132 public void setPriceLevelDelegate(IDataDelegate<OTBookPriceLevel> val) {
133 priceLevelDelegate = val;
134 }
135 }