Package org.ta4j.core
Class BaseBar
java.lang.Object
org.ta4j.core.BaseBar
- All Implemented Interfaces:
Serializable
,Bar
public class BaseBar extends Object implements Bar
Base implementation of a
Bar
.- See Also:
- Serialized Form
-
Constructor Summary
ConstructorsConstructorDescriptionBaseBar(Duration timePeriod, ZonedDateTime endTime, double openPrice, double highPrice, double lowPrice, double closePrice, double volume)
Constructor.BaseBar(Duration timePeriod, ZonedDateTime endTime, double openPrice, double highPrice, double lowPrice, double closePrice, double volume, double amount)
Constructor.BaseBar(Duration timePeriod, ZonedDateTime endTime, double openPrice, double highPrice, double lowPrice, double closePrice, double volume, double amount, long trades, Function<Number,Num> numFunction)
Constructor.BaseBar(Duration timePeriod, ZonedDateTime endTime, String openPrice, String highPrice, String lowPrice, String closePrice, String volume)
Constructor.BaseBar(Duration timePeriod, ZonedDateTime endTime, String openPrice, String highPrice, String lowPrice, String closePrice, String volume, String amount)
Constructor.BaseBar(Duration timePeriod, ZonedDateTime endTime, String openPrice, String highPrice, String lowPrice, String closePrice, String volume, String amount, String trades, Function<Number,Num> numFunction)
Constructor.BaseBar(Duration timePeriod, ZonedDateTime endTime, BigDecimal openPrice, BigDecimal highPrice, BigDecimal lowPrice, BigDecimal closePrice, BigDecimal volume)
Constructor.BaseBar(Duration timePeriod, ZonedDateTime endTime, BigDecimal openPrice, BigDecimal highPrice, BigDecimal lowPrice, BigDecimal closePrice, BigDecimal volume, BigDecimal amount)
Constructor.BaseBar(Duration timePeriod, ZonedDateTime endTime, BigDecimal openPrice, BigDecimal highPrice, BigDecimal lowPrice, BigDecimal closePrice, BigDecimal volume, BigDecimal amount, long trades, Function<Number,Num> numFunction)
Constructor.Constructor.BaseBar(Duration timePeriod, ZonedDateTime endTime, Num openPrice, Num highPrice, Num lowPrice, Num closePrice, Num volume, Num amount)
Constructor.BaseBar(Duration timePeriod, ZonedDateTime endTime, Num openPrice, Num highPrice, Num lowPrice, Num closePrice, Num volume, Num amount, long trades)
Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
Adds a trade at the end of bar period.static BaseBarBuilder
builder()
Returns BaseBarBuilderstatic <T> ConvertibleBaseBarBuilder<T>
Returns BaseBarBuilderboolean
long
int
hashCode()
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.ta4j.core.Bar
addPrice, addPrice, addTrade, addTrade, getDateName, getSimpleDateName, inPeriod, isBearish, isBullish
-
Constructor Details
-
BaseBar
Constructor.- Parameters:
timePeriod
- the time periodendTime
- the end time of the bar periodnumFunction
- the numbers precision
-
BaseBar
public BaseBar(Duration timePeriod, ZonedDateTime endTime, double openPrice, double highPrice, double lowPrice, double closePrice, double volume)Constructor.- Parameters:
timePeriod
- the time periodendTime
- the end time of the bar periodopenPrice
- the open price of the bar periodhighPrice
- the highest price of the bar periodlowPrice
- the lowest price of the bar periodclosePrice
- the close price of the bar periodvolume
- the volume of the bar period
-
BaseBar
public BaseBar(Duration timePeriod, ZonedDateTime endTime, double openPrice, double highPrice, double lowPrice, double closePrice, double volume, double amount)Constructor.- Parameters:
timePeriod
- the time periodendTime
- the end time of the bar periodopenPrice
- the open price of the bar periodhighPrice
- the highest price of the bar periodlowPrice
- the lowest price of the bar periodclosePrice
- the close price of the bar periodvolume
- the volume of the bar periodamount
- the amount of the bar period
-
BaseBar
public BaseBar(Duration timePeriod, ZonedDateTime endTime, double openPrice, double highPrice, double lowPrice, double closePrice, double volume, double amount, long trades, Function<Number,Num> numFunction)Constructor.- Parameters:
timePeriod
- the time periodendTime
- the end time of the bar periodopenPrice
- the open price of the bar periodhighPrice
- the highest price of the bar periodlowPrice
- the lowest price of the bar periodclosePrice
- the close price of the bar periodvolume
- the volume of the bar periodamount
- the amount of the bar periodtrades
- the trades count of the bar periodnumFunction
- the numbers precision
-
BaseBar
public BaseBar(Duration timePeriod, ZonedDateTime endTime, BigDecimal openPrice, BigDecimal highPrice, BigDecimal lowPrice, BigDecimal closePrice, BigDecimal volume)Constructor.- Parameters:
timePeriod
- the time periodendTime
- the end time of the bar periodopenPrice
- the open price of the bar periodhighPrice
- the highest price of the bar periodlowPrice
- the lowest price of the bar periodclosePrice
- the close price of the bar periodvolume
- the volume of the bar period
-
BaseBar
public BaseBar(Duration timePeriod, ZonedDateTime endTime, BigDecimal openPrice, BigDecimal highPrice, BigDecimal lowPrice, BigDecimal closePrice, BigDecimal volume, BigDecimal amount)Constructor.- Parameters:
timePeriod
- the time periodendTime
- the end time of the bar periodopenPrice
- the open price of the bar periodhighPrice
- the highest price of the bar periodlowPrice
- the lowest price of the bar periodclosePrice
- the close price of the bar periodvolume
- the volume of the bar periodamount
- the amount of the bar period
-
BaseBar
public BaseBar(Duration timePeriod, ZonedDateTime endTime, BigDecimal openPrice, BigDecimal highPrice, BigDecimal lowPrice, BigDecimal closePrice, BigDecimal volume, BigDecimal amount, long trades, Function<Number,Num> numFunction)Constructor.- Parameters:
timePeriod
- the time periodendTime
- the end time of the bar periodopenPrice
- the open price of the bar periodhighPrice
- the highest price of the bar periodlowPrice
- the lowest price of the bar periodclosePrice
- the close price of the bar periodvolume
- the volume of the bar periodamount
- the amount of the bar periodtrades
- the trades count of the bar periodnumFunction
- the numbers precision
-
BaseBar
public BaseBar(Duration timePeriod, ZonedDateTime endTime, String openPrice, String highPrice, String lowPrice, String closePrice, String volume)Constructor.- Parameters:
timePeriod
- the time periodendTime
- the end time of the bar periodopenPrice
- the open price of the bar periodhighPrice
- the highest price of the bar periodlowPrice
- the lowest price of the bar periodclosePrice
- the close price of the bar periodvolume
- the volume of the bar period
-
BaseBar
public BaseBar(Duration timePeriod, ZonedDateTime endTime, String openPrice, String highPrice, String lowPrice, String closePrice, String volume, String amount)Constructor.- Parameters:
timePeriod
- the time periodendTime
- the end time of the bar periodopenPrice
- the open price of the bar periodhighPrice
- the highest price of the bar periodlowPrice
- the lowest price of the bar periodclosePrice
- the close price of the bar periodvolume
- the volume of the bar periodamount
- the amount of the bar period
-
BaseBar
public BaseBar(Duration timePeriod, ZonedDateTime endTime, String openPrice, String highPrice, String lowPrice, String closePrice, String volume, String amount, String trades, Function<Number,Num> numFunction)Constructor.- Parameters:
timePeriod
- the time periodendTime
- the end time of the bar periodopenPrice
- the open price of the bar periodhighPrice
- the highest price of the bar periodlowPrice
- the lowest price of the bar periodclosePrice
- the close price of the bar periodvolume
- the volume of the bar periodamount
- the amount of the bar periodtrades
- the trades count of the bar periodnumFunction
- the numbers precision
-
BaseBar
public BaseBar(Duration timePeriod, ZonedDateTime endTime, Num openPrice, Num highPrice, Num lowPrice, Num closePrice, Num volume, Num amount)Constructor.- Parameters:
timePeriod
- the time periodendTime
- the end time of the bar periodopenPrice
- the open price of the bar periodhighPrice
- the highest price of the bar periodlowPrice
- the lowest price of the bar periodclosePrice
- the close price of the bar periodvolume
- the volume of the bar periodamount
- the amount of the bar period
-
BaseBar
public BaseBar(Duration timePeriod, ZonedDateTime endTime, Num openPrice, Num highPrice, Num lowPrice, Num closePrice, Num volume, Num amount, long trades)Constructor.- Parameters:
timePeriod
- the time periodendTime
- the end time of the bar periodopenPrice
- the open price of the bar periodhighPrice
- the highest price of the bar periodlowPrice
- the lowest price of the bar periodclosePrice
- the close price of the bar periodvolume
- the volume of the bar periodamount
- the amount of the bar periodtrades
- the trades count of the bar period
-
-
Method Details
-
builder
Returns BaseBarBuilder- Returns:
- builder of class BaseBarBuilder
-
builder
public static <T> ConvertibleBaseBarBuilder<T> builder(Function<T,Num> conversionFunction, Class<T> clazz)Returns BaseBarBuilder- Returns:
- builder of class BaseBarBuilder
-
getOpenPrice
- Specified by:
getOpenPrice
in interfaceBar
- Returns:
- the open price of the period
-
getLowPrice
- Specified by:
getLowPrice
in interfaceBar
- Returns:
- the low price of the period
-
getHighPrice
- Specified by:
getHighPrice
in interfaceBar
- Returns:
- the high price of the period
-
getClosePrice
- Specified by:
getClosePrice
in interfaceBar
- Returns:
- the close price of the period
-
getVolume
-
getTrades
public long getTrades() -
getAmount
-
getTimePeriod
- Specified by:
getTimePeriod
in interfaceBar
- Returns:
- the time period of the bar
-
getBeginTime
- Specified by:
getBeginTime
in interfaceBar
- Returns:
- the begin timestamp of the bar period
-
getEndTime
- Specified by:
getEndTime
in interfaceBar
- Returns:
- the end timestamp of the bar period
-
addTrade
Adds a trade at the end of bar period. -
addPrice
-
toString
-
hashCode
public int hashCode() -
equals
-