private void LocateFPSFixExe()
 {
     if (!File.Exists(config.Get("FPSFixConfigFile")))
     {
         AddError("FPSFix not found! Please check App.config!");
     }
 }
Пример #2
0
        private static void RunGame()
        {
            ConfigRepository  config            = new ConfigRepository();
            ProcessRepository processRepository = new ProcessRepository(config.Get("FF7ProcessName"));

            // Start the FPSFix tool
            using (Process proc = new Process())
            {
                proc.StartInfo.FileName        = config.Get("FPSFixExecutable");
                proc.StartInfo.UseShellExecute = true;
                proc.StartInfo.Verb            = "runas";
                proc.Start();
                proc.WaitForExit();
            }

            // Look for, and attach to, ff7 process. When found, event handler for exit will relaunch this whole process.
            if (listening)
            {
                processRepository.ProcessEnded -= ProcessRepository_ProcessEnded;
                listening = false;
            }

            processRepository.ProcessEnded += ProcessRepository_ProcessEnded;
            processRepository.WatchForClose();
            listening = true;
        }
Пример #3
0
 public frmMain()
 {
     InitializeComponent();
     hex                     = new HexConverter();
     config                  = new ConfigRepository();
     fpsFixRepository        = new FPSFixRepository(config, hex);
     gameProcessRepository   = new ProcessRepository(config.Get("FF7ProcessName"));
     fpsFixProcessRepository = new ProcessRepository(config.Get("FPSFixExecutable"));
 }
Пример #4
0
 public async Task Get()
 {
     var configRepo = new ConfigRepository(new List <IExchangeConfig> {
         new KrakenConfig()
     }.ToArray());
     var result = await configRepo.Get("kraken");
 }
Пример #5
0
        public async Task  AllTogether()
        {
            var configRepo = new ConfigRepository(new List <IExchangeConfig> {
                new KrakenConfig()
            }.ToArray());

            var config = await configRepo.Get();

            config[AltName].GroupMinutes            = 15;
            config[AltName].GroupForLongMacdMinutes = 60;
            _dt = DateTime.Now.AddHours(-26);
            var trades  = (await _tradeRepository.LoadTrades(AltName, _dt)).ToList();
            var grouped = trades.GroupAll(config[AltName].GroupMinutes, GroupBy.Minute).ToList();
            var macd    = grouped.Macd(config[AltName].MacdSlow, config[AltName].MacdFast, config[AltName].MacdSignal).ToList();
            var rsi     = grouped.RelativeStrengthIndex(config[AltName].RsiEmaPeriods);

            var grouped2 = trades.GroupAll(config[AltName].GroupForLongMacdMinutes, GroupBy.Minute).ToList();
            var macd2    = grouped2.Macd(config[AltName].MacdSlow, config[AltName].MacdFast, config[AltName].MacdSignal).ToList();

            var lines = (from m in macd
                         join r in rsi on m.DateTime equals r.DateTime
                         join g in grouped on m.DateTime equals g.DateTime
                         join m2 in macd2 on m.DateTime equals m2.DateTime into gm2
                         from m2 in gm2.DefaultIfEmpty()
                         select $"{m.DateTime},{r.Price},{m.Macd},{m.Signal},{g.Volume},{g.Price},{g.PriceMin},{g.PriceMax},{m2?.Macd},{m2?.Signal}").ToList();

            lines.Insert(0, "Date,RSI,MACD,Signal,Volume,PriceAvg,PriceMin,PriceMax,MACD2,Signal2");

            Write("macd_rsi", lines);
        }
        public void TestAdd()
        {
            var dbConnection = AppConfigConnectionFactory.CreateSicConnection();

            //using (dbConnection.BeginTransaction())
            {
                var sut = new ConfigRepository(dbConnection);
                var expected = new LomoConfig
                {
                    Name = "MyConfig",
                    Description = "Description",
                    Customer = new Customer("John", 0),
                    Fields = new Collection<Field>
                    {
                        new Field {Name = "Test1", Description = "Description1"},
                        new Field {Name = "Test2", Description = "Description2"},
                    }
                };

                var id = sut.Create(expected);
                expected.Id = id;

                var actual = sut.Get(id);

                Assert.Equal(expected, actual);
            }
        }
Пример #7
0
        public async Task GetTradeBalanceForAsset()
        {
            var configRepo = new ConfigRepository(new List <IExchangeConfig>().ToArray());
            var config     = await configRepo.Get();

            var repo         = new KrakenRepository(config);
            var tradebalance = await repo.CallPrivate <Dictionary <string, decimal> >("TradeBalance", new Dictionary <string, string>(){ { "asset", "ETH" } });

            Assert.That(tradebalance, Is.Not.Null);
        }
Пример #8
0
        public async Task GetOrder()
        {
            var configRepo = new ConfigRepository(new List <IExchangeConfig>().ToArray());
            var config     = await configRepo.Get();

            var repo    = new KrakenRepository(config);
            var service = new KrakenClientService(config, repo, new KrakenConfig());
            var result  = await service.GetOrders("OHG6X5-JVBOR-JTW7YA");

            Assert.That(result, Is.Not.Null);
        }
Пример #9
0
        static void Main(string[] args)
        {
            bool              done              = false;
            ConfigRepository  config            = new ConfigRepository();
            HexConverter      hex               = new HexConverter();
            FPSFixRepository  fPSFixRepository  = new FPSFixRepository(config, hex);
            ProcessRepository processRepository = new ProcessRepository(config.Get("FF7ProcessName"));

            List <CommandOption> colors = Enum.GetValues(typeof(CommandOption)).Cast <CommandOption>().ToList();

            for (;;)
            {
                Inquirer.Prompt(Question.List("Choose favourite color", colors)).Then((command) => {
                    switch (command)
                    {
                    case CommandOption.Exit:
                        done = true;
                        return;

                    case CommandOption.GetFPSFixValueFromFile:
                        Console.Clear();
                        Console.WriteLine("Get FPSFix value");
                        Console.WriteLine(fPSFixRepository.GetFPSFIXValue().ToString());
                        Console.ReadLine();
                        break;

                    case CommandOption.SaveFPSFixValueToFile:
                        Console.Clear();
                        Console.WriteLine("Enter a new value: (integer only!)");
                        int newValue = int.Parse(Console.ReadLine());
                        Console.WriteLine($"New value is: {newValue.ToString()}");
                        fPSFixRepository.SaveFPSFixValue(newValue);
                        Console.ReadLine();
                        break;

                    case CommandOption.AttachToGame:
                        Task.Run(() => RunGame());
                        break;

                    case CommandOption.DetatchFromGame:
                        break;
                    }
                });
                Inquirer.Go();

                if (done)
                {
                    return;
                }
            }
        }
Пример #10
0
        public async Task Deploy2()
        {
            const string PLATFORM     = "kraken";
            const string PAIR         = "ETHUSD";
            var          krakenClient = new KrakenConfig();
            var          repo         = new ConfigRepository(new List <IExchangeConfig>()
            {
                krakenClient
            }.ToArray());

            await repo.Deploy(PLATFORM, PAIR);

            var config = await repo.Get(PLATFORM);

            Assert.That(config.Pairs[PAIR].PlatformVariables.ContainsKey("short laverage"), Is.True);
        }
        public ConfigurationModule(ConfigRepository repository)
        {
            var system = repository.GetOrCreate("system", new SystemConfiguration());

            Get["/application/{application}"] = parameters =>
            {
                var application = parameters.application;

                return repository.Get(application);
                //return new
                //{
                //    Application = application,
                //    Setting1 = 1,
                //    Persistence = new
                //    {
                //        Mongo = new
                //        {
                //            Url = "mongo"
                //        },
                //        Sql = new
                //        {
                //            Url = "sql"
                //        }
                //    },
                //    Timeout = 3
                //};
            };

            Post["/register"] = ctx =>
            {
                var clientAddress = Request.UserHostAddress;
                var clients = system.Clients;

                if (!clients.Contains(clientAddress))
                {
                    clients.Add(clientAddress);
                }

                return HttpStatusCode.OK;

            };
        }
Пример #12
0
        public async Task  Deploy_With_Client_Variables()
        {
            const string VARIABLE_NAME = "my super variable";
            const string PLATFORM      = "test";
            const string PAIR_1        = "ETHUSD";
            const string PAIR_2        = "XBTUSD";
            var          client        = Substitute.For <IExchangeConfig>();

            client.PairVariables.Returns(new Dictionary <string, object>()
            {
                { VARIABLE_NAME, 156 }
            });
            client.Platform.Returns(PLATFORM);
            var repo = new ConfigRepository(new List <IExchangeConfig> {
                client
            }.ToArray());

            await repo.Deploy(PLATFORM, PAIR_1, PAIR_2);

            var config = await repo.Get(PLATFORM);

            Assert.That(config[PAIR_1].PlatformVariables[VARIABLE_NAME], Is.EqualTo("156"));
            Assert.That(config[PAIR_2].PlatformVariables[VARIABLE_NAME], Is.EqualTo("156"));
        }