示例#1
0
        private static async Task Pulser(MarketManager trader)
        {
            while (true)
            {
                try
                {
                    await trader.Pulse();
                }
                catch (Exception ex)
                {
                    Console.WriteLine("ERROR: PULSER receve exception");
                    Console.WriteLine(ex);
                }

                await Task.Delay(5000);
            }
        }
示例#2
0
        static async Task MainMock(string[] args)
        {
            var api = new Mock();

            var trader = new MarketManager(api, "BTCUSD");

            await trader.ResetMarke(10500, 0.0001m, 10, 10,
                                    1m, 4, 0m, 0);

            await trader.PlaceToMarketAsync();

            Console.WriteLine();
            Console.WriteLine("-------------------------");
            Console.WriteLine();
            Console.ReadLine();
            await trader.Pulse();

            Console.WriteLine();
            Console.WriteLine("-------------------------");
            Console.WriteLine();
            Console.ReadLine();
            await trader.Pulse();

            Console.WriteLine();
            Console.WriteLine("-------------------------");
            Console.Write("orderId: ");
            var oid = Console.ReadLine();

            Console.Write("size: ");
            var sz = decimal.Parse(Console.ReadLine());

            await trader.HandleTrade(oid, sz);

            await trader.PlaceToMarketAsync();

            await trader.Pulse();

            Console.WriteLine();
            Console.WriteLine("-------------------------");
            Console.Write("orderId: ");
            oid = Console.ReadLine();
            Console.Write("size: ");
            sz = decimal.Parse(Console.ReadLine());

            await trader.HandleTrade(oid, sz);

            await trader.PlaceToMarketAsync();

            await trader.Pulse();

            Console.WriteLine();
            Console.WriteLine("-------------------------");
            Console.Write("orderId: ");
            oid = Console.ReadLine();
            Console.Write("size: ");
            sz = decimal.Parse(Console.ReadLine());

            await trader.HandleTrade(oid, sz);

            await trader.PlaceToMarketAsync();

            await trader.Pulse();
        }