Enum YahooFeedEventTranslator

    • Constructor Detail

      • YahooFeedEventTranslator

        private YahooFeedEventTranslator()
    • Method Detail

      • values

        public static YahooFeedEventTranslator[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (YahooFeedEventTranslator c : YahooFeedEventTranslator.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static YahooFeedEventTranslator valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • getEventsFrom

        private List<Event> getEventsFrom​(Map<YahooField,​String> inData,
                                          String inHandle)
        Gets all the events it can find from the given data collection.
        Parameters:
        inData - a Map<YahooField,String> value
        inHandle -
        Returns:
        a List<Event> value
      • shouldSendEvent

        private boolean shouldSendEvent​(Event inEvent)
        Determines if the given event should be sent to the client or not.

        This method requires external synchronization.

        Parameters:
        inEvent - an Event value
        Returns:
        a boolean value
      • getComparator

        private Comparator<Event> getComparator​(Event inEvent)
        Gets the comparator to use for the given Event.

        This method requires external synchronization.

        Parameters:
        inEvent - an Event value
        Returns:
        a Comparator<Event> value
      • lookForDividendEvent

        private void lookForDividendEvent​(Map<YahooField,​String> inData,
                                          List<Event> inEvents)
        Determines if a DividendEvent can be found in the given data.
        Parameters:
        inData - a Map<YahooField,String> value
        inEvents - a List<Event> value
      • getQuoteDataAction

        private YahooFeedEventTranslator.QuoteDataAction getQuoteDataAction​(String inSymbol,
                                                                            String inPrice,
                                                                            String inSize,
                                                                            Map<String,​YahooFeedEventTranslator.QuoteData> quoteDataEventMap,
                                                                            String handle)
        Gets the Quote data (price, size). Checks if the quote data is from a new response / subsequent response by checking the cache for the particular event (bid / ask). Returns the QuoteDataAction (quote details and the new action to perform for the response).
        Parameters:
        inSymbol - a String value
        inPrice - a String value
        inSize - a String value
        quoteDataEventMap - a Map<String,QuoteData> value
        handle - a String value
        Returns:
        a QuoteDataAction value
      • lookForBidEvent

        private void lookForBidEvent​(Map<YahooField,​String> inData,
                                     List<Event> inEvents,
                                     String inHandle)
        Looks for bid events in the given data.
        Parameters:
        inData - a Map<YahooField,String> value
        inEvents - a List<Event> value
        inHandle -
      • lookForAskEvent

        private void lookForAskEvent​(Map<YahooField,​String> inData,
                                     List<Event> inEvents,
                                     String inHandle)
        Looks for ask events in the given data.
        Parameters:
        inData - a Map<YahooField,String> value
        inEvents - a List<Event> value
      • lookForTradeEvent

        private void lookForTradeEvent​(Map<YahooField,​String> inData,
                                       List<Event> inEvents)
        Looks for trade events in the given data.
        Parameters:
        inData - a Map<YahooField,String> value
        inEvents - a List<Event> value
      • addFutureAttributes

        private <T extends TradeEvent> void addFutureAttributes​(TradeEventBuilder<T> inBuilder,
                                                                Instrument inInstrument,
                                                                Map<YahooField,​String> inData)
        Adds future attributes to the given trade events, if applicable.
        Parameters:
        inBuilder - a TradeEventBuilder<T> value
        inInstrument - an Instrument value
        inData - a Map<YahooField,String> value
      • addOptionAttributes

        private <T extends TradeEvent> void addOptionAttributes​(TradeEventBuilder<T> inBuilder,
                                                                Instrument inInstrument,
                                                                Map<YahooField,​String> inData)
        Adds option attributes to the given trade events, if applicable.
        Parameters:
        inBuilder - a TradeEventBuilder<T> value
        inInstrument - an Instrument value
        inData - a Map<YahooField,String> value
      • addFutureAttributes

        private <T extends QuoteEvent> void addFutureAttributes​(QuoteEventBuilder<T> inBuilder,
                                                                Instrument inInstrument,
                                                                Map<YahooField,​String> inData)
        Adds future attributes to the given quote events, if applicable.
        Parameters:
        inBuilder - a TradeEventBuilder<T> value
        inInstrument - an Instrument value
        inData - a Map<YahooField,String> value
      • addOptionAttributes

        private <T extends QuoteEvent> void addOptionAttributes​(QuoteEventBuilder<T> inBuilder,
                                                                Instrument inInstrument,
                                                                Map<YahooField,​String> inData)
        Adds option attributes to the given quote events, if applicable.
        Parameters:
        inBuilder - a TradeEventBuilder<T> value
        inInstrument - an Instrument value
        inData - a Map<YahooField,String> value
      • getInstrumentFrom

        private Instrument getInstrumentFrom​(String inSymbol)
        Gets an Instrument for the given symbol.
        Parameters:
        inSymbol - a String value
        Returns:
        an Instrument value