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