Class OhlcvData

java.lang.Object
com.caplin.charting.OhlcvData

public class OhlcvData extends Object
OhlcvData represents a datapoint on a chart with Open, High, Low, Close and Volume. A single OhlcvData object would commonly be plotted as a candlestick.
  • Constructor Details

    • OhlcvData

      public OhlcvData(Date time, double high, double low, double open, double close, double volume)
      Parameters:
      time - the time of the data
      high - the highest price that was reached during this time period. This must be larger than low, open and close.
      low - the lowest price that was reached during this time period. This must be smaller than high, open and close.
      open - the price that the instrument opened this time period with.
      close - the price that the instrument closed this time period with.
      volume - the volume of trading during this time period.
      Throws:
      IllegalArgumentException - if high or low are not respectively the largest and smallest of the values (high, low, open, close).
      NullPointerException - if time is null.
  • Method Details

    • getTime

      public Date getTime()
      Returns:
      the time.
    • getOpen

      public double getOpen()
      Returns:
      the open price for this period.
    • getHigh

      public double getHigh()
      Returns:
      the high price for this period. Will not be smaller than open, close or low.
    • getClose

      public double getClose()
      Returns:
      the close price for this period.
    • getLow

      public double getLow()
      Returns:
      the low price for this period. Will not be larger than open, close or high.
    • getVolume

      public double getVolume()
      Returns:
      the volume for this period.
    • toString

      public String toString()
      Overrides:
      toString in class Object