docker files fixes from liaqat

This commit is contained in:
alirehmani
2024-05-03 16:39:25 +05:00
commit 464a8730e8
587 changed files with 44288 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
using Managing.Domain.Bots;
using Managing.Domain.MoneyManagements;
using Managing.Domain.Workflows;
using static Managing.Common.Enums;
namespace Managing.Application.Abstractions
{
public interface IBotFactory
{
ITradingBot CreateScalpingBot(string accountName, MoneyManagement moneyManagement, string name, Ticker ticker, string scenario, Timeframe interval, bool isForWatchingOnly);
ITradingBot CreateBacktestScalpingBot(string accountName, MoneyManagement moneyManagement, Ticker ticker, string scenario, Timeframe interval, bool isForWatchingOnly);
ITradingBot CreateFlippingBot(string accountName, MoneyManagement moneyManagement, string name, Ticker ticker, string scenario, Timeframe interval, bool isForWatchingOnly);
ITradingBot CreateBacktestFlippingBot(string accountName, MoneyManagement moneyManagement, Ticker ticker, string scenario, Timeframe interval, bool isForWatchingOnly);
IBot CreateSimpleBot(string botName, Workflow workflow);
}
}

View File

@@ -0,0 +1,12 @@
namespace Managing.Application.Abstractions
{
public interface ICacheService
{
string SaveValue(string name, string value);
string GetValue(string key);
void RemoveValue(string key);
T GetOrSave<T>(string name, Func<T> action, TimeSpan slidingExpiration);
T GetValue<T>(string key);
void SaveValue<T>(string name, T value, TimeSpan slidingExpiration);
}
}

View File

@@ -0,0 +1,7 @@
namespace Managing.Application.Abstractions
{
public interface ICommandHandler<T, M>
{
Task<M> Handle(T request);
}
}

View File

@@ -0,0 +1,9 @@
using Managing.Domain.Workflows;
using Managing.Domain.Workflows.Synthetics;
namespace Managing.Application.Abstractions;
public interface IFlowFactory
{
IFlow BuildFlow(SyntheticFlow request);
}

View File

@@ -0,0 +1,13 @@
using Managing.Domain.MoneyManagements;
namespace Managing.Application.Abstractions
{
public interface IMoneyManagementService
{
Task<MoneyManagement> CreateOrUpdateMoneyManagement(MoneyManagement request);
Task<MoneyManagement> GetMoneyMangement(string name);
IEnumerable<MoneyManagement> GetMoneyMangements();
bool DeleteMoneyManagement(string name);
bool DeleteMoneyManagements();
}
}

View File

@@ -0,0 +1,29 @@
using Managing.Domain.Scenarios;
using Managing.Domain.Strategies;
using static Managing.Common.Enums;
namespace Managing.Application.Abstractions
{
public interface IScenarioService
{
IEnumerable<Scenario> GetScenarios();
Scenario CreateScenario(string name, List<string> strategies);
IEnumerable<Strategy> GetStrategies();
bool DeleteStrategy(string name);
bool DeleteScenario(string name);
Scenario GetScenario(string name);
Strategy CreateStrategy(StrategyType type,
Timeframe timeframe,
string name,
int? period = null,
int? fastPeriods = null,
int? slowPeriods = null,
int? signalPeriods = null,
double? multiplier = null,
int? stochPeriods = null,
int? smoothPeriods = null,
int? cyclePeriods = null);
bool DeleteStrategies();
bool DeleteScenarios();
}
}

View File

@@ -0,0 +1,7 @@
namespace Managing.Application.Abstractions;
public interface ISettingsService
{
bool SetupSettings();
Task<bool> ResetSettings();
}

View File

@@ -0,0 +1,48 @@
namespace Managing.Application.Abstractions
{
public interface ITaskCache
{
/// <summary>
/// Return from the cache the value for the given key. If value is already present in cache,
/// that value will be returned. Otherwise value is first generated with the given method.
///
/// Return value can be a completed or running task-object. If the task-object is completed,
/// it has run succesfully to completion. Most often when a running task is returned,
/// it is the task returned by the function the caller has given as a parameter, but the
/// returned task might also have a different origin (from another call to this same method).
/// If the cache contains a task that will end up throwing an exception in the future, the same
/// task instance is returned to all the callers of this method. This means that any given
/// caller of this method should anticipate the type of exceptions that could be thrown from
/// the updateFunc used by any of the caller of this method.
///
/// To prevent the problem described above, as a convention, all the call sites of his method
/// (if more than one) should use the same updateFunc-parameter and also be prepared for the
/// exceptions that the the updateFunc could throw.
/// </summary>
/// <typeparam name="T">Type of the value.</typeparam>
/// <param name="key">Key that matches the wanted return value.</param>
/// <param name="valueFactory">Function that is run only if a value for the given key is not already present in the cache.</param>
/// <returns>Returned task-object can be completed or running. Note that the task might result in exception.</returns>
Task<T> AddOrGetExisting<T>(string key, Func<Task<T>> valueFactory);
/// <summary>
/// Invalidate the value for the given key, if value exists.
/// </summary>
/// <param name="key"></param>
void Invalidate(string key);
/// <summary>
/// Does the cache alrealy contain a value for the key.
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
bool Contains(string key);
/// <summary>
/// Empties the cache from all entries.
/// </summary>
void Clear();
List<T> GetCache<T>();
T Get<T>(string name);
}
}

View File

@@ -0,0 +1,33 @@
using Managing.Domain.Bots;
using Managing.Domain.Candles;
using Managing.Domain.MoneyManagements;
using Managing.Domain.Strategies;
using Managing.Domain.Trades;
using static Managing.Common.Enums;
namespace Managing.Application.Abstractions
{
public interface ITradingBot : IBot
{
HashSet<Signal> Signals { get; set; }
List<Position> Positions { get; set; }
HashSet<Candle> Candles { get; set; }
Timeframe Timeframe { get; set; }
HashSet<IStrategy> Strategies { get; set; }
Ticker Ticker { get; }
string Scenario { get; }
string AccountName { get; }
bool IsForWatchingOnly { get; set; }
MoneyManagement MoneyManagement { get; set; }
BotType BotType { get; set; }
Dictionary<DateTime, decimal> WalletBalances { get; set; }
Task Run();
Task ToggleIsForWatchOnly();
int GetWinRate();
decimal GetProfitAndLoss();
decimal GetTotalFees();
void LoadStrategies(IEnumerable<IStrategy> strategies);
}
}

View File

@@ -0,0 +1,12 @@
using Managing.Domain.Workflows;
using Managing.Domain.Workflows.Synthetics;
namespace Managing.Application.Abstractions;
public interface IWorkflowService
{
bool DeleteWorkflow(string name);
Task<IEnumerable<IFlow>> GetAvailableFlows();
IEnumerable<SyntheticWorkflow> GetWorkflows();
Task<Workflow> InsertOrUpdateWorkflow(SyntheticWorkflow workflowRequest);
}