CryptoBase
, CryptoBaseExchange
, HistoricalBase
HistoricalDaily
, HistoricalHourly
, HistoricalMinute
public abstract class HistoricalData extends java.lang.Object implements CryptoBaseExchange, HistoricalBase
TimestampedData
Modifier and Type | Method | Description |
---|---|---|
java.lang.String |
dataToString() |
returns a string representation of the historical data retrieved from the
Historical OHLCV end point.
|
static HistoricalDaily |
generateHistoDaily(java.lang.String currencyTo,
java.lang.String currencyFrom,
ExchangeStreamer.exchanges exchange) |
gets a new instance of HistoricalDaily with the following parameters
|
static HistoricalHourly |
generateHistoHourly(java.lang.String currencyTo,
java.lang.String currencyFrom,
ExchangeStreamer.exchanges exchange) |
gets a new instance of HistoricalHourly with the following parameters
|
static HistoricalMinute |
generateHistoMinute(java.lang.String currencyTo,
java.lang.String currencyFrom,
ExchangeStreamer.exchanges exchange) |
gets a new instance of HistoricalMinute with the following parameters
|
int |
getAggregate() |
gets the aggregate parameter this object uses for the CryptoCompare API
|
ConversionType |
getConversionType() |
gets the ConversionType for this object
|
java.lang.String |
getCurrencyFrom() |
gets the fsym(s) parameter this object uses for the CryptoCompare API
|
java.lang.String |
getCurrencyTo() |
gets the tsym(s) parameter this object uses for the CryptoCompare API
|
abstract TimestampedData |
getDataAtTime(long timestamp) |
gets the TimestampedData with unix timestamp equal to unixTimestamp.
If the unixTimestamp is in between two unix timestamps then the latter TimestampedData is returned. |
java.util.stream.Stream<TimestampedData> |
getDataStream() |
streams TimestampedData from this Historical object
|
ExchangeStreamer.exchanges |
getExchange() |
gets the e parameter this object uses for the CryptoCompare API
|
long |
getLastUnixTimestamp() |
gets the toTs parameter this object uses for the CryptoCompare API
|
int |
getLimit() |
gets the limit parameter this object uses for the CryptoCompare API
|
java.lang.String |
getResponse() |
|
long |
getTimeFrom() |
|
long |
getTimeTo() |
|
float |
getType() |
|
java.net.URL |
getURL() |
gets the https://min-api.cryptocompare.com/data/histo end point url with
parameters currencyTo, currencyFrom, exchange, lastUnixTimestamp, limit,
aggregate, and apiKey (if any)
|
boolean |
isAggregated() |
|
boolean |
isFirstValueInArray() |
|
void |
setAggregate(int aggregate) |
sets the aggregate parameter this object uses for the CryptoCompare API
|
void |
setCurrencyFrom(java.lang.String currencyFrom) |
sets the fsym(s) parameter this object uses for the CryptoCompare API
|
void |
setCurrencyTo(java.lang.String currencyTo) |
sets the tsym(s) parameter this object uses for the CryptoCompare API
|
void |
setExchange(ExchangeStreamer.exchanges exchange) |
sets the e parameter this object uses for the CryptoCompare API
|
void |
setLastUnixTimestamp(long time) |
sets the toTs parameter this object uses for the CryptoCompare API
|
void |
setLimit(int limit) |
sets the limit parameter this object uses for the CryptoCompare API
|
void |
update() |
updates url with parameters, then connects and updates this objects fields
with the returned json.
|
public static HistoricalDaily generateHistoDaily(java.lang.String currencyTo, java.lang.String currencyFrom, ExchangeStreamer.exchanges exchange)
currencyTo
- currency symbol to convert tocurrencyFrom
- currency symbol to convert fromexchange
- exchange to get data frompublic static HistoricalHourly generateHistoHourly(java.lang.String currencyTo, java.lang.String currencyFrom, ExchangeStreamer.exchanges exchange)
currencyTo
- currency symbol to convert tocurrencyFrom
- currency symbol to convert fromexchange
- exchange to get data frompublic static HistoricalMinute generateHistoMinute(java.lang.String currencyTo, java.lang.String currencyFrom, ExchangeStreamer.exchanges exchange)
currencyTo
- currency symbol to convert tocurrencyFrom
- currency symbol to convert fromexchange
- exchange to get data frompublic long getLastUnixTimestamp()
HistoricalBase
getLastUnixTimestamp
in interface HistoricalBase
public void setLastUnixTimestamp(long time)
HistoricalBase
setLastUnixTimestamp
in interface HistoricalBase
time
- the last unix timestamp to get data forpublic int getAggregate()
HistoricalBase
getAggregate
in interface HistoricalBase
public void setAggregate(int aggregate)
HistoricalBase
setAggregate
in interface HistoricalBase
aggregate
- time period to aggregate the data overpublic int getLimit()
HistoricalBase
getLimit
in interface HistoricalBase
public void setLimit(int limit)
HistoricalBase
setLimit
in interface HistoricalBase
limit
- The number of TimestampedData to returnpublic ExchangeStreamer.exchanges getExchange()
CryptoBaseExchange
getExchange
in interface CryptoBaseExchange
public void setExchange(ExchangeStreamer.exchanges exchange)
CryptoBaseExchange
setExchange
in interface CryptoBaseExchange
exchange
- exchange to get data frompublic java.lang.String getCurrencyFrom()
CryptoBase
getCurrencyFrom
in interface CryptoBase
public void setCurrencyFrom(java.lang.String currencyFrom)
CryptoBase
setCurrencyFrom
in interface CryptoBase
currencyFrom
- currency symbol to convert frompublic java.lang.String getCurrencyTo()
CryptoBase
getCurrencyTo
in interface CryptoBase
public void setCurrencyTo(java.lang.String currencyTo)
CryptoBase
setCurrencyTo
in interface CryptoBase
currencyTo
- currency symbol to convert topublic java.net.URL getURL()
getURL
in interface CryptoBase
public java.lang.String getResponse()
getResponse
in interface HistoricalBase
public float getType()
getType
in interface HistoricalBase
public boolean isAggregated()
isAggregated
in interface HistoricalBase
public long getTimeTo()
getTimeTo
in interface HistoricalBase
public long getTimeFrom()
getTimeFrom
in interface HistoricalBase
public boolean isFirstValueInArray()
isFirstValueInArray
in interface HistoricalBase
public ConversionType getConversionType()
HistoricalBase
getConversionType
in interface HistoricalBase
ConversionType
public java.util.stream.Stream<TimestampedData> getDataStream()
HistoricalBase
getDataStream
in interface HistoricalBase
TimestampedData
public abstract TimestampedData getDataAtTime(long timestamp) throws TimestampOutOfBoundsException
HistoricalBase
getDataAtTime
in interface HistoricalBase
timestamp
- unix timestamp of TimestampedData to getTimestampOutOfBoundsException
TimestampedData
public void update() throws InvalidArgumentException
update
in interface CryptoBase
InvalidArgumentException
public java.lang.String dataToString()
dataToString
in interface CryptoBase
TimestampedData.datatoString()
,
ConversionType.datatoString()