net.osomahe.coinacrobat.api.ticker.entity.TimestampPrice Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of coinacrobat-api Show documentation
Show all versions of coinacrobat-api Show documentation
The project with APIs to be able to create own strategy
package net.osomahe.coinacrobat.api.ticker.entity;
import java.time.ZonedDateTime;
/**
* Object for storing price with timestamp information.
*
* @author Antonin Stoklasek
*/
public class TimestampPrice extends Price implements Comparable {
public static final long serialVersionUID = -1L;
private ZonedDateTime timestamp;
public TimestampPrice() {
}
public TimestampPrice(ZonedDateTime timestamp) {
this.timestamp = timestamp;
}
public TimestampPrice(ZonedDateTime timestamp, Price price) {
super(price.getAsk(), price.getBid());
this.timestamp = timestamp;
}
public ZonedDateTime getTimestamp() {
return timestamp;
}
public void setTimestamp(ZonedDateTime timestamp) {
this.timestamp = timestamp;
}
@Override
public String toString() {
return "TimestampPrice{" +
"timestamp=" + timestamp +
"} " + super.toString();
}
@Override
public int compareTo(TimestampPrice tp) {
return timestamp.compareTo(tp.timestamp);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy