* Move PrivateKeys.cs * Update gitignore * Update gitignore * updt * Extract GmxServiceTests.cs * Refact * update todo * Update code * Fix hashdata * Replace static token hashed datas * Set allowance * Add get orders * Add get orders tests * Add ignore * add close orders * revert * Add get gas limit * Start increasePosition. Todo: Finish GetExecutionFee and estimateGas * little refact * Update gitignore * Fix namespaces and clean repo * Add tests samples * Add execution fee * Add increase position * Handle backtest on the frontend * Add tests * Update increase * Test increase * fix increase * Fix size * Start get position * Update get positions * Fix get position * Update rpc and trade mappers * Finish close position * Fix leverage
38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using Managing.Application.Abstractions.Repositories;
|
|
using Managing.Domain.Backtests;
|
|
using Managing.Infrastructure.Databases.MongoDb;
|
|
using Managing.Infrastructure.Databases.MongoDb.Abstractions;
|
|
using Managing.Infrastructure.Databases.MongoDb.Collections;
|
|
|
|
namespace Managing.Infrastructure.Databases;
|
|
|
|
public class BacktestRepository : IBacktestRepository
|
|
{
|
|
private readonly IMongoRepository<BacktestDto> _backtestRepository;
|
|
|
|
public BacktestRepository(IMongoRepository<BacktestDto> backtestRepository)
|
|
{
|
|
_backtestRepository = backtestRepository;
|
|
}
|
|
|
|
public void DeleteAllBacktests()
|
|
{
|
|
_backtestRepository.DropCollection();
|
|
}
|
|
|
|
public void DeleteBacktestById(string id)
|
|
{
|
|
_backtestRepository.DeleteById(id);
|
|
}
|
|
|
|
public IEnumerable<Backtest> GetBacktests()
|
|
{
|
|
var backtests = _backtestRepository.FindAll();
|
|
return backtests.Select(b => MongoMappers.Map(b));
|
|
}
|
|
|
|
public void InsertBacktest(Backtest backtest)
|
|
{
|
|
_backtestRepository.InsertOne(MongoMappers.Map(backtest));
|
|
}
|
|
} |