public override void SetBtcMarketData(BtcInfo.PairTypeEnum pairType)
      {
         try
         {
            if (_orderBookGet != null)
            {
               this.MarketData.PairType = pairType;
               var topBid = _orderBookGet.Bids.FirstOrDefault();
               var topAsk = _orderBookGet.Asks.FirstOrDefault();

               if (topBid != null)
               {
                  this.MarketData.BidSz = topBid.Amount;
                  this.MarketData.Bid = topBid.Price;
               }

               if (topAsk != null)
               {
                  this.MarketData.AskSz = topAsk.Amount;
                  this.MarketData.Ask = topAsk.Price;
               }
            }
         }
         catch (Exception ex)
         {
            Logger.LogException(ex);
         }
      }
 public void SetGlobalPairType(BtcInfo.PairTypeEnum pairType)
 {
    lock (_lock)
    {
       _pairType = pairType;
    }
 }
 public BitfinexOrderBookGet GetOrderBook(BtcInfo.PairTypeEnum pairType)
 {
     try
     {
         var url = DepthOfBookRequestUrl + Enum.GetName(typeof(BtcInfo.PairTypeEnum), pairType);
         var response = GetBaseResponse(url);
         var orderBookResponseObj = JsonConvert.DeserializeObject<BitfinexOrderBookGet>(response.Content);
         OrderBookMsg(orderBookResponseObj);
         return orderBookResponseObj;
     }
     catch (Exception ex)
     {
         Logger.LogException(ex);
         return new BitfinexOrderBookGet();
     }
 }
 public abstract void SetBtcMarketData(BtcInfo.PairTypeEnum pairType);
 public abstract void ProcessMarketDataUpdate(BtcInfo.PairTypeEnum pairType);
 protected ExchangeBase(BtcInfo.ExchangeEnum exchange)
 {
    Exchange = exchange;
    MarketData = new BtcMarketData();
 }
        public IList<BitfinexTradesGet> GetPairTrades(BtcInfo.PairTypeEnum pairType, BtcInfo.BitfinexUnauthenicatedCallsEnum callType)
        {
            var call = Enum.GetName(typeof(BtcInfo.BitfinexUnauthenicatedCallsEnum), callType);
            var symbol = Enum.GetName(typeof(BtcInfo.PairTypeEnum), pairType);
            var url = @"/v1/" + call.ToLower() + "/" + symbol.ToLower();
            var response = GetBaseResponse(url);

            var pairTradesResponseObj = JsonConvert.DeserializeObject<IList<BitfinexTradesGet>>(response.Content);

            foreach (var pairTrade in pairTradesResponseObj)
                Logger.Log.InfoFormat("Pair Trade: {0}", pairTrade);

            return pairTradesResponseObj;
        }
        public BitfinexPublicTickerGet GetPublicTicker(BtcInfo.PairTypeEnum pairType, BtcInfo.BitfinexUnauthenicatedCallsEnum callType)
        {
            var call = Enum.GetName(typeof(BtcInfo.BitfinexUnauthenicatedCallsEnum), callType);
            var symbol = Enum.GetName(typeof(BtcInfo.PairTypeEnum), pairType);
            var url = @"/v1/" + call.ToLower() + "/" + symbol.ToLower();
            var response = GetBaseResponse(url);

            var publicticketResponseObj = JsonConvert.DeserializeObject<BitfinexPublicTickerGet>(response.Content);
            Logger.Log.InfoFormat("Ticker: {0}", publicticketResponseObj);

            return publicticketResponseObj;
        }
 public override void ProcessMarketDataUpdate(BtcInfo.PairTypeEnum pairType)
 {
    _orderBookGet = Api.GetOrderBook(pairType);
 }