コード例 #1
0
        public void Clear()
        {
            var lClientOptions = new PoloniexClientOptions {
                ApiCredentials = null
            };

            PoloniexClient.SetDefaultOptions(lClientOptions);
            IsCredentialsSet = false;
        }
コード例 #2
0
        public void SetCredentials(string aApiKey, string aApiSecret)
        {
            var lKeyGuid      = aApiKey.Replace("-", string.Empty);
            var lFormatedGUID = Enumerable.Range(0, lKeyGuid.Count() / 8)
                                .Select(lCounter => lKeyGuid.Substring(lCounter * 8, 8))
                                .Aggregate((first, second) => string.Concat(first, "-", second)).ToUpperInvariant();
            var lCredentials = new ApiCredentials(lFormatedGUID, aApiSecret.ToLowerInvariant());
            PoloniexClientOptions lClientOptions = new PoloniexClientOptions {
                ApiCredentials = lCredentials
            };

            PoloniexClient.SetDefaultOptions(lClientOptions);
            using (PoloniexClient lClient = new PoloniexClient())
            {
                var lResponse = lClient.GetBalances();
                if (!lResponse.Success)
                {
                    throw new PandoraExchangeExceptions.InvalidExchangeCredentials("Incorrect Key Pair for selected exchange");
                }
            }
            FUserCredentials = new Tuple <string, string>(lFormatedGUID, aApiSecret.ToLowerInvariant());
            IsCredentialsSet = true;
        }