Beispiel #1
0
        static void Main(string[] args)
        {
            if (args.Length != 2 || !args.Any(arg => arg.StartsWith("--config=")) || !args.Any(arg => arg.StartsWith("--log=")))
            {
                usage();
                return;
            }

            var logFile = args.First(arg => arg.StartsWith("--log=")).Substring("--log=".Length);
            var logger = new ConsoleAndFileLogger(logFile);

            var configFile = args.First(arg => arg.StartsWith("--config=")).Substring("--config=".Length);
            var configProvider = new FileConfiguration(configFile);
            var strategy = configProvider.Strategy;

            ITrader trader;
            switch (strategy.ToLower())
            {
                case "arb":
                    trader = new ArbitrageTrader(configProvider, logger);
                    break;
                default:
                    throw new ArgumentException("Unknown strategy " + strategy);
            }

            trader.Initialize();

            Thread t = new Thread(trader.StartTrading);
            t.Start();

            Console.WriteLine("ENTER quits this app...");
            Console.ReadLine();
            trader.Kill();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            if (args.Length != 2 || !args.Any(arg => arg.StartsWith("--config=")) || !args.Any(arg => arg.StartsWith("--log=")))
            {
                usage();
                return;
            }

            var logFile = args.First(arg => arg.StartsWith("--log=")).Substring("--log=".Length);
            var logger = new ConsoleAndFileLogger(logFile);

            var configFile = args.First(arg => arg.StartsWith("--config=")).Substring("--config=".Length);
            var configProvider = new FileConfiguration(configFile);
            var txSigner = new TransactionSigner(configProvider.SecretKey);
            var strategy = configProvider.Strategy;

            ITrader trader;
            switch (strategy.ToLower())
            {
                case "cst":
                    trader = new CrazySellerTrap(new IncrementalFeeProvider(0.0005, 0.02, 0.0005), txSigner, configProvider, logger);
                    break;
                case "cbt":
                    trader = new CrazyBuyerTrap(new IncrementalFeeProvider(0.0005, 0.02, 0.0005), txSigner, configProvider, logger);
                    break;
                case "arb":
                    throw new InvalidOperationException("Over-XRP-arbitrage not supported anymore. Please use 'dirarb'");
                case "dirarb":
                    trader = new DirectArbitrage(new ConstantFeeProvider(0.0015), txSigner, configProvider, logger);
                    break;
                case "wss-ripplecn":
                    trader = new WideSpreadSeller(new IncrementalFeeProvider(0.0005, 0.02, 0.0005), txSigner, configProvider, logger);
                    break;
                default:
                    throw new ArgumentException("Unknown strategy " + strategy);
            }

            trader.Initialize();

            Thread t = new Thread(trader.StartTrading);
            t.Start();

            Console.WriteLine("ENTER quits this app...");
            Console.ReadLine();
            trader.Kill();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            if (args.Length != 2 || !args.Any(arg => arg.StartsWith("--config=")) || !args.Any(arg => arg.StartsWith("--log=")))
            {
                usage();
                return;
            }

            var logFile = args.First(arg => arg.StartsWith("--log=")).Substring("--log=".Length);
            var logger = new ConsoleAndFileLogger(logFile);

            var configFile = args.First(arg => arg.StartsWith("--config=")).Substring("--config=".Length);
            var configProvider = new FileConfiguration(configFile);
            var strategy = configProvider.Strategy;

            ITrader trader;
            switch(strategy.ToLower())
            {
                case "cbt":
                    trader = new CrazyBuyerTrap(configProvider, logger);
                break;
                case "cst":
                    trader = new CrazySellerTrap(configProvider, logger);
                break;
                case "nfb":
                    trader = new NightlyFrogBoiling(configProvider, logger);
                break;
                case "bear":
                    trader = new NaiveBear(configProvider, logger);
                break;
                case "bull":
                    throw new NotImplementedException("Soon...");
                default:
                    throw new ArgumentException("Unknown strategy " + strategy);
            }

            trader.Initialize();

            Thread t = new Thread(trader.StartTrading);
            t.Start();

            Console.WriteLine("ENTER quits this app...");
            Console.ReadLine();
            trader.Kill();
        }