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     * Command that issues a synthetic request for snapshot and ticks stream.
024     * Equivalent to issuing {@link SnapshotCommand}, followed by {@link TickStreamCommand}.
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 TickStreamWithSnapshotCommand 
032                    extends ExchangeSymbolAndQuoteDelegateHolder implements ICommand {
033            
034            /**
035             * Creates new command, initializing 
036             * all its properties, except delegates.
037             * 
038             * @param exchangeCode exchange code.
039             * @param symbolCode symbol code.
040             * @param volumeStyle volume reporting style.
041             */
042            public TickStreamWithSnapshotCommand(String exchangeCode,
043                            String symbolCode,
044                            VolumeStyleEnum volumeStyle) {
045                    setExchangeCode(exchangeCode);
046                    setSymbolCode(symbolCode);
047                    setVolumeStyle(volumeStyle);
048            }
049    
050            /**
051             * Default construtor. Initializes
052             * {@link #getVolumeStyle volumeStyle} property to its default
053             * value of {@link VolumeStyleEnum#COMPOUND COMPOUND}.
054             * Other properties must be set explicitly before using 
055             * this object. 
056             */
057            public TickStreamWithSnapshotCommand() {
058                    this(null, null, VolumeStyleEnum.COMPOUND);
059            }
060    
061            /**
062             * Creates new command, initializing 
063             * all its properties, except <code>volumeStyle</code>,
064             * which defaults to <code>COMPOUND</code>, and delegates.
065             * 
066             * @param exchangeCode exchange code.
067             * @param symbolCode symbol code.
068             */
069            public TickStreamWithSnapshotCommand(String exchangeCode,
070                            String symbolCode) {
071                    this(exchangeCode, 
072                                    symbolCode, 
073                                    VolumeStyleEnum.COMPOUND);
074            }
075    }