<commit_before>package roart.talib;

import java.time.LocalDate;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.commons.lang3.tuple.Pair;
import org.jfree.data.category.DefaultCategoryDataset;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.ta4j.core.BaseTimeSeries;
import org.ta4j.core.TimeSeries;
import org.ta4j.core.indicators.EMAIndicator;
import org.ta4j.core.indicators.MACDIndicator;
import org.ta4j.core.indicators.StochasticRSIIndicator;
import org.ta4j.core.indicators.helpers.ClosePriceIndicator;
import org.ta4j.core.num.DoubleNum;
import org.ta4j.core.num.Num;
import org.ta4j.core.num.PrecisionNum;

import com.tictactec.ta.lib.Core;
import com.tictactec.ta.lib.MAType;
import com.tictactec.ta.lib.MInteger;

import roart.common.constants.Constants;
import roart.common.util.ArraysUtil;
import roart.model.StockItem;
import roart.model.data.MarketData;
import roart.model.data.PeriodData;
import roart.stockutil.StockDao;
import roart.stockutil.StockUtil;

public abstract class Ta4j extends Ta {

    protected TimeSeries getClosedSeries(double[] values, int size) {
        LocalDate date = LocalDate.now();
        TimeSeries series = new BaseTimeSeries();
        for (int i = 0; i < size; i++) {
            Num open = null;
            Num high = null;
            Num low = null;
            Num close = PrecisionNum.valueOf(values[i]);
            Num volume = null;
            LocalDate aDate = date.minusDays(size - 1 - i);
            ZonedDateTime endTime = aDate.atStartOfDay(ZoneOffset.UTC);
            series.addBar(endTime, open, high, low, close, volume);
        }
        return series;
    }

    protected TimeSeries getThreeSeries(double[] values, double low[], double high[], int size) {
        LocalDate date = LocalDate.now();
        TimeSeries series = new BaseTimeSeries();
        for (int i = 0; i < size; i++) {
            Num open = null;
            Num high = PrecisionNum.valueOf(high[i]);
            Num low = PrecisionNum.valueOf(low[i]);
            Num close = PrecisionNum.valueOf(values[i]);
            Num volume = null;
            LocalDate aDate = date.minusDays(size - 1 - i);
            ZonedDateTime endTime = aDate.atStartOfDay(ZoneOffset.UTC);
            series.addBar(endTime, open, high, low, close, volume);
        }
        return series;
    }



}<commit_msg>Add new TA lib (I67).<commit_after>package roart.talib;

import java.time.LocalDate;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.commons.lang3.tuple.Pair;
import org.jfree.data.category.DefaultCategoryDataset;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.ta4j.core.BaseTimeSeries;
import org.ta4j.core.TimeSeries;
import org.ta4j.core.indicators.EMAIndicator;
import org.ta4j.core.indicators.MACDIndicator;
import org.ta4j.core.indicators.StochasticRSIIndicator;
import org.ta4j.core.indicators.helpers.ClosePriceIndicator;
import org.ta4j.core.num.DoubleNum;
import org.ta4j.core.num.Num;
import org.ta4j.core.num.PrecisionNum;

import com.tictactec.ta.lib.Core;
import com.tictactec.ta.lib.MAType;
import com.tictactec.ta.lib.MInteger;

import roart.common.constants.Constants;
import roart.common.util.ArraysUtil;
import roart.model.StockItem;
import roart.model.data.MarketData;
import roart.model.data.PeriodData;
import roart.stockutil.StockDao;
import roart.stockutil.StockUtil;

public abstract class Ta4j extends Ta {

    protected TimeSeries getClosedSeries(double[] values, int size) {
        LocalDate date = LocalDate.now();
        TimeSeries series = new BaseTimeSeries();
        for (int i = 0; i < size; i++) {
            Num open = null;
            Num high = null;
            Num low = null;
            Num close = PrecisionNum.valueOf(values[i]);
            Num volume = null;
            LocalDate aDate = date.minusDays(size - 1 - i);
            ZonedDateTime endTime = aDate.atStartOfDay(ZoneOffset.UTC);
            series.addBar(endTime, open, high, low, close, volume);
        }
        return series;
    }

    protected TimeSeries getThreeSeries(double[] close, double low[], double high[], int size) {
        LocalDate date = LocalDate.now();
        TimeSeries series = new BaseTimeSeries();
        for (int i = 0; i < size; i++) {
            Num openNum = null;
            Num highNum = PrecisionNum.valueOf(high[i]);
            Num lowNum = PrecisionNum.valueOf(low[i]);
            Num closeNum = PrecisionNum.valueOf(close[i]);
            Num volumeNum = null;
            LocalDate aDate = date.minusDays(size - 1 - i);
            ZonedDateTime endTime = aDate.atStartOfDay(ZoneOffset.UTC);
            series.addBar(endTime, openNum, highNum, lowNum, closeNum, volumeNum);
        }
        return series;
    }



}
{'fraction_non_alphanumeric': 0.10942429022082019, 'fraction_numerical': 0.007097791798107256, 'mean_word_length': 3.0584, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5208587', 'n_tokens_mistral': 1628, 'n_tokens_neox': 1610, 'n_words': 356}