示例#1
0
        //static Task<int> CreateTask(string name)
        //{
        //    return new Task<int>(() => TaskMethod(name));
        //}

        public string start()
        {
            string         info = "";
            BitfinexClient bit  = new BitfinexClient();

            bit.SetApiKey("cndYoNyd8Tp2g1rAslKFPCcuxYklO3PEprVrlTYMT5l");
            bit.SetApiSecret("ms0cM9Hd1FgEkR6p9TZYVWfw9yDiO3OXg7o2mMhvvx8");
            BitfinexApiResult <BitfinexAccountInfo> result = bit.GetAccountInfo();

            if (result.Error == null)
            {
                info += "MakerFees:" + result.Result.MakerFees;
                info += "TakerFees:" + result.Result.TakerFees;
                int i = 1;
                foreach (BitfinexFee bf in result.Result.Fees)
                {
                    info += "BitfinexFee:" + i.ToString();
                    info += "MakerFees:" + bf.MakerFees;
                    info += "Pairs:" + bf.Pairs;
                    info += "TakerFees:" + bf.TakerFees;
                    info += "\r\n";
                    i++;
                }
            }
            else
            {
                info = "error:" + result.Error.ErrorCode.ToString() + result.Error.ErrorMessage;
            }
            return(info);
        }
示例#2
0
        /// <summary>
        /// Api call succeeded. Return an object with details.
        /// </summary>
        /// <typeparam name="T">Type of data to return</typeparam>
        /// <param name="data">Api operation id</param>
        /// <returns></returns>
        protected BitfinexApiResult <T> Success <T>(T data)
        {
            var result = new BitfinexApiResult <T>
            {
                Result  = data,
                Success = true
            };

            return(result);
        }
示例#3
0
        /// <summary>
        /// Api call failed. Return an object with details.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="error">error message</param>
        /// <param name="extraInformation">More information</param>
        /// <returns></returns>
        protected BitfinexApiResult <T> Fail <T>(BitfinexError error, string extraInformation = null)
        {
            log?.Warn($"Call failed: {error.ErrorMessage}");
            var result = new BitfinexApiResult <T>
            {
                Error = error
            };

            if (extraInformation != null)
            {
                result.Error.ErrorMessage += Environment.NewLine + extraInformation;
            }
            return(result);
        }