Ejemplo n.º 1
0
 /// <summary>
 /// Update user info
 /// </summary>
 public void UpdateUserInfo(bool pairChanged)
 {
     if (ConfigTool.RunMode == RunMode.TEST)
     {
         if (pairChanged)
         {
             UserAmounts = new UserAmounts(Constants.TRADE_NAME_DRAGON_EX, 100, 1);
         }
     }
     else
     {
         UserAmounts = GetUserInfo();
     }
 }
Ejemplo n.º 2
0
        public void Get_TotalUsers_CountReturned()
        {
            // arrange
            List <User> users    = new List <User>();
            string      fileName = "CSV//UserData.csv";
            int         expected = 50;

            // act
            PathConstructor path   = new PathConstructor();
            CSVReader       reader = new CSVReader(fileName.ToCsvFilePath());
            UserAmounts     amount = new UserAmounts();

            users = reader.GetUsers();
            int actual = amount.GetTotalUsersCount(users);

            // assert
            Assert.AreEqual(actual, expected);
        }
Ejemplo n.º 3
0
        public void Get_UsersByCountry_CountReturned()
        {
            // arrange
            List <User> users    = new List <User>();
            string      fileName = "CSV//UserData.csv";
            string      country  = "LV";
            int         expected = 30;

            // act
            PathConstructor path   = new PathConstructor();
            CSVReader       reader = new CSVReader();
            UserAmounts     amount = new UserAmounts();

            users = reader.GetTotal(path.pathConstructor(fileName)).Item1;
            int actual = amount.GetUsersByCountryCount(country, users);

            // assert
            Assert.AreEqual(actual, expected);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Get user informations
        /// </summary>
        /// <returns>User Amounts Entity</returns>
        public UserAmounts GetUserInfo()
        {
            UserAmounts currentUserAmounts = new UserAmounts(Constants.TRADE_NAME_DRAGON_EX, 0, 0.00m);
            var         userInfo           = privateApiInstance.GetUserOwn();
            var         funds  = userInfo.Elements("data");
            var         baseId = ConfigTool.CoinDict[ConfigTool.CurrentBase].ToString();
            var         coinId = ConfigTool.CoinDict[ConfigTool.CurrentCoin].ToString();

            foreach (var item in funds)
            {
                if (string.Equals(item.Element("coin_id").Value, baseId))
                {
                    currentUserAmounts.BaseAmount = (decimal)double.Parse(item.Element("volume").Value);
                }
                else if (string.Equals(item.Element("coin_id").Value, coinId))
                {
                    currentUserAmounts.CoinAmount = (decimal)double.Parse(item.Element("volume").Value);
                }
            }
            currentUserAmounts.UpdatedDate = DateTime.Now;
            return(currentUserAmounts);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Constructor with parameter
 /// </summary>
 /// <param name="secretKey"></param>
 /// <param name="accessKey"></param>
 public DragonExApiImpl(string secretKey, string accessKey, AccountSide name)
 {
     this.name          = name;
     privateApiInstance = new DragonExPrivateApis(secretKey, accessKey);
     UserAmounts        = new UserAmounts(Constants.TRADE_NAME_DRAGON_EX, 0, 0);
 }