Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            XmlConfigurator.Configure(new FileInfo("log4net.config"));
            ILog logger = LogManager.GetLogger("program");

            AccountConfig.init("yxq");

            Console.WriteLine($"{AccountConfig.mainAccountId}, {AccountConfig.accessKey}, {AccountConfig.secretKey}, {AccountConfig.sqlConfig}");
            logger.Error("-------------------------- 软件账户配置完成 ---------------------------------");

            Console.WriteLine("输入1:测试,2:正式运行");
            var choose = Console.ReadLine();

            if (choose == "1")
            {
                Test.GoTest();
            }
            else
            {
                Run();
            }

            Console.WriteLine("输入任意推出");
            Console.ReadLine();
        }
Ejemplo n.º 2
0
        public static void AccountBalanceDetail()
        {
            while (true)
            {
                Console.WriteLine("请输入 accountname:");
                var name = Console.ReadLine();
                AccountConfig.init(name);

                // 获取主账户的财富值
                var accountBalance = new AccountOrder().AccountBalance(AccountConfig.mainAccountId);
                //foreach (var item in accountBalance.data.list)
                //{
                //    Console.WriteLine($"{item.currency} -- {item.balance}");
                //}

                // 统计被套牢的数据
                Dictionary <string, decimal> coins = new Dictionary <string, decimal>();

                var noselllist = new CoinDao().ListAllNoSellRecord(AccountConfig.mainAccountId);
                foreach (var item in noselllist)
                {
                    if (coins.ContainsKey(item.Coin))
                    {
                        coins[item.Coin] += item.BuyTotalQuantity;
                    }
                    else
                    {
                        coins.Add(item.Coin, item.BuyTotalQuantity);
                    }
                }

                var noselllist2 = new CoinDao().ListNoSellRecordFromOther();
                foreach (var item in noselllist2)
                {
                    if (coins.ContainsKey(item.BuyCoin))
                    {
                        coins[item.BuyCoin] += item.BuyAmount;
                    }
                    else
                    {
                        coins.Add(item.BuyCoin, item.BuyAmount);
                    }
                }
                foreach (var item in accountBalance.data.list)
                {
                    if (item.balance == 0)
                    {
                        continue;
                    }
                    decimal tl = 0;
                    if (coins.ContainsKey(item.currency))
                    {
                        tl = coins[item.currency];
                    }
                    Console.WriteLine($"{item.currency} -- {item.balance} --》{tl}");
                }
            }
        }