Knocks/BackEnd/Knoks.CryptoExchanges/Data/Dao/KnokDao.cs

40 lines
1.2 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Knoks.CryptoExchanges.Data.Interfaces;
using Knoks.CryptoExchanges.Entities;
using Knoks.Framework.DataAccess;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Knoks.CryptoExchanges.Data.Dao
{
public class KnokDao : IKnokDao
{
private IProcExecutor executor;
public KnokDao(IProcExecutor executor)
{
this.executor = executor;
}
public async Task<IEnumerable<Tuple<string, string>>> GetActiveKnoksDataByExchange(int exchangeId)
{
return (await executor.Go(DatabaseNames.Prices, "GetActivePair", new { ExchangeId = exchangeId }))
.Тables[0].ToList<KnoksPairsData>()
.Select(it => new Tuple<string, string>(it.Base, it.NonBase));
}
public async Task RecalcAggregations()
{
await executor.Go(DatabaseNames.Prices, "RecalcAggregations");
}
private class KnoksPairsData
{
public int ExchangeId { get; set; }
public string Base { get; set; }
public string NonBase { get; set; }
public DateTime? LastDate { get; set; }
}
}
}