예제 #1
0
        public override bool Equals(object obj)
        {
            if (!this.GetType().Equals(obj.GetType()))
            {
                return(false);
            }

            KrakenMarketId other = (KrakenMarketId)obj;

            return(other.BaseCurrencyCode.Equals(this.BaseCurrencyCode) &&
                   other.QuoteCurrencyCode.Equals(this.QuoteCurrencyCode));
        }
        /// <summary>
        /// Parse market information from the market data API (as in https://vircurex.com/api/get_info_for_currency.json).
        /// </summary>
        /// <param name="currencyShortCodeToLabel">A mapping from coin short codes to human readable labels</param>
        /// <param name="marketObj">The JSON object representing a market</param>
        /// <returns></returns>
        public static KrakenMarket Parse(string baseCurrencyCode, JProperty marketProperty)
        {
            JObject marketJson = (JObject)marketProperty.Value;
            MarketStatistics marketStats = new MarketStatistics()
            {
                LastTrade = marketJson.Value<decimal>("ltp"),
                Volume24HBase = marketJson.Value<decimal>("volume")
            };
            string quoteCurrencyCode = marketProperty.Name;
            KrakenMarketId marketId = new KrakenMarketId(baseCurrencyCode, quoteCurrencyCode);

            return new KrakenMarket(marketId, baseCurrencyCode, quoteCurrencyCode, marketStats);
        }
예제 #3
0
        /// <summary>
        /// Parse market information from the market data API (as in https://vircurex.com/api/get_info_for_currency.json).
        /// </summary>
        /// <param name="currencyShortCodeToLabel">A mapping from coin short codes to human readable labels</param>
        /// <param name="marketObj">The JSON object representing a market</param>
        /// <returns></returns>
        public static KrakenMarket Parse(string baseCurrencyCode, JProperty marketProperty)
        {
            JObject          marketJson  = (JObject)marketProperty.Value;
            MarketStatistics marketStats = new MarketStatistics()
            {
                LastTrade     = marketJson.Value <decimal>("ltp"),
                Volume24HBase = marketJson.Value <decimal>("volume")
            };
            string         quoteCurrencyCode = marketProperty.Name;
            KrakenMarketId marketId          = new KrakenMarketId(baseCurrencyCode, quoteCurrencyCode);

            return(new KrakenMarket(marketId, baseCurrencyCode, quoteCurrencyCode, marketStats));
        }
 public KrakenMarket(KrakenMarketId id, string baseCurrencyCode, string quoteCurrencyCode,
     MarketStatistics statistics)
     : base(id, baseCurrencyCode, quoteCurrencyCode, id.ToString(), statistics)
 {
 }
예제 #5
0
 public KrakenMarket(KrakenMarketId id, string baseCurrencyCode, string quoteCurrencyCode,
                     MarketStatistics statistics)
     : base(id, baseCurrencyCode, quoteCurrencyCode, id.ToString(), statistics)
 {
 }