using Binance.Net.Interfaces;
using FTX.Net.Objects.Models;
using Managing.Domain.Candles;
using static Managing.Common.Enums;

namespace Managing.Infrastructure.Exchanges
{
    public static class CandleHelpers
    {
        internal static Candle Map(FTXKline lastCandle)
        {
            return new Candle
            {
                OpenTime = lastCandle.OpenTime,
                High = lastCandle.HighPrice,
                Low = lastCandle.LowPrice,
                Close = lastCandle.ClosePrice,
                Open = lastCandle.OpenPrice
            };
        }

        internal static Candle Map(IBinanceStreamKline candle, Ticker ticker, Timeframe timeframe)
        {
            return new Candle()
            {
                Ticker = ticker.ToString(),
                Timeframe = timeframe,
                Volume = candle.Volume,
                Close = candle.ClosePrice,
                Date = candle.CloseTime,
                Open = candle.OpenPrice,
                OpenTime = candle.OpenTime,
                High = candle.HighPrice,
                Low = candle.LowPrice,
            };
        }
    }
}