public interface BarSeries extends Serializable
bars
separated by a predefined period (e.g. 15
minutes, 1 day, etc.)
Notably, a bar series
can be:
indicator
calculations
Modifier and Type | Method and Description |
---|---|
default void |
addBar(Bar bar)
Adds a bar at the end of the series.
|
void |
addBar(Bar bar,
boolean replace)
Adds a bar at the end of the series.
|
void |
addBar(java.time.Duration timePeriod,
java.time.ZonedDateTime endTime)
Adds a bar at the end of the series.
|
default void |
addBar(java.time.Duration timePeriod,
java.time.ZonedDateTime endTime,
Number openPrice,
Number highPrice,
Number lowPrice,
Number closePrice,
Number volume) |
default void |
addBar(java.time.Duration timePeriod,
java.time.ZonedDateTime endTime,
Number openPrice,
Number highPrice,
Number lowPrice,
Number closePrice,
Number volume,
Number amount) |
void |
addBar(java.time.Duration timePeriod,
java.time.ZonedDateTime endTime,
Num openPrice,
Num highPrice,
Num lowPrice,
Num closePrice,
Num volume)
Adds a new
Bar to the bar series. |
void |
addBar(java.time.Duration timePeriod,
java.time.ZonedDateTime endTime,
Num openPrice,
Num highPrice,
Num lowPrice,
Num closePrice,
Num volume,
Num amount)
Adds a new
Bar to the bar series. |
default void |
addBar(java.time.ZonedDateTime endTime,
Number openPrice,
Number highPrice,
Number lowPrice,
Number closePrice) |
default void |
addBar(java.time.ZonedDateTime endTime,
Number openPrice,
Number highPrice,
Number lowPrice,
Number closePrice,
Number volume) |
default void |
addBar(java.time.ZonedDateTime endTime,
Number openPrice,
Number highPrice,
Number lowPrice,
Number closePrice,
Number volume,
Number amount) |
default void |
addBar(java.time.ZonedDateTime endTime,
Num openPrice,
Num highPrice,
Num lowPrice,
Num closePrice,
Num volume) |
void |
addBar(java.time.ZonedDateTime endTime,
Num openPrice,
Num highPrice,
Num lowPrice,
Num closePrice,
Num volume,
Num amount)
Adds a new
Bar to the bar series. |
default void |
addBar(java.time.ZonedDateTime endTime,
String openPrice,
String highPrice,
String lowPrice,
String closePrice) |
default void |
addBar(java.time.ZonedDateTime endTime,
String openPrice,
String highPrice,
String lowPrice,
String closePrice,
String volume) |
default void |
addBar(java.time.ZonedDateTime endTime,
String openPrice,
String highPrice,
String lowPrice,
String closePrice,
String volume,
String amount) |
void |
addPrice(Num price)
Adds a price to the last bar
|
default void |
addPrice(Number price) |
default void |
addPrice(String price) |
default void |
addTrade(Number tradeVolume,
Number tradePrice)
Adds a trade at the end of bar period.
|
void |
addTrade(Num tradeVolume,
Num tradePrice)
Adds a trade at the end of bar period.
|
default void |
addTrade(String tradeVolume,
String tradePrice)
Adds a trade at the end of bar period.
|
java.util.function.Function<Number,Num> |
function()
Returns the underlying function to transform a Number into the Num
implementation used by this bar series
|
Bar |
getBar(int i) |
int |
getBarCount() |
List<Bar> |
getBarData()
Warning: should be used carefully!
|
int |
getBeginIndex() |
int |
getEndIndex() |
default Bar |
getFirstBar() |
default Bar |
getLastBar() |
int |
getMaximumBarCount() |
String |
getName() |
int |
getRemovedBarsCount() |
default String |
getSeriesPeriodDescription() |
BarSeries |
getSubSeries(int startIndex,
int endIndex)
Returns a new
BarSeries instance that is a subset of this BarSeries
instance. |
default boolean |
isEmpty() |
Num |
numOf(Number number)
Transforms a
Number into the implementation used by this
bar series |
void |
setMaximumBarCount(int maximumBarCount)
Sets the maximum number of bars that will be retained in the series.
|
String getName()
Bar getBar(int i)
i
- an indexdefault Bar getFirstBar()
default Bar getLastBar()
int getBarCount()
default boolean isEmpty()
List<Bar> getBarData()
bars
. It may be: - a shortened bar
list if a maximum bar count has been set - an extended bar list if it is a
constrained bar seriesint getBeginIndex()
int getEndIndex()
default String getSeriesPeriodDescription()
int getMaximumBarCount()
void setMaximumBarCount(int maximumBarCount)
maximumBarCount
- the maximum bar countint getRemovedBarsCount()
default void addBar(Bar bar)
bar
- the bar to be addedsetMaximumBarCount(int)
void addBar(Bar bar, boolean replace)
bar
- the bar to be addedreplace
- true to replace the latest bar. Some exchange provide
continuous new bar data in the time period. (eg. 1s in 1m
Duration)setMaximumBarCount(int)
void addBar(java.time.Duration timePeriod, java.time.ZonedDateTime endTime)
timePeriod
- the Duration
of this barendTime
- the end time
of this bardefault void addBar(java.time.ZonedDateTime endTime, Number openPrice, Number highPrice, Number lowPrice, Number closePrice)
default void addBar(java.time.ZonedDateTime endTime, Number openPrice, Number highPrice, Number lowPrice, Number closePrice, Number volume)
default void addBar(java.time.ZonedDateTime endTime, Number openPrice, Number highPrice, Number lowPrice, Number closePrice, Number volume, Number amount)
default void addBar(java.time.Duration timePeriod, java.time.ZonedDateTime endTime, Number openPrice, Number highPrice, Number lowPrice, Number closePrice, Number volume)
default void addBar(java.time.Duration timePeriod, java.time.ZonedDateTime endTime, Number openPrice, Number highPrice, Number lowPrice, Number closePrice, Number volume, Number amount)
default void addBar(java.time.ZonedDateTime endTime, String openPrice, String highPrice, String lowPrice, String closePrice)
default void addBar(java.time.ZonedDateTime endTime, String openPrice, String highPrice, String lowPrice, String closePrice, String volume)
default void addBar(java.time.ZonedDateTime endTime, String openPrice, String highPrice, String lowPrice, String closePrice, String volume, String amount)
default void addBar(java.time.ZonedDateTime endTime, Num openPrice, Num highPrice, Num lowPrice, Num closePrice, Num volume)
void addBar(java.time.ZonedDateTime endTime, Num openPrice, Num highPrice, Num lowPrice, Num closePrice, Num volume, Num amount)
Bar
to the bar series.endTime
- end time of the baropenPrice
- the open pricehighPrice
- the high/max pricelowPrice
- the low/min priceclosePrice
- the last/close pricevolume
- the volume (default zero)amount
- the amount (default zero)void addBar(java.time.Duration timePeriod, java.time.ZonedDateTime endTime, Num openPrice, Num highPrice, Num lowPrice, Num closePrice, Num volume)
Bar
to the bar series.endTime
- end time of the baropenPrice
- the open pricehighPrice
- the high/max pricelowPrice
- the low/min priceclosePrice
- the last/close pricevolume
- the volume (default zero)void addBar(java.time.Duration timePeriod, java.time.ZonedDateTime endTime, Num openPrice, Num highPrice, Num lowPrice, Num closePrice, Num volume, Num amount)
Bar
to the bar series.timePeriod
- the time period of the barendTime
- end time of the baropenPrice
- the open pricehighPrice
- the high/max pricelowPrice
- the low/min priceclosePrice
- the last/close pricevolume
- the volume (default zero)amount
- the amount (default zero)default void addTrade(Number tradeVolume, Number tradePrice)
tradeVolume
- the traded volumetradePrice
- the pricedefault void addTrade(String tradeVolume, String tradePrice)
tradeVolume
- the traded volumetradePrice
- the pricevoid addTrade(Num tradeVolume, Num tradePrice)
tradeVolume
- the traded volumetradePrice
- the pricevoid addPrice(Num price)
price
- the price for the bardefault void addPrice(String price)
default void addPrice(Number price)
BarSeries getSubSeries(int startIndex, int endIndex)
BarSeries
instance that is a subset of this BarSeries
instance. It holds a copy of all bars
between startIndex
(inclusive) and endIndex (exclusive) of this BarSeries. The indices
of this BarSeries and the new subset BarSeries can be different. I. e. index
0 of the new BarSeries will be index startIndex of this BarSeries.
If startIndex < this.seriesBeginIndex the new BarSeries will start
with the first available Bar of this BarSeries. If endIndex >
this.seriesEndIndex the new BarSeries will end at the last available Bar of
this BarSeriesstartIndex
- the startIndex (inclusive)endIndex
- the endIndex (exclusive)IllegalArgumentException
- if endIndex <= startIndex or startIndex < 0Num numOf(Number number)
Number
into the implementation
used by this
bar seriesnumber
- a Number
implementing object.java.util.function.Function<Number,Num> function()
Copyright © 2014–2019. All rights reserved.