Package yahoofinance

Class Utils


  • public class Utils
    extends java.lang.Object
    Author:
    Stijn Strickx
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.math.BigDecimal BILLION  
      static java.math.BigDecimal HUNDRED  
      static java.math.BigDecimal MILLION  
      static java.math.BigDecimal THOUSAND  
    • Constructor Summary

      Constructors 
      Constructor Description
      Utils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.math.BigDecimal getBigDecimal​(java.lang.String data)  
      static java.math.BigDecimal getBigDecimal​(java.lang.String dataMain, java.lang.String dataSub)  
      static double getDouble​(java.lang.String data)  
      static java.lang.Integer getInt​(java.lang.String data)  
      static java.lang.Long getLong​(java.lang.String data)  
      static double getPercent​(double numerator, double denominator)  
      static java.math.BigDecimal getPercent​(java.math.BigDecimal numerator, java.math.BigDecimal denominator)  
      static java.lang.String getString​(java.lang.String data)  
      static java.lang.String getURLParameters​(java.util.Map<java.lang.String,​java.lang.String> params)  
      static java.lang.String join​(java.lang.String[] data, java.lang.String d)  
      static java.util.Calendar parseDateTime​(java.lang.String date, java.lang.String time, java.util.TimeZone timeZone)
      Used to parse the last trade date / time.
      static java.util.Calendar parseDividendDate​(java.lang.String date)
      Used to parse the dividend dates.
      static java.util.Calendar parseHistDate​(java.lang.String date)  
      static java.lang.String stripOverhead​(java.lang.String line)
      Strips the unwanted chars from a line returned in the CSV Used for parsing the FX CSV lines
      static java.lang.String unescape​(java.lang.String data)  
      static java.util.Calendar unixToCalendar​(long timestamp)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • HUNDRED

        public static final java.math.BigDecimal HUNDRED
      • THOUSAND

        public static final java.math.BigDecimal THOUSAND
      • MILLION

        public static final java.math.BigDecimal MILLION
      • BILLION

        public static final java.math.BigDecimal BILLION
    • Constructor Detail

      • Utils

        public Utils()
    • Method Detail

      • join

        public static java.lang.String join​(java.lang.String[] data,
                                            java.lang.String d)
      • getString

        public static java.lang.String getString​(java.lang.String data)
      • getBigDecimal

        public static java.math.BigDecimal getBigDecimal​(java.lang.String data)
      • getBigDecimal

        public static java.math.BigDecimal getBigDecimal​(java.lang.String dataMain,
                                                         java.lang.String dataSub)
      • getDouble

        public static double getDouble​(java.lang.String data)
      • getInt

        public static java.lang.Integer getInt​(java.lang.String data)
      • getLong

        public static java.lang.Long getLong​(java.lang.String data)
      • getPercent

        public static java.math.BigDecimal getPercent​(java.math.BigDecimal numerator,
                                                      java.math.BigDecimal denominator)
      • getPercent

        public static double getPercent​(double numerator,
                                        double denominator)
      • parseDividendDate

        public static java.util.Calendar parseDividendDate​(java.lang.String date)
        Used to parse the dividend dates. Returns null if the date cannot be parsed.
        Parameters:
        date - String received that represents the date
        Returns:
        Calendar object representing the parsed date
      • parseDateTime

        public static java.util.Calendar parseDateTime​(java.lang.String date,
                                                       java.lang.String time,
                                                       java.util.TimeZone timeZone)
        Used to parse the last trade date / time. Returns null if the date / time cannot be parsed.
        Parameters:
        date - String received that represents the date
        time - String received that represents the time
        timeZone - time zone to use for parsing the date time
        Returns:
        Calendar object with the parsed datetime
      • parseHistDate

        public static java.util.Calendar parseHistDate​(java.lang.String date)
      • unixToCalendar

        public static java.util.Calendar unixToCalendar​(long timestamp)
      • getURLParameters

        public static java.lang.String getURLParameters​(java.util.Map<java.lang.String,​java.lang.String> params)
      • stripOverhead

        public static java.lang.String stripOverhead​(java.lang.String line)
        Strips the unwanted chars from a line returned in the CSV Used for parsing the FX CSV lines
        Parameters:
        line - the original CSV line
        Returns:
        the stripped line
      • unescape

        public static java.lang.String unescape​(java.lang.String data)