Files
ATS_Esper/src/main/java/ats/plugin/OHLCValueEvent.java
2018-07-13 19:34:56 -07:00

43 lines
1.2 KiB
Java

package ats.plugin;
import org.joda.time.DateTime;
/**
* OHLCValueEvent stores one bar of OHLC info.
*/
public class OHLCValueEvent extends OHLCEvent {
private double value;
public OHLCValueEvent() {
this(null, 0, 0, 0, 0, 0);
}
public OHLCValueEvent(DateTime time,
double open, double high,
double low, double close,
double value)
{
super(time, open, high, low, close);
this.value = value;
}
public static OHLCValueEvent make(DateTime time,
double open, double high,
double low, double close,
double value)
{
return new OHLCValueEvent(time, open, high, low, close, value);
}
public Double getValue() { return value; }
/**
* Return a human readable representation of this event.
*/
public String toString() {
return String.format("OHLCValueEvent[%s, open=%.3f, high=%.3f, low=%.3f, close=%.3f, value=%.3f]",
getTime(), getOpen(), getHigh(), getLow(), getClose(), value);
}
}