public StexTests() { _exchangeApi = null; IFileRepository _fileRepo = new FileRepository(); if (_fileRepo.FileExists(configPath)) { _exchangeApi = _fileRepo.GetDataFromFile <Contracts.ApiCredentials>(configPath); } if (_exchangeApi != null) { _service = new Stex(_exchangeApi); } else { _service = new Stex(); } }
/// <summary> /// Get trades for a trading pair /// </summary> /// <param name="pair">Trading Pair</param> /// <param name="sort">Sort Order (default = DESC)</param> /// <param name="from">Timestamp from time (ms)</param> /// <param name="till">Timestamp till time (ms)</param> /// <param name="limit">Record max (default = 100)</param> /// <param name="offset">Offset</param> /// <returns>Collection of Trades</returns> public static async Task <List <Trade> > GetTrades(this IStex service, string pair, SortOrder sort = SortOrder.DESC, int from = 0, int till = 0, int limit = 100, int offset = 0) { var pairId = service.GetExchangePairId(pair); return(await service.GetTrades(pairId, sort, from, till, limit, offset)); }
/// <summary> /// Get trading pair details /// </summary> /// <param name="pair">Trading pair</param> /// <returns>TradingPairDetail object</returns> public static async Task <TradingPairDetail> GetTradingPairDetail(this IStex service, string pair) { var pairId = service.GetExchangePairId(pair); return(await service.GetTradingPairDetail(pairId)); }
/// <summary> /// Get ticker for a trading pair /// </summary> /// <param name="pair">Trading pair</param> /// <returns>Ticker object</returns> public static async Task <Ticker> GetTicker(this IStex service, string pair) { var pairId = service.GetExchangePairId(pair); return(await service.GetTicker(pairId)); }
/// <summary> /// Get currency details /// </summary> /// <param name="symbol">Symbol of currency</param> /// <returns>CurrencyDetail object</returns> public static async Task <CurrencyDetail> GetCurrency(this IStex service, string symbol) { var currencyId = service.GetExchangeCurrencyId(symbol); return(await service.GetCurrency(currencyId)); }