package link.at17.mid.tushare.test;

import java.util.List;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import link.at17.mid.tushare.dao.StockDailyDao;
import link.at17.mid.tushare.data.models.StockValueEx;
import link.at17.mid.tushare.data.util.Indicators;
import link.at17.mid.tushare.system.util.LocalDateTimeUtils;
import lombok.extern.slf4j.Slf4j;

@SpringBootTest
@Slf4j
class IndicatorTest {

    @Autowired
    StockDailyDao stockDailyDao;
    
    @Test
    void contextLoads() {
    }
    
    @Test
    void testIndicator() {
        List<StockValueEx> values = stockDailyDao.getExQfqDailyBefore("001256.SZ", null, null);
        List<Double> vpci = Indicators.getVPCI(values, 14, 5);
        List<Double> vwma = Indicators.getVWMA(values, 14);
        for (int i = 0; i < values.size(); i++) {
            log.info("{} vpci: {}, vwma(14): {}", LocalDateTimeUtils.format(values.get(i).getDate(), "yyyy-MM-dd")
                    , vpci.get(i)
                    , vwma.get(i));
        }
    }
}
