예제 #1
0
        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();
            }
        }
예제 #2
0
        /// <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));
        }
예제 #3
0
        /// <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));
        }
예제 #4
0
        /// <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));
        }
예제 #5
0
        /// <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));
        }