Exemple #1
0
        public async Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
        {
            var api = ApiProviderPrivate.GetApi(context);
            var r   = await api.GetUserInfoAsync().ConfigureAwait(false);

            return(r != null && r.success);
        }
Exemple #2
0
        public async Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
        {
            var api = ApiProvider.GetApi(context);
            var r   = await api.GetBalanceAsync().ConfigureAwait(false);

            return(r != null && r.error == false);
        }
Exemple #3
0
        public async Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
        {
            var api = ApiProvider.GetApi(context);
            var r   = await api.GetAccountsAsync().ConfigureAwait(false);

            return(r != null);
        }
        private void TestApiPrivate(INetworkProviderPrivate provider)
        {
            var ctx = new ApiPrivateTestContext(UserContext.Current.GetApiKey(provider));

            var r = AsyncContext.Run(() => provider.TestPrivateApiAsync(ctx));

            Assert.IsTrue(r);
        }
Exemple #5
0
        public async Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
        {
            throw new NotImplementedException();
            var api = ApiProvider.GetApi(context);
            //    var r = await api.GetUserInfoAsync().ConfigureAwait(false);

            //  return r?.data != null;
        }
Exemple #6
0
        public async Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
        {
            var api = ApiProvider.GetApi(context);
            var r   = await api.GetAllBalancesAsync().ConfigureAwait(false);

            CheckResponseErrors(r);

            return(r != null && r.success && r.result != null);
        }
Exemple #7
0
        public async Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
        {
            var body = CreatePostBody("info");

            var api = ApiProvider.GetApi(context);
            var r   = await api.GetUserInfoAsync(body).ConfigureAwait(false);

            return(r != null && r.success && r.balances.Count > 0);
        }
Exemple #8
0
        public async Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
        {
            var api  = ApiProvider.GetApi(context);
            var rRaw = await api.GetUserInfoAsync().ConfigureAwait(false);

            CheckResponseErrors(rRaw);
            var r = rRaw.GetContent();

            return(r.result);
        }
Exemple #9
0
        public async Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
        {
            var api  = ApiProvider.GetApi(context);
            var rRaw = await api.AuthenticateUserAsync().ConfigureAwait(false);

            CheckResponseErrors(rRaw);

            var r = rRaw.GetContent();

            return(!string.IsNullOrWhiteSpace(r?.token));
        }
Exemple #10
0
        public async Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
        {
            var api  = ApiProvider.GetApi(context);
            var rRaw = await api.GetUserInfoAsync().ConfigureAwait(false);

            CheckResponseErrors(rRaw);

            var r = rRaw.GetContent();

            return(r != null && string.IsNullOrWhiteSpace(r.email) == false);
        }
Exemple #11
0
        public async Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
        {
            var api  = ApiProvider.GetApi(context);
            var rRaw = await api.GetBalancesAsync().ConfigureAwait(false);

            CheckResponseErrors(rRaw);

            var r = rRaw.GetContent();

            return(r != null && r.Length > 0);
        }
Exemple #12
0
        public async Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
        {
            var api  = ApiProvider.GetApi(context);
            var rRaw = await api.GetAccountInformationAsync().ConfigureAwait(false);

            CheckResponseErrors(rRaw);

            var r = rRaw.GetContent();

            return(r != null);
        }
Exemple #13
0
        public async Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
        {
            var api = ApiProvider.GetApi(context);
            var r   = await api.GetUserInfoAsync().ConfigureAwait(false);

            //CheckResponseErrors(rRaw);

            //var r = rRaw.GetContent();

            return(r != null /* && r.success*/);
        }
Exemple #14
0
        public async Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
        {
            var api  = ApiProvider.GetApi(context);
            var body = CreateKrakenBody();

            var r = await api.GetBalancesAsync(body).ConfigureAwait(false);

            CheckResponseErrors(r);

            return(r != null);
        }
Exemple #15
0
        public async Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
        {
            var api  = ApiProviderPrivate.GetApi(context);
            var body = CreateBody();
            var rRaw = await api.GetBalancesAsync(body).ConfigureAwait(false);

            CheckResponseErrors(rRaw);

            var r = rRaw.GetContent();

            return(r != null && r.success == 1);
        }
Exemple #16
0
        public async Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
        {
            var api  = ApiProvider.GetApi(context);
            var body = CreatePoloniexBody(PoloniexBodyType.ReturnBalances);

            var rRaw = await api.GetBalancesAsync(body).ConfigureAwait(false);

            CheckResponseErrors(rRaw);

            var r = rRaw.GetContent();

            return(r != null && r.Count > 0);
        }
Exemple #17
0
        private void TestApi(INetworkProviderPrivate provider)
        {
            var ctx = new ApiPrivateTestContext(UserContext.Current.GetApiKey(provider));

            try
            {
                var r = AsyncContext.Run(() => provider.TestPrivateApiAsync(ctx));
                Assert.IsTrue(r);
            }
            catch (Exception e)
            {
                Assert.Fail(e.Message);
            }
        }
Exemple #18
0
        public async Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
        {
            var timeStamp = (long)(DateTime.UtcNow.ToUnixTimeStamp());

            var body = new Dictionary <string, object>
            {
                { "method", "getInfo" },
                { "nonce", timeStamp }
            };

            var api = ApiProviderPrivate.GetApi(context);
            var r   = await api.GetUserInfoAsync(body).ConfigureAwait(false);

            return(r != null && r.success);
        }
Exemple #19
0
        public async Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
        {
            var api  = ApiProvider.GetApi(context);
            var body = CreatePoloniexBody(PoloniexBodyType.ReturnBalances);

            try
            {
                var r = await api.GetBalancesAsync(body).ConfigureAwait(false);

                return(r != null && r.Count > 0);
            }
            catch
            {
                return(false);
            }
        }
Exemple #20
0
        public async Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
        {
            var body = new Dictionary <string, object>
            {
                { "currencies", "ltc,btc" }
            };

            var api  = ApiProvider.GetApi(context);
            var rRaw = await api.GetBalancesAsync(body).ConfigureAwait(false);

            CheckResponseErrors(rRaw);

            var r = rRaw.GetContent();

            return(r != null && r.Length > 0);
        }
Exemple #21
0
            public void TestApi()
            {
                var provider = Networks.I.Providers.OfType <BitMexProvider>().FirstProvider();

                var ctx = new ApiPrivateTestContext(UserContext.Current.GetApiKey(provider));

                try
                {
                    var r = AsyncContext.Run(() => provider.TestPrivateApiAsync(ctx));

                    Console.WriteLine($"Api success: {r}");
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
            public void ApiTest()
            {
                var provider   = Networks.I.Providers.OfType <PoloniexProvider>().FirstProvider();
                var apiTestCtx = new ApiPrivateTestContext(UserContext.Current.GetApiKey(provider));

                try
                {
                    var ok = AsyncContext.Run(() => provider.TestPrivateApiAsync(apiTestCtx));

                    System.Console.WriteLine($"Api test OK: {ok}");
                }
                catch (Exception e)
                {
                    System.Console.WriteLine(e.Message);
                    throw;
                }
            }
Exemple #23
0
            public void TestApi()
            {
                var provider = Networks.I.Providers.OfType <KrakenProvider>().FirstProvider();

                var ctx = new ApiPrivateTestContext(UserContext.Testing.GetApiKey(provider));

                try
                {
                    var result = AsyncContext.Run(() => provider.TestPrivateApiAsync(ctx));

                    System.Console.WriteLine($"Api test ok: {result}");
                }
                catch (Exception e)
                {
                    System.Console.WriteLine(e.Message);
                    throw;
                }
            }
Exemple #24
0
        public async Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
        {
            var api = ApiPrivateProvider.GetApi(context);

            var body = new Dictionary <string, object>
            {
                { "MsgType", "U2" },
                { "BalanceReqID", 1 }
            };

            var rRaw = await api.GetBalanceAsync(body).ConfigureAwait(false);

            CheckResponseErrors(rRaw);

            var r = rRaw.GetContent();

            return(r != null);
        }
Exemple #25
0
        public async Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
        {
            var api = ApiProvider.GetApi(context);

            var body = new Dictionary <string, object>
            {
                { "id", "1" },
                { "method", "getAccountInfo" },
                { "params", "" }
            };

            var rRaw = await api.GetUserInfoAsync(body).ConfigureAwait(false);

            CheckResponseErrors(rRaw);

            var r = rRaw.GetContent();

            return(r != null && !string.IsNullOrWhiteSpace(r.profile?.uid));
        }
Exemple #26
0
 public async Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
 {
     return(true);
 }
Exemple #27
0
 public static Task <ApiResponse <bool> > TestApiAsync(INetworkProviderPrivate provider, ApiPrivateTestContext context)
 {
     return(ApiHelpers.WrapExceptionAsync(() => provider.TestPrivateApiAsync(context), nameof(TestApi), provider, context));
 }
 public Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
 {
     throw new NotImplementedException();
 }
Exemple #29
0
 public static ApiResponse <bool> TestApi(INetworkProviderPrivate provider, ApiPrivateTestContext context)
 {
     return(AsyncContext.Run(() => TestApiAsync(provider, context)));
 }
Exemple #30
0
        public async Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
        {
            var r = await GetBalancesAsync(context).ConfigureAwait(false);

            return(r != null);
        }