using BinanceExchange.API.Models.Response;
using Newtonsoft.Json;
using SignalsTest;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SignalsTest
{
    public class TAReport
    {
        public Dictionary<int, decimal> SMAs = new Dictionary<int, decimal>();
        public Dictionary<int, decimal> EMAs = new Dictionary<int, decimal>();

        public decimal MACD = 0;
        public decimal EMACD = 0;

        public decimal ATR = 0;
        public decimal AVGDiff = 0;

        public static TAReport Generate(List<KlineCandleStickResponse> response, int index, int[] m_SMA, int[] m_EMA)
        {
            TAReport report = new TAReport();

            foreach(int sma in m_SMA)
            {
                report.SMAs.Add(sma, Indicators.getSMA(response, index, sma));
            }

            foreach (int ema in m_EMA)
            {
                report.SMAs.Add(ema, Indicators.getEMA(response, index, 0, ema));
            }

            report.MACD = Indicators.getMACD(response, 12, 26, index);

            return report;
        }


    }
}


public static class CustomExtensions
{

    public static string toJson(this TAReport report)
    {
        return JsonConvert.SerializeObject(report);
    }
}