Ejemplo n.º 1
0
        public static ITradeBotBuilder UseCommandLine(this ITradeBotBuilder tradeBotBuilder, string[] args)
        {
            // Example of CLI
            // dotnet run ADA 0.0000100

            if (args.Length > 0)
            {
                tradeBotBuilder.UseSetting("Coin", args[0]);
            }

            if (args.Length > 1)
            {
                tradeBotBuilder.UseSetting("ExpectedDelta", args[1]);
            }

            if (args.Length > 2)
            {
                tradeBotBuilder.UseSetting("IsAutoTrading", args[2]);
            }

            if (args.Length > 3)
            {
                tradeBotBuilder.UseSetting("TradeFlow", args[3]);
            }

            return(tradeBotBuilder);
        }
Ejemplo n.º 2
0
 public TradeBotService(
     ITradeBotBuilder tradeBotBuilder,
     ICapPublisher capPublisher)
 {
     this._tradeBot = tradeBotBuilder.Configure(config =>
     {
         config.SetBasePath(Directory.GetCurrentDirectory())
         .AddJsonFile("botsettings.json", optional: true)
         .AddJsonFile("botsettings.dev.json", optional: true)
         .AddEnvironmentVariables();
     })
                      .ConfigureServices(services =>
     {
         services.AddLogging((loggerFactory) =>
                             loggerFactory
                             .AddConsole()
                             .AddDebug()
                             .SetMinimumLevel(LogLevel.Debug));
         services.AddSingleton(typeof(ILogger <>), typeof(Logger <>));
         services.AddSingleton <IEmailHelper, EmailHelper>();
     })
                      .UseCommandLine()
                      .AddDockerSecret("Email.ApiKey", "Email:ApiKey")
                      .AddDockerSecret("BinanceAccount.API_KEY", "BinanceAccount:API_KEY")
                      .AddDockerSecret("BinanceAccount.API_SECRET", "BinanceAccount.API_SECRET")
                      .AddDockerSecret("BittrexAccount.API_KEY", "BittrexAccount.API_key")
                      .AddDockerSecret("BittrexAccount.API_SECRET", "BittrexAccount.API_SECRET")
                      .UseCap(capPublisher)
                      .Build();
 }
Ejemplo n.º 3
0
        public static ITradeBotBuilder WithBuyAccount(this ITradeBotBuilder tradeBotBuilder, ITradeAccount buyAccount)
        {
            tradeBotBuilder.SetBuyAccount(buyAccount);

            return(tradeBotBuilder);
        }
Ejemplo n.º 4
0
        public static ITradeBotBuilder WithSellAccount(this ITradeBotBuilder tradeBotBuilder, ITradeAccount sellAccount)
        {
            tradeBotBuilder.SetSellAccount(sellAccount);

            return(tradeBotBuilder);
        }