more tabs to spaces
This commit is contained in:
@ -9,72 +9,72 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
* {"type":"PRICE","time":"2018-04-05T20:35:20.983907480Z","bids":[{"price":"1.22376","liquidity":10000000}],"asks":[{"price":"1.22386","liquidity":10000000}],"closeoutBid":"1.22361","closeoutAsk":"1.22401","status":"tradeable","tradeable":true,"instrument":"EUR_USD"}
|
||||
*/
|
||||
public class OANDATickEvent extends TickEvent {
|
||||
public String type;
|
||||
private DateTime time;
|
||||
public PriceBucket[] bids;
|
||||
public PriceBucket[] asks;
|
||||
public BigDecimal closeoutBid;
|
||||
public BigDecimal closeoutAsk;
|
||||
public String status;
|
||||
public boolean tradeable;
|
||||
private String instrument;
|
||||
public String type;
|
||||
private DateTime time;
|
||||
public PriceBucket[] bids;
|
||||
public PriceBucket[] asks;
|
||||
public BigDecimal closeoutBid;
|
||||
public BigDecimal closeoutAsk;
|
||||
public String status;
|
||||
public boolean tradeable;
|
||||
private String instrument;
|
||||
|
||||
|
||||
/**
|
||||
* @return the instrument
|
||||
*/
|
||||
@Override
|
||||
public String getInstrument() {
|
||||
return instrument;
|
||||
}
|
||||
/**
|
||||
* @return the instrument
|
||||
*/
|
||||
@Override
|
||||
public String getInstrument() {
|
||||
return instrument;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param instrument the instrument to set
|
||||
*/
|
||||
public void setInstrument(String instrument) {
|
||||
this.instrument = instrument;
|
||||
}
|
||||
/**
|
||||
* @param instrument the instrument to set
|
||||
*/
|
||||
public void setInstrument(String instrument) {
|
||||
this.instrument = instrument;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the time
|
||||
*/
|
||||
@Override
|
||||
public DateTime getTime() {
|
||||
return time;
|
||||
}
|
||||
/**
|
||||
* @return the time
|
||||
*/
|
||||
@Override
|
||||
public DateTime getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param time the time to set
|
||||
*/
|
||||
public void setTime(DateTime time) {
|
||||
this.time = time;
|
||||
}
|
||||
/**
|
||||
* @param time the time to set
|
||||
*/
|
||||
public void setTime(DateTime time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the bid
|
||||
*/
|
||||
@Override
|
||||
public BigDecimal getBid() {
|
||||
return bids[0].price;
|
||||
}
|
||||
/**
|
||||
* @return the bid
|
||||
*/
|
||||
@Override
|
||||
public BigDecimal getBid() {
|
||||
return bids[0].price;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ask
|
||||
*/
|
||||
@Override
|
||||
public BigDecimal getAsk() {
|
||||
return asks[0].price;
|
||||
}
|
||||
/**
|
||||
* @return the ask
|
||||
*/
|
||||
@Override
|
||||
public BigDecimal getAsk() {
|
||||
return asks[0].price;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the midprice between bid and ask
|
||||
*/
|
||||
@Override
|
||||
public BigDecimal getMid() {
|
||||
return getMid(asks[0].price, bids[0].price);
|
||||
}
|
||||
/**
|
||||
* @return the midprice between bid and ask
|
||||
*/
|
||||
@Override
|
||||
public BigDecimal getMid() {
|
||||
return getMid(asks[0].price, bids[0].price);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return String.format("OANDATickEvent[%s,%s,%s]", getTime(), getInstrument(), getMid());
|
||||
}
|
||||
public String toString() {
|
||||
return String.format("OANDATickEvent[%s, %s, %s]", getTime(), getInstrument(), getMid());
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,43 +4,43 @@ import org.joda.time.DateTime;
|
||||
|
||||
public abstract class TickEvent {
|
||||
|
||||
/**
|
||||
* @return the tick time
|
||||
*/
|
||||
public abstract DateTime getTime();
|
||||
/**
|
||||
* @return the tick time
|
||||
*/
|
||||
public abstract DateTime getTime();
|
||||
|
||||
/**
|
||||
* @return the trading instrument
|
||||
*/
|
||||
public abstract String getInstrument();
|
||||
/**
|
||||
* @return the trading instrument
|
||||
*/
|
||||
public abstract String getInstrument();
|
||||
|
||||
/**
|
||||
* @return the bid price
|
||||
*/
|
||||
public abstract BigDecimal getBid();
|
||||
/**
|
||||
* @return the bid price
|
||||
*/
|
||||
public abstract BigDecimal getBid();
|
||||
|
||||
/**
|
||||
* @return the ask price
|
||||
*/
|
||||
public abstract BigDecimal getAsk();
|
||||
/**
|
||||
* @return the ask price
|
||||
*/
|
||||
public abstract BigDecimal getAsk();
|
||||
|
||||
/**
|
||||
* @return the midprice between bid and ask
|
||||
*/
|
||||
public abstract BigDecimal getMid();
|
||||
/**
|
||||
* @return the midprice between bid and ask
|
||||
*/
|
||||
public abstract BigDecimal getMid();
|
||||
|
||||
/**
|
||||
* Calculate the midpoint between two values.
|
||||
*/
|
||||
public static BigDecimal getMid(BigDecimal a, BigDecimal b) {
|
||||
BigDecimal diff = a.subtract(b).abs();
|
||||
return a.min(b).add(diff.divide(new BigDecimal(2)));
|
||||
}
|
||||
/**
|
||||
* Calculate the midpoint between two values.
|
||||
*/
|
||||
public static BigDecimal getMid(BigDecimal a, BigDecimal b) {
|
||||
BigDecimal diff = a.subtract(b).abs();
|
||||
return a.min(b).add(diff.divide(new BigDecimal(2)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the midpoint between two values.
|
||||
*/
|
||||
public double getMidDouble() {
|
||||
return getMid().doubleValue();
|
||||
}
|
||||
/**
|
||||
* Calculate the midpoint between two values.
|
||||
*/
|
||||
public double getMidDouble() {
|
||||
return getMid().doubleValue();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user