Beispiel #1
0
        public void ToBitsharesSymbol()
        {
            for (int i = 0; i < (int)CurrencyTypesDep.max; i++)
            {
                CurrencyTypesDep type    = (CurrencyTypesDep)i;
                CurrenciesRow    newType = m_currencies[type.ToString()];

                Assert.AreEqual(CurrencyHelpersDep.ToBitsharesSymbol(type), CurrencyHelpers.ToBitsharesSymbol(newType));
            }
        }
Beispiel #2
0
        public void FromSymbol()
        {
            List <string> symbols = new List <string>();

            for (int i = 0; i < (int)CurrencyTypesDep.max; i++)
            {
                CurrencyTypesDep type = (CurrencyTypesDep)i;
                symbols.Add(type.ToString());
            }

            foreach (string s in symbols)
            {
                string old = CurrencyHelpersDep.FromSymbol(s).ToString();
                string n   = CurrencyHelpers.FromSymbol(s, m_currencies).ToString();

                Assert.AreEqual(old, n);
            }
        }
Beispiel #3
0
        public void GetMarketSymbolPair()
        {
            List <string> symbols = new List <string>();

            for (int i = 0; i < (int)CurrencyTypesDep.max; i++)
            {
                CurrencyTypesDep type = (CurrencyTypesDep)i;
                symbols.Add(type.ToString());
            }

            for (int i = 0; i < symbols.Count - 1; i++)
            {
                for (int j = i + 1; j < symbols.Count; j++)
                {
                    CurrencyTypesDep @base = CurrencyHelpersDep.FromSymbol(symbols[i]);
                    CurrencyTypesDep quote = CurrencyHelpersDep.FromSymbol(symbols[j]);

                    string marketOld = CurrencyHelpersDep.GetMarketSymbolPair(@base, quote);
                    string marketNew = CurrencyHelpers.GetMarketSymbolPair(m_currencies[@base.ToString()], m_currencies[quote.ToString()]);

                    Assert.AreEqual(marketOld, marketNew);
                }
            }
        }
Beispiel #4
0
 /// <summary>	Gets market symbol pair. </summary>
 ///
 /// <remarks>	Paul, 05/02/2015. </remarks>
 ///
 /// <param name="base">     The base. </param>
 /// <param name="quote">	The quote. </param>
 ///
 /// <returns>	The market symbol pair. </returns>
 static public string GetMarketSymbolPair(CurrencyTypesDep @base, CurrencyTypesDep quote)
 {
     return(@base + "_" + quote);
 }
Beispiel #5
0
 /// <summary>	Converts a type to the bitshares symbol. </summary>
 ///
 /// <remarks>	Paul, 05/02/2015. </remarks>
 ///
 /// <param name="type">	The type. </param>
 ///
 /// <returns>	type as a string. </returns>
 static public string ToBitsharesSymbol(CurrencyTypesDep type)
 {
     return(type.ToString().TrimStart(kBitassetPrefix));
 }
Beispiel #6
0
 /// <summary>	Query if 'type' is bitshares asset. </summary>
 ///
 /// <remarks>	Paul, 05/02/2015. </remarks>
 ///
 /// <param name="type">	The type. </param>
 ///
 /// <returns>	true if bitshares asset, false if not. </returns>
 static public bool IsBitsharesAsset(CurrencyTypesDep type)
 {
     return(type > CurrencyTypesDep.BTC);
 }
Beispiel #7
0
 /// <summary>	Gets base and quote from symbol pair. </summary>
 ///
 /// <remarks>	Paul, 05/02/2015. </remarks>
 ///
 /// <param name="symbolPair">	The symbol pair. </param>
 /// <param name="base">		    [out] The base. </param>
 /// <param name="quote">	    [out] The quote. </param>
 static public void GetBaseAndQuoteFromSymbolPair(string symbolPair, out CurrencyTypesDep @base, out CurrencyTypesDep quote)
 {
     @base = CurrencyHelpersDep.FromSymbol(symbolPair.Split('_')[0]);
     quote = CurrencyHelpersDep.FromSymbol(symbolPair.Split('_')[1]);
 }
Beispiel #8
0
 /// <summary>	Gets market symbol pair. </summary>
 ///
 /// <remarks>	Paul, 05/02/2015. </remarks>
 ///
 /// <param name="base"> 	The base. </param>
 /// <param name="quote">	The quote. </param>
 ///
 /// <returns>	The market symbol pair. </returns>
 public static string GetMarketSymbolPair(CurrencyTypesDep @base, CurrencyTypesDep quote)
 {
     return @base + "_" + quote;
 }
Beispiel #9
0
 /// <summary>	Gets base and quote from symbol pair. </summary>
 ///
 /// <remarks>	Paul, 05/02/2015. </remarks>
 ///
 /// <param name="symbolPair">	The symbol pair. </param>
 /// <param name="base">		 	[out] The base. </param>
 /// <param name="quote">	 	[out] The quote. </param>
 public static void GetBaseAndQuoteFromSymbolPair(string symbolPair, out CurrencyTypesDep @base, out CurrencyTypesDep quote)
 {
     @base = CurrencyHelpersDep.FromSymbol(symbolPair.Split('_')[0]);
     quote = CurrencyHelpersDep.FromSymbol(symbolPair.Split('_')[1]);
 }
Beispiel #10
0
 /// <summary>	Converts a type to the bitshares symbol. </summary>
 ///
 /// <remarks>	Paul, 05/02/2015. </remarks>
 ///
 /// <param name="type">	The type. </param>
 ///
 /// <returns>	type as a string. </returns>
 public static string ToBitsharesSymbol(CurrencyTypesDep type)
 {
     return type.ToString().TrimStart(kBitassetPrefix);
 }
Beispiel #11
0
 /// <summary>	Query if 'type' is bitshares asset. </summary>
 ///
 /// <remarks>	Paul, 05/02/2015. </remarks>
 ///
 /// <param name="type">	The type. </param>
 ///
 /// <returns>	true if bitshares asset, false if not. </returns>
 public static bool IsBitsharesAsset(CurrencyTypesDep type)
 {
     return type > CurrencyTypesDep.BTC;
 }