Files
ATS_Esper/src/main/java/OANDATickEvent.java

81 lines
1.6 KiB
Java

import java.math.BigDecimal;
import org.joda.time.DateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
* The specification of an Account-specific Price.
*
* {"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;
/**
* @return the instrument
*/
@Override
public String getInstrument() {
return instrument;
}
/**
* @param instrument the instrument to set
*/
public void setInstrument(String instrument) {
this.instrument = instrument;
}
/**
* @return the time
*/
@Override
public DateTime getTime() {
return 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 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);
}
public String toString() {
return String.format("OANDATickEvent[%s,%s,%s]", getTime(), getInstrument(), getBid());
}
}