コード例 #1
0
        /// <summary>
        /// Get ticker for a trading pair
        /// </summary>
        /// <param name="pairId">Id of trading pair</param>
        /// <returns>Ticker object</returns>
        public async Task <Ticker> GetTicker(int pairId)
        {
            var endpoint = $@"/v1/ticker?symbol={pairId}";

            var response = await base.GetRequest <Ticker>(endpoint);

            var asset = BilaxyHelper.GetAsset(pairId);

            response.Pair   = asset.DashedPair;
            response.PairId = asset.AssetId;

            return(response);
        }
コード例 #2
0
        /// <summary>
        /// Get tickers for all trading pairs
        /// </summary>
        /// <returns>Collection of Ticker objects</returns>
        public async Task <List <Ticker> > GetTickers()
        {
            var endpoint = $@"/v1/tickers";

            var response = await base.GetRequest <List <Ticker> >(endpoint);

            foreach (var item in response)
            {
                var asset = BilaxyHelper.GetAsset(item.PairId);
                if (asset != null)
                {
                    item.Pair = asset.DashedPair;
                }
            }

            return(response);
        }
コード例 #3
0
ファイル: RepositoryBase.cs プロジェクト: mscheetz/Bilaxy.Net
        /// <summary>
        /// Initiate a Get request
        /// </summary>
        /// <typeparam name="T">Object to return</typeparam>
        /// <param name="endpoint">Endpoint of request</param>
        /// <param name="parms">Parameters to pass</param>
        /// <param name="secure">Secure endpoint?</param>
        /// <returns>Object from response</returns>
        public async Task <T> GetRequest <T>(string endpoint, SortedDictionary <string, object> parms, bool secure = false)
        {
            var queryString = BilaxyHelper.ParmsToQueryString(parms);

            if (secure)
            {
                var signature = GetSignature(parms);
                if (!string.IsNullOrEmpty(queryString))
                {
                    queryString += @"&";
                }

                queryString += $@"key={_apiCreds.ApiKey}&sign={signature}";
            }

            endpoint += $@"{queryString}";

            return(await OnGetRequest <T>(endpoint));
        }