001    /**
002     * Copyright 2008 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    package org.otfeed.support.alt;
018    
019    import java.util.Date;
020    import java.util.EnumSet;
021    import java.util.Set;
022    
023    import org.otfeed.command.AggregationSpan;
024    import org.otfeed.command.ListSymbolEnum;
025    import org.otfeed.command.MonthAndYear;
026    import org.otfeed.command.PriceRange;
027    import org.otfeed.command.VolumeStyleEnum;
028    import org.otfeed.command.ListSymbolsCommand.MatchStyleEnum;
029    import org.otfeed.event.OTDividend;
030    import org.otfeed.event.OTEquityInit;
031    import org.otfeed.event.OTExchange;
032    import org.otfeed.event.OTOHLC;
033    import org.otfeed.event.OTOptionInit;
034    import org.otfeed.event.OTSplit;
035    import org.otfeed.event.OTSymbol;
036    import org.otfeed.event.OTTodaysOHL;
037    import org.otfeed.protocol.DataEnum;
038    
039    /**
040     * Synchronous interface to the services of Opentick financial feed.
041     */
042    public interface IOutboundConnection {
043            
044            public interface IDataReader<T> extends Iterable<T> {
045                    void cancel();
046            }
047            
048            IDataReader<OTExchange> requestListExchanges();
049    
050            IDataReader<OTSymbol> requestListSymbols(
051                            String exchangeCode,
052                            String symbolCodePattern,
053                            Set<ListSymbolEnum> types,
054                            MatchStyleEnum matchStyle);
055            
056            IDataReader<OTEquityInit> requestEquityInit(
057                            String exchangeCode,
058                            String symbolCode);
059            
060            IDataReader<OTDividend> requestDivident(
061                            String exchangeCode,
062                            String symbolCode,
063                            Date startDate,
064                            Date endDate);
065            
066            IDataReader<OTOHLC> requestHistData(
067                            String exchangeCode,
068                            String symbolCode,
069                            Date startDate,
070                            Date endDate,
071                            AggregationSpan aggregationSpan);
072    
073            IDataReader<Object> requestHistTicks(
074                            String exchangeCode,
075                            String symbolCode,
076                            Date startDate,
077                            Date endDate,
078                            VolumeStyleEnum volumeStyle,
079                            EnumSet<DataEnum> dataTypes);
080            
081            IDataReader<Object> requestSnapshot(
082                            String exchangeCode,
083                            String symbolCode,
084                            VolumeStyleEnum volumeStyle,
085                            EnumSet<DataEnum> dataTypes);
086    
087            IDataReader<OTTodaysOHL> requestTodaysOHL(
088                            String exchangeCode,
089                            String symbolCode);
090    
091            IDataReader<Object> requestOptionChainSnapshot(
092                            String exchangeCode,
093                            String symbolCode,
094                            MonthAndYear expiration,
095                            PriceRange strikeRange,
096                            VolumeStyleEnum volumeStyle,
097                            EnumSet<DataEnum> dataTypes);
098    
099            IDataReader<OTOptionInit> requestOptionInit(
100                            String exchangeCode,
101                            String symbolCode,
102                            MonthAndYear expiration,
103                            PriceRange strikeRange);
104    
105            IDataReader<OTSplit> requestSplit(
106                            String exchangeCode,
107                            String symbolCode,
108                            Date startDate,
109                            Date endDate);
110    
111            IDataReader<Object> requestHistBook(
112                            String exchangeCode,
113                            String symbolCode,
114                            Date startDate,
115                            Date endDate,
116                            EnumSet<DataEnum> dataTypes);
117    
118            void close();
119    }