public BittrexAdapter(IBittrexClient bittrexClient) { if (bittrexClient == null) { throw new ArgumentNullException(typeof(IBittrexClient).Name); } _bittrexClient = bittrexClient; }
/// <summary> /// Create a new order book instance /// </summary> /// <param name="symbol">The symbol the order book is for</param> /// <param name="limit">The number of entries in the order book</param> /// <param name="options">Options for the order book</param> public BittrexSymbolOrderBook(string symbol, int limit, BittrexOrderBookOptions?options = null) : base(symbol, options ?? new BittrexOrderBookOptions()) { symbol.ValidateBittrexSymbol(); limit.ValidateIntValues(nameof(limit), 1, 25, 500); _limit = limit; socketClient = options?.SocketClient ?? new BittrexSocketClient(new BittrexSocketClientOptions() { LogVerbosity = options?.LogVerbosity ?? LogVerbosity.Info }); client = new BittrexClient(new BittrexClientOptions() { LogVerbosity = options?.LogVerbosity ?? LogVerbosity.Info }); }
public MarketManager(IConfigManager configManager, IBittrexClient bittrexClient, IPoloniexClient poloniexClient) { _logger = Log.ForContext <MarketManager>(); _storage = new HashSet <IMarketData>(); _config = configManager.MarketsConfig; // init the exchanges. _exchanges = new List <IExchangeClient> { bittrexClient, poloniexClient }; // update the data initially _timer = new Timer(Run, null, 1, Timeout.Infinite); // schedule the timer for the first run. }
public MarketManager(IConfigManager configManager, IBittrexClient bittrexClient, IPoloniexClient poloniexClient, ICryptsyClient cryptsyClient) { _logger = Log.ForContext<MarketManager>(); _storage = new HashSet<IMarketData>(); _config = configManager.MarketsConfig; // init the exchanges. _exchanges = new List<IExchangeClient> { bittrexClient, cryptsyClient, poloniexClient }; // update the data initially _timer = new Timer(Run, null, 1, Timeout.Infinite); // schedule the timer for the first run. }
public void Initialize(string apiKey, string apiSecret, bool isInTestMode) { var apiCredentials = new ApiCredentials(apiKey, apiSecret); _bittrexClient = new BittrexClient(new BittrexClientOptions { ApiCredentials = apiCredentials }); _bittrexSocketClient = new BittrexSocketClient(new BittrexSocketClientOptions { ApiCredentials = apiCredentials }); if (!isInTestMode) { _bittrexSocketClient.SubscribeToMarketSummariesUpdate(OnMarketsUpdate); _bittrexSocketClient.SubscribeToOrderUpdates(OnOrderUpdate); } }
public static void SetErrorWithResponse(IBittrexClient client, string responseData, HttpStatusCode code) { var expectedBytes = Encoding.UTF8.GetBytes(responseData); var responseStream = new MemoryStream(); responseStream.Write(expectedBytes, 0, expectedBytes.Length); responseStream.Seek(0, SeekOrigin.Begin); var r = new Mock <HttpWebResponse>(); r.Setup(x => x.GetResponseStream()).Returns(responseStream); var we = new WebException("", null, WebExceptionStatus.Success, r.Object); var request = new Mock <IRequest>(); request.Setup(c => c.Headers).Returns(new WebHeaderCollection()); request.Setup(c => c.GetResponse()).Throws(we); var factory = Mock.Get(client.RequestFactory); factory.Setup(c => c.Create(It.IsAny <string>())) .Returns(request.Object); }
public BittrexMarketSummaryController(IBittrexClient bittrexClient) { _bittrexClient = bittrexClient; }
public BittrexTicksController(IBittrexClient bittrexClient) { _bittrexClient = bittrexClient; }
public BittrexMarketDataSource(IBittrexClient client) { _client = client; }
public FakeBittrexApi(IBittrexClient bittrexClient) : base(bittrexClient) { }
public BittrexApi(IBittrexClient bittrexClient) { _bittrexClient = bittrexClient; TickerUpdated = new Subject <Ticker>(); OrderUpdated = new Subject <CryptoOrder>(); }