org.ta4j.core.ConvertibleBaseBarBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ta4j-core Show documentation
Show all versions of ta4j-core Show documentation
ta4j is a Java library providing a simple API for technical analysis.
The newest version!
/**
* The MIT License (MIT)
*
* Copyright (c) 2014-2017 Marc de Verdelhan, 2017-2019 Ta4j Organization & respective
* authors (see AUTHORS)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package org.ta4j.core;
import org.ta4j.core.num.Num;
import java.time.Duration;
import java.time.ZonedDateTime;
import java.util.function.Function;
public class ConvertibleBaseBarBuilder extends BaseBarBuilder {
private final Function conversionFunction;
public ConvertibleBaseBarBuilder(Function conversionFunction) {
this.conversionFunction = conversionFunction;
}
@Override
public ConvertibleBaseBarBuilder timePeriod(Duration timePeriod) {
super.timePeriod(timePeriod);
return this;
}
@Override
public ConvertibleBaseBarBuilder endTime(ZonedDateTime endTime) {
super.endTime(endTime);
return this;
}
@Override
public ConvertibleBaseBarBuilder trades(int trades) {
super.trades(trades);
return this;
}
public ConvertibleBaseBarBuilder openPrice(T openPrice) {
super.openPrice(conversionFunction.apply(openPrice));
return this;
}
public ConvertibleBaseBarBuilder highPrice(T highPrice) {
super.highPrice(conversionFunction.apply(highPrice));
return this;
}
public ConvertibleBaseBarBuilder lowPrice(T lowPrice) {
super.lowPrice(conversionFunction.apply(lowPrice));
return this;
}
public ConvertibleBaseBarBuilder closePrice(T closePrice) {
super.closePrice(conversionFunction.apply(closePrice));
return this;
}
public ConvertibleBaseBarBuilder amount(T amount) {
super.amount(conversionFunction.apply(amount));
return this;
}
public ConvertibleBaseBarBuilder volume(T volume) {
super.volume(conversionFunction.apply(volume));
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy