Example #1
0
        //获取activebalance的内容,并插入balanceinfo表中
        public async void UpdateBanlanceInfo(int delNum)
        {
            if (delNum % 3600 == 0)
            {
                bitfinexSqlOper.ClearAllData("balanceinfo");
            }
            List <BalanceInfo> banlanceinfo = await bitfinxMethed.GetBalances();

            bitfinexSqlOper.AddBalanceInfo(banlanceinfo);
        }
Example #2
0
        //
        public async Task <string> GetBalances()
        //public string GetBalances()
        {
            int  timeStamp      = GetTimeStamp(DateTime.Now);
            long lastUpdateTime = BitSqlOper.GetLastUpdateTime("balanceinfo");

            //如果上次更新时间超过60s,则直接调用接口
            if (timeStamp - lastUpdateTime > 61)
            {
                var result = await Bitfinex.GetBalances();

                BitSqlOper.AddBalanceInfo(result);
                return(JsonConvert.SerializeObject(result));
            }
            else
            {
                var result = BitSqlOper.GetBalanceInfos();
                return(JsonConvert.SerializeObject(result));
            }

            //var result = await Bitfinex.GetBalances();
            //var res = BitSqlOper.GetBalanceInfos();
            //return JsonConvert.SerializeObject(result);
        }