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

33 lines
1.1 KiB
C#
Raw 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.CryptoExchanges.Entities.Args;
using Knoks.Framework.DataAccess;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Knoks.Framework.Extentions;
namespace Knoks.CryptoExchanges.Data.Dao
{
public class ExchangePairRateDao : IExchangePairRateDao
{
private IProcExecutor executor;
public ExchangePairRateDao(IProcExecutor executor)
{
this.executor = executor;
}
public async Task UpdateExchangePairRate(int exchangeId, ExchangePairRateArg arg)
{
await executor.Go(DatabaseNames.Prices, "Agg_1Minute", arg, new { ExchangeId = exchangeId });
}
public async Task<List<LiveRateItem>> GetLiveRates(List<LiveRateItemRequest> searchItems)
{
var dbTable = await executor.Go(DatabaseNames.Prices, "KST_GetUpdatedLiveRates", new { SearchItemsList = searchItems.ToDataTable()});
return dbTable.Тables[0].Rows.Select(row => row.To<LiveRateItem>()).ToList();
}
}
}