86 lines
3.3 KiB
C#
86 lines
3.3 KiB
C#
using Managing.Application.Abstractions.Repositories;
|
|
using Managing.Application.Abstractions.Services;
|
|
using Managing.Application.Backtesting;
|
|
using Managing.Application.Bots;
|
|
using Managing.Infrastructure.Databases;
|
|
using Managing.Infrastructure.Databases.InfluxDb;
|
|
using Managing.Infrastructure.Databases.InfluxDb.Models;
|
|
using Managing.Infrastructure.Evm;
|
|
using Managing.Infrastructure.Evm.Abstractions;
|
|
using Managing.Infrastructure.Evm.Services;
|
|
using Managing.Infrastructure.Evm.Subgraphs;
|
|
using Managing.Infrastructure.Exchanges;
|
|
using Managing.Infrastructure.Exchanges.Abstractions;
|
|
using Managing.Infrastructure.Exchanges.Exchanges;
|
|
using Microsoft.Extensions.Logging;
|
|
using Moq;
|
|
using static Managing.Common.Enums;
|
|
|
|
namespace Managing.Application.Tests
|
|
{
|
|
public static class TradingBaseTests
|
|
{
|
|
public static IExchangeService GetExchangeService()
|
|
{
|
|
ILoggerFactory loggerFactory = new Microsoft.Extensions.Logging.Abstractions.NullLoggerFactory();
|
|
|
|
var ChainlinkGmx = new ChainlinkGmx(SubgraphService.GetSubgraphClient(SubgraphProvider.ChainlinkGmx));
|
|
var Chainlink = new Chainlink(SubgraphService.GetSubgraphClient(SubgraphProvider.ChainlinkPrice));
|
|
var GbcFeed = new Gbc(SubgraphService.GetSubgraphClient(SubgraphProvider.Gbc));
|
|
|
|
var Subgraphs = new List<ISubgraphPrices>
|
|
{
|
|
ChainlinkGmx,
|
|
Chainlink,
|
|
GbcFeed
|
|
};
|
|
var evmManager = new EvmManager(Subgraphs);
|
|
var evmProcessor = new EvmProcessor(new Mock<ILogger<EvmProcessor>>().Object, evmManager);
|
|
|
|
var exchangeProcessors = new List<IExchangeProcessor>()
|
|
{
|
|
//new Mock<FtxProcessor>().Object,
|
|
//new Mock<BinanceProcessor>().Object,
|
|
evmProcessor
|
|
};
|
|
|
|
return new ExchangeService(loggerFactory.CreateLogger<ExchangeService>(), GetCandleRepository(), exchangeProcessors);
|
|
}
|
|
|
|
public static ILogger<TradingBot> CreateTradingBotLogger()
|
|
{
|
|
ILoggerFactory loggerFactory = new Microsoft.Extensions.Logging.Abstractions.NullLoggerFactory();
|
|
|
|
return loggerFactory.CreateLogger<TradingBot>();
|
|
}
|
|
|
|
public static ILogger<Backtester> CreateBacktesterLogger()
|
|
{
|
|
ILoggerFactory loggerFactory = new Microsoft.Extensions.Logging.Abstractions.NullLoggerFactory();
|
|
|
|
return loggerFactory.CreateLogger<Backtester>();
|
|
}
|
|
|
|
public static ILogger<CandleRepository> CreateCandleRepositoryLogger()
|
|
{
|
|
ILoggerFactory loggerFactory = new Microsoft.Extensions.Logging.Abstractions.NullLoggerFactory();
|
|
|
|
return loggerFactory.CreateLogger<CandleRepository>();
|
|
}
|
|
|
|
public static ICandleRepository GetCandleRepository()
|
|
{
|
|
var settings = new InfluxDbSettings()
|
|
{
|
|
Url = "http://localhost:8086/",
|
|
Token = "6b-OjFNaZRprYroZEx8zeLScvPqvOp9la1lEksXl8xRT0d96UyuN18iKpB6jKYFt8JJEX1NaxVMXhk-Sgy8sgg==",
|
|
Organization = "managing-org"
|
|
};
|
|
var influxdb = new InfluxDbRepository(settings);
|
|
var candleRepository = new CandleRepository(influxdb, CreateCandleRepositoryLogger());
|
|
|
|
return candleRepository;
|
|
}
|
|
}
|
|
}
|