ticks implement VizMappable now
This commit is contained in:
@ -1,10 +1,14 @@
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
import ats.viz.VizMappable;
|
||||
|
||||
/**
|
||||
* TrueFXTickEvent holds a single tick read from TrueFX data archive
|
||||
* csv file.
|
||||
@ -13,7 +17,7 @@ import org.joda.time.DateTime;
|
||||
* EUR/USD,20170102 00:00:00.803,1.0523,1.05307
|
||||
*/
|
||||
@JsonPropertyOrder({ "instrument", "time", "bid", "ask" })
|
||||
public class TrueFXTickEvent extends TickEvent {
|
||||
public class TrueFXTickEvent extends TickEvent implements VizMappable {
|
||||
@JsonFormat(pattern="yyyyMMdd HH:mm:ss.SSS")
|
||||
private DateTime time;
|
||||
private String instrument;
|
||||
@ -97,6 +101,17 @@ public class TrueFXTickEvent extends TickEvent {
|
||||
return n.replace('/', '_');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of property names to object values of the
|
||||
* properties that should be included in the visualization log.
|
||||
*/
|
||||
public Map<String,Object> toVizPropertyMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("time", time);
|
||||
map.put("mid", getMid());
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a human readable representation of this event.
|
||||
*/
|
||||
|
||||
@ -1,11 +1,17 @@
|
||||
package ats.plugin;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
import ats.viz.VizMappable;
|
||||
|
||||
|
||||
/**
|
||||
* OHLCEvent stores one bar of OHLC info.
|
||||
*/
|
||||
public class OHLCEvent {
|
||||
public class OHLCEvent implements VizMappable {
|
||||
private DateTime time;
|
||||
private double open;
|
||||
private double high;
|
||||
@ -38,6 +44,20 @@ public class OHLCEvent {
|
||||
|
||||
public Double getClose() { return close; }
|
||||
|
||||
/**
|
||||
* Return a map of property names to object values of the
|
||||
* properties that should be included in the visualization log.
|
||||
*/
|
||||
public Map<String,Object> toVizPropertyMap() {
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("time", time);
|
||||
map.put("open", open);
|
||||
map.put("high", high);
|
||||
map.put("low", low);
|
||||
map.put("close", close);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a human readable representation of this event.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user