// Path: src/main/java/ch/urbanfox/freqtrade/analyze/AnalyzeService.java
// public interface AnalyzeService {
// 
//     /**
//      * Calculates a buy signal based several technical analysis indicators
//      *
//      * @param tickers the tickers to analyze
//      * @return true if pair is good for buying, false otherwise
//      */
//     boolean getBuySignal(TimeSeries tickers);
// 
// }
// 
// Path: src/main/java/ch/urbanfox/freqtrade/analyze/AnalyzeServiceImpl.java
// @Service
// public class AnalyzeServiceImpl implements AnalyzeService {
// 
//     private static final Logger LOGGER = LoggerFactory.getLogger(AnalyzeServiceImpl.class);
// 
//     @Override
//     public boolean getBuySignal(TimeSeries tickers) {
// 
//         BuySignalIndicator buySignal = new BuySignalIndicator(tickers, 33, Decimal.valueOf(0.25));
// 
//         // Need to go through all index to initialize indicators
//         for (int i = tickers.getBeginIndex(); i <= tickers.getEndIndex(); i++) {
//             buySignal.getValue(i);
//         }
// 
//         boolean signal = buySignal.getValue(tickers.getEndIndex());
//         LOGGER.debug("buy_trigger: {} (end time={})", signal, tickers.getLastTick().getEndTime());
//         return signal;
//     }
// 
// }
// 
// Path: src/main/java/ch/urbanfox/freqtrade/exchange/converter/BittrexDataConverter.java
// public class BittrexDataConverter {
//     
//     public TimeSeries parseRawTickers(List<BittrexChartData> rawData) {
// 
//         List<Tick> ticks = rawData.stream()
//                 .map(this::convertTick)
//                 .collect(Collectors.toList());
// 
//         return new BaseTimeSeries(ticks);
//     }
// 
//     private BaseTick convertTick(BittrexChartData data) {
// 
//         return new BaseTick(ZonedDateTime.ofInstant(data.getTimeStamp().toInstant(), ZoneId.systemDefault()),
//                 Decimal.valueOf(data.getOpen().toString()),
//                 Decimal.valueOf(data.getHigh().toString()),
//                 Decimal.valueOf(data.getLow().toString()),
//                 Decimal.valueOf(data.getClose().toString()),
//                 Decimal.valueOf(data.getVolume().toString()));
//     }
// 
// }


import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
import java.util.stream.Collectors;
import org.knowm.xchange.bittrex.dto.marketdata.BittrexChartData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import ch.urbanfox.freqtrade.analyze.AnalyzeService;
import ch.urbanfox.freqtrade.analyze.AnalyzeServiceImpl;
import ch.urbanfox.freqtrade.exchange.converter.BittrexDataConverter;
import eu.verdelhan.ta4j.TimeSeries;

package ch.urbanfox.freqtrade.tester;





public class StrategyTester {

    private static final Logger LOGGER = LoggerFactory.getLogger(StrategyTester.class);

    private static final int WINDOW_SIZE = 72;

    public static void main(String[] args) throws IOException {

        byte[] jsonAsBytes = Files.readAllBytes(Paths.get("src", "test", "resources", "data", "ETH_BTC.json"));

        ObjectMapper mapper = new ObjectMapper();

        List<BittrexChartData> result = mapper.readValue(jsonAsBytes, new TypeReference<List<BittrexChartData>>() {});

        LOGGER.info("Parsed json file: {} ticks", result.size());


// Path: src/main/java/ch/urbanfox/freqtrade/analyze/AnalyzeService.java
// public interface AnalyzeService {
// 
//     /**
//      * Calculates a buy signal based several technical analysis indicators
//      *
//      * @param tickers the tickers to analyze
//      * @return true if pair is good for buying, false otherwise
//      */
//     boolean getBuySignal(TimeSeries tickers);
// 
// }
// 
// Path: src/main/java/ch/urbanfox/freqtrade/analyze/AnalyzeServiceImpl.java
// @Service
// public class AnalyzeServiceImpl implements AnalyzeService {
// 
//     private static final Logger LOGGER = LoggerFactory.getLogger(AnalyzeServiceImpl.class);
// 
//     @Override
//     public boolean getBuySignal(TimeSeries tickers) {
// 
//         BuySignalIndicator buySignal = new BuySignalIndicator(tickers, 33, Decimal.valueOf(0.25));
// 
//         // Need to go through all index to initialize indicators
//         for (int i = tickers.getBeginIndex(); i <= tickers.getEndIndex(); i++) {
//             buySignal.getValue(i);
//         }
// 
//         boolean signal = buySignal.getValue(tickers.getEndIndex());
//         LOGGER.debug("buy_trigger: {} (end time={})", signal, tickers.getLastTick().getEndTime());
//         return signal;
//     }
// 
// }
// 
// Path: src/main/java/ch/urbanfox/freqtrade/exchange/converter/BittrexDataConverter.java
// public class BittrexDataConverter {
//     
//     public TimeSeries parseRawTickers(List<BittrexChartData> rawData) {
// 
//         List<Tick> ticks = rawData.stream()
//                 .map(this::convertTick)
//                 .collect(Collectors.toList());
// 
//         return new BaseTimeSeries(ticks);
//     }
// 
//     private BaseTick convertTick(BittrexChartData data) {
// 
//         return new BaseTick(ZonedDateTime.ofInstant(data.getTimeStamp().toInstant(), ZoneId.systemDefault()),
//                 Decimal.valueOf(data.getOpen().toString()),
//                 Decimal.valueOf(data.getHigh().toString()),
//                 Decimal.valueOf(data.getLow().toString()),
//                 Decimal.valueOf(data.getClose().toString()),
//                 Decimal.valueOf(data.getVolume().toString()));
//     }
// 
// }


// Path: src/test/java/ch/urbanfox/freqtrade/tester/StrategyTester.java
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
import java.util.stream.Collectors;
import org.knowm.xchange.bittrex.dto.marketdata.BittrexChartData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import ch.urbanfox.freqtrade.analyze.AnalyzeService;
import ch.urbanfox.freqtrade.analyze.AnalyzeServiceImpl;
import ch.urbanfox.freqtrade.exchange.converter.BittrexDataConverter;
import eu.verdelhan.ta4j.TimeSeries;

package ch.urbanfox.freqtrade.tester;





public class StrategyTester {

    private static final Logger LOGGER = LoggerFactory.getLogger(StrategyTester.class);

    private static final int WINDOW_SIZE = 72;

    public static void main(String[] args) throws IOException {

        byte[] jsonAsBytes = Files.readAllBytes(Paths.get("src", "test", "resources", "data", "ETH_BTC.json"));

        ObjectMapper mapper = new ObjectMapper();

        List<BittrexChartData> result = mapper.readValue(jsonAsBytes, new TypeReference<List<BittrexChartData>>() {});

        LOGGER.info("Parsed json file: {} ticks", result.size());


        AnalyzeService analyzeService = new AnalyzeServiceImpl();
