Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
        public async Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
        {
            var api = ApiProvider.GetApi(context);
            var r   = await api.GetAccountsAsync().ConfigureAwait(false);

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

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

            Assert.IsTrue(r);
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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*/);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
                }
            }
Ejemplo n.º 22
0
            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;
                }
            }
Ejemplo n.º 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;
                }
            }
Ejemplo n.º 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);
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 26
0
 public async Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
 {
     return(true);
 }
Ejemplo n.º 27
0
 public static Task <ApiResponse <bool> > TestApiAsync(INetworkProviderPrivate provider, ApiPrivateTestContext context)
 {
     return(ApiHelpers.WrapExceptionAsync(() => provider.TestPrivateApiAsync(context), nameof(TestApi), provider, context));
 }
Ejemplo n.º 28
0
 public Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 29
0
 public static ApiResponse <bool> TestApi(INetworkProviderPrivate provider, ApiPrivateTestContext context)
 {
     return(AsyncContext.Run(() => TestApiAsync(provider, context)));
 }
Ejemplo n.º 30
0
        public async Task <bool> TestPrivateApiAsync(ApiPrivateTestContext context)
        {
            var r = await GetBalancesAsync(context).ConfigureAwait(false);

            return(r != null);
        }