Example #1
0
        public void PlaceOrderExpected()
        {
            IDeserializer deserializer = null;

            var restMock = new Mock <IRestClient>(MockBehavior.Strict);

            restMock.SetupAllProperties();
            restMock.Setup(x => x.AddHandler("application/json", It.IsAny <IDeserializer>())).Callback <string, IDeserializer>((ct, d) => deserializer = d);

            restMock.Setup(x => x.Execute <ResponseSingle <TradeOrder> >(It.IsAny <IRestRequest>())).Returns <IRestRequest>(request =>
            {
                var responseMock = new Mock <IRestResponse <ResponseSingle <TradeOrder> > >(MockBehavior.Strict);
                responseMock.SetupAllProperties();

                responseMock.Object.Content = Properties.Resources.PlaceOrderResponse;
                responseMock.Object.Request = request;
                responseMock.Object.Data    = deserializer.Deserialize <ResponseSingle <TradeOrder> >(responseMock.Object);

                return(responseMock.Object);
            });

            var client = new BitsoClient(restMock.Object, ServiceUrlMock, ApiKeyMock, ApiSecretMock);

            var instruction = new TradeInstruction();

            instruction.Price = 1000;
            instruction.MajorCurrencyAmount = 1;
            instruction.OrderType           = TradeOrderType.Limit;
            instruction.Side     = MarketSide.Buy;
            instruction.BookName = "btc_mxn";

            var res = client.PlaceOrder(instruction);

            Assert.IsNotNull(res);
        }
Example #2
0
        public void GetAccountInfoExpected()
        {
            IDeserializer deserializer = null;

            var restMock = new Mock <IRestClient>(MockBehavior.Strict);

            restMock.SetupAllProperties();
            restMock.Setup(x => x.AddHandler("application/json", It.IsAny <IDeserializer>())).Callback <string, IDeserializer>((ct, d) => deserializer = d);

            restMock.Setup(x => x.Execute <ResponseSingle <AccountInfo> >(It.IsAny <IRestRequest>())).Returns <IRestRequest>(request =>
            {
                var responseMock = new Mock <IRestResponse <ResponseSingle <AccountInfo> > >(MockBehavior.Strict);
                responseMock.SetupAllProperties();

                responseMock.Object.Content = Properties.Resources.AccountStatusResponse;
                responseMock.Object.Request = request;
                responseMock.Object.Data    = deserializer.Deserialize <ResponseSingle <AccountInfo> >(responseMock.Object);

                return(responseMock.Object);
            });

            var client = new BitsoClient(restMock.Object, ServiceUrlMock, ApiKeyMock, ApiSecretMock);

            var res = client.GetAccountInfo();

            Assert.IsNotNull(res);
            Assert.IsFalse(string.IsNullOrEmpty(res.ClientId));
            Assert.AreNotEqual <decimal>(0M, res.DailyLimit);
            Assert.AreNotEqual <decimal>(0M, res.MonthlyLimit);
            Assert.AreNotEqual <decimal>(0M, res.DailyRemaining);
            Assert.IsFalse(string.IsNullOrEmpty(res.Email));
            Assert.IsFalse(string.IsNullOrEmpty(res.FirstName));
            Assert.IsFalse(string.IsNullOrEmpty(res.LastName));
            Assert.AreNotEqual <AccountStatus>(AccountStatus.None, res.Status);
        }
Example #3
0
        public void GetAllLedgerEntriesExpected()
        {
            IDeserializer deserializer = null;

            var restMock = new Mock <IRestClient>(MockBehavior.Strict);

            restMock.SetupAllProperties();
            restMock.Setup(x => x.AddHandler("application/json", It.IsAny <IDeserializer>())).Callback <string, IDeserializer>((ct, d) => deserializer = d);

            restMock.Setup(x => x.Execute <ResponseCollection <LedgerEntryBase> >(It.IsAny <IRestRequest>())).Returns <IRestRequest>(request =>
            {
                var responseMock = new Mock <IRestResponse <ResponseCollection <LedgerEntryBase> > >(MockBehavior.Strict);
                responseMock.SetupAllProperties();

                responseMock.Object.Content = Properties.Resources.LedgerResponse;
                responseMock.Object.Request = request;
                responseMock.Object.Data    = deserializer.Deserialize <ResponseCollection <LedgerEntryBase> >(responseMock.Object);

                return(responseMock.Object);
            });

            var client = new BitsoClient(restMock.Object, ServiceUrlMock, ApiKeyMock, ApiSecretMock);
            var res    = client.GetAllLedgerEntries();

            Assert.IsNotNull(res);
            Assert.AreNotEqual <int>(0, res.Count);
            Assert.AreNotEqual <int>(0, res[0].Balances.Count);
            Assert.AreNotEqual <TransactionType>(TransactionType.None, res[0].Kind);
            Assert.IsFalse(string.IsNullOrEmpty(res[0].Id));
            Assert.IsFalse(string.IsNullOrEmpty(res[0].Balances[0].Currency));

            res = client.GetAllLedgerEntries(string.Empty, SortDirection.Ascending, 7);
            Assert.IsNotNull(res);
            Assert.AreEqual <int>(7, res.Count);
        }
Example #4
0
        public void GetBitsoTransferFundingsExpected()
        {
            using (var client = new BitsoClient(this.TestingServerUrl, this.ApiKey, this.ApiSecret))
            {
                try
                {
                    var res = client.GetBitsoTransferFundings();

                    Assert.IsNotNull(res);
                    Assert.AreNotEqual <int>(0, res.Count);
                    Assert.AreNotEqual <decimal>(0M, res[0].Amount);
                    Assert.AreNotEqual <TransferStatus>(TransferStatus.None, res[0].Status);
                    Assert.AreNotEqual <TransferMethod>(TransferMethod.None, res[0].Method);
                    Assert.IsFalse(string.IsNullOrEmpty(res[0].MethodName));
                    Assert.IsFalse(string.IsNullOrEmpty(res[0].Id));
                    Assert.IsFalse(string.IsNullOrEmpty(res[0].Currency));
                    Assert.IsFalse(string.IsNullOrEmpty(res[0].Details.Notes));

                    var diff = res[0].CreatedAt - default(System.DateTime);
                    Assert.IsTrue(diff > System.TimeSpan.Zero);

                    res = client.GetBitsoTransferFundings(1);
                    Assert.IsNotNull(res);
                    Assert.AreEqual <int>(1, res.Count);
                }
                catch (BitsoException ex)
                {
                    this.TestContext.WriteLine(ex.Header);
                    throw;
                }
            }
        }
Example #5
0
        public void GetAccountFeesExpected()
        {
            using (var client = new BitsoClient(this.TestingServerUrl, this.ApiKey, this.ApiSecret))
            {
                try
                {
                    var res = client.GetAccountFees();
                    Assert.IsNotNull(res);
                    Assert.AreNotEqual <int>(0, res.TradeFees.Count);

                    Assert.IsFalse(string.IsNullOrEmpty(res.TradeFees[0].BookName));
                    Assert.AreNotEqual <decimal>(0M, res.TradeFees[0].TakerPercent);
                    Assert.AreNotEqual <decimal>(0M, res.TradeFees[0].TakerValue);
                    Assert.AreNotEqual <decimal>(0M, res.TradeFees[0].MakerPercent);
                    Assert.AreNotEqual <decimal>(0M, res.TradeFees[0].MakerValue);
                    Assert.AreNotEqual <int>(0, res.WithdrawalFees.Count);
                    Assert.AreNotEqual <decimal>(0M, res.WithdrawalFees.First().Value);
                }
                catch (BitsoException ex)
                {
                    this.TestContext.WriteLine(ex.Header);
                    throw;
                }
            }
        }
Example #6
0
        public void GetAllLedgerEntriesExpected()
        {
            using (var client = new BitsoClient(this.TestingServerUrl, this.ApiKey, this.ApiSecret))
            {
                try
                {
                    var res = client.GetAllLedgerEntries();
                    Assert.IsNotNull(res);
                    Assert.AreNotEqual <int>(0, res.Count);
                    Assert.AreNotEqual <int>(0, res[0].Balances.Count);
                    Assert.AreNotEqual <TransactionType>(TransactionType.None, res[0].Kind);
                    Assert.IsFalse(string.IsNullOrEmpty(res[0].Id));
                    Assert.IsFalse(string.IsNullOrEmpty(res[0].Balances[0].Currency));

                    res = client.GetAllLedgerEntries(string.Empty, SortDirection.Ascending, 5);
                    Assert.IsNotNull(res);
                    Assert.AreEqual <int>(5, res.Count);
                }
                catch (BitsoException ex)
                {
                    this.TestContext.WriteLine(ex.Header);
                    throw;
                }
            }
        }
Example #7
0
        public void GetAccountInfoExpected()
        {
            using (var client = new BitsoClient(this.TestingServerUrl, this.ApiKey, this.ApiSecret))
            {
                try
                {
                    var res = client.GetAccountInfo();

                    Assert.IsNotNull(res);
                    Assert.IsFalse(string.IsNullOrEmpty(res.ClientId));
                    Assert.AreNotEqual <decimal>(0M, res.DailyLimit);
                    Assert.AreNotEqual <decimal>(0M, res.MonthlyLimit);
                    Assert.AreNotEqual <decimal>(0M, res.DailyRemaining);
                    Assert.IsFalse(string.IsNullOrEmpty(res.Email));
                    Assert.IsFalse(string.IsNullOrEmpty(res.FirstName));
                    Assert.IsFalse(string.IsNullOrEmpty(res.LastName));
                    Assert.AreNotEqual <AccountStatus>(AccountStatus.None, res.Status);
                }
                catch (BitsoException ex)
                {
                    this.TestContext.WriteLine(ex.Header);
                    throw;
                }
            }
        }
Example #8
0
        public void AvailableBooksExpected()
        {
            IDeserializer deserializer = null;

            var restMock = new Mock <IRestClient>(MockBehavior.Strict);

            restMock.SetupAllProperties();
            restMock.Setup(x => x.AddHandler("application/json", It.IsAny <IDeserializer>())).Callback <string, IDeserializer>((ct, d) => deserializer = d);

            restMock.Setup(x => x.Execute <ResponseCollection <CurrencyPair> >(It.IsAny <IRestRequest>())).Returns <IRestRequest>(request =>
            {
                var responseMock = new Mock <IRestResponse <ResponseCollection <CurrencyPair> > >(MockBehavior.Strict);
                responseMock.SetupAllProperties();

                responseMock.Object.Content = Properties.Resources.AvailableBooksResponse;
                responseMock.Object.Request = request;
                responseMock.Object.Data    = deserializer.Deserialize <ResponseCollection <CurrencyPair> >(responseMock.Object);

                return(responseMock.Object);
            });

            var client = new BitsoClient(restMock.Object, ServiceUrlMock, ApiKeyMock, ApiSecretMock);

            var res = client.GetAvailablePairs();

            Assert.AreNotEqual <int>(0, res.Count);
            Assert.IsFalse(string.IsNullOrWhiteSpace(res[0].BookName));
            Assert.AreNotEqual <decimal>(0M, res[0].MaximumAmount);
            Assert.AreNotEqual <decimal>(0M, res[0].MaximumPrice);
            Assert.AreNotEqual <decimal>(0M, res[0].MaximumValue);
            Assert.AreNotEqual <decimal>(0M, res[0].MinimumAmount);
            Assert.AreNotEqual <decimal>(0M, res[0].MinimumPrice);
            Assert.AreNotEqual <decimal>(0M, res[0].MinimumValue);
        }
Example #9
0
        public void GetPortfolioExpected()
        {
            IDeserializer deserializer = null;

            var restMock = new Mock <IRestClient>(MockBehavior.Strict);

            restMock.SetupAllProperties();
            restMock.Setup(x => x.AddHandler("application/json", It.IsAny <IDeserializer>())).Callback <string, IDeserializer>((ct, d) => deserializer = d);

            restMock.Setup(x => x.Execute <ResponseSingle <Portfolio> >(It.IsAny <IRestRequest>())).Returns <IRestRequest>(request =>
            {
                var responseMock = new Mock <IRestResponse <ResponseSingle <Portfolio> > >(MockBehavior.Strict);
                responseMock.SetupAllProperties();

                responseMock.Object.Content = Properties.Resources.PortfolioResponse;
                responseMock.Object.Request = request;
                responseMock.Object.Data    = deserializer.Deserialize <ResponseSingle <Portfolio> >(responseMock.Object);

                return(responseMock.Object);
            });

            var client = new BitsoClient(restMock.Object, ServiceUrlMock, ApiKeyMock, ApiSecretMock);

            var res = client.GetPortfolio();

            Assert.IsNotNull(res);
            Assert.AreNotEqual <int>(0, res.Balances.Count);
            Assert.IsFalse(string.IsNullOrEmpty(res.Balances[0].Currency));
        }
Example #10
0
        public void GetOrderBookExpected()
        {
            IDeserializer deserializer = null;

            var restMock = new Mock <IRestClient>(MockBehavior.Strict);

            restMock.SetupAllProperties();
            restMock.Setup(x => x.AddHandler("application/json", It.IsAny <IDeserializer>())).Callback <string, IDeserializer>((ct, d) => deserializer = d);

            restMock.Setup(x => x.Execute <ResponseSingle <OrderBook> >(It.IsAny <IRestRequest>())).Returns <IRestRequest>(request =>
            {
                var responseMock = new Mock <IRestResponse <ResponseSingle <OrderBook> > >(MockBehavior.Strict);
                responseMock.SetupAllProperties();

                var aggregateParameter = request.Parameters.Find(x => x.Name == "aggregate");
                bool aggregate         = aggregateParameter != null ? (bool)aggregateParameter.Value : false;

                responseMock.Object.Content = aggregate ? Properties.Resources.OrderBookResponse1 : Properties.Resources.OrderBookResponse2;
                responseMock.Object.Request = request;
                responseMock.Object.Data    = deserializer.Deserialize <ResponseSingle <OrderBook> >(responseMock.Object);

                return(responseMock.Object);
            });

            var client = new BitsoClient(restMock.Object, ServiceUrlMock, ApiKeyMock, ApiSecretMock);

            var res = client.GetOrderBook("btc_mxn");

            Assert.IsNotNull(res);
            Assert.AreNotEqual <int>(0, res.Asks.Count);
            Assert.AreNotEqual <int>(0, res.Bids.Count);
            Assert.AreNotEqual <long>(0, res.Sequence);

            var diff = res.UpdatedAt - default(System.DateTime);

            Assert.IsTrue(diff > System.TimeSpan.Zero);

            Assert.AreNotEqual <decimal>(0M, res.Asks[0].Amount);
            Assert.AreNotEqual <decimal>(0M, res.Asks[0].Price);
            Assert.IsFalse(string.IsNullOrEmpty(res.Asks[0].OrderId));
            Assert.IsFalse(string.IsNullOrEmpty(res.Asks[0].BookName));

            const bool AggregateResults = true;

            res = client.GetOrderBook("btc_mxn", AggregateResults);

            Assert.IsNotNull(res);
            Assert.AreNotEqual <int>(0, res.Asks.Count);
            Assert.AreNotEqual <int>(0, res.Bids.Count);
            Assert.AreNotEqual <long>(0, res.Sequence);

            diff = res.UpdatedAt - default(System.DateTime);
            Assert.IsTrue(diff > System.TimeSpan.Zero);

            Assert.AreNotEqual <decimal>(0M, res.Asks[0].Amount);
            Assert.AreNotEqual <decimal>(0M, res.Asks[0].Price);
            Assert.IsTrue(string.IsNullOrEmpty(res.Asks[0].OrderId));
            Assert.IsFalse(string.IsNullOrEmpty(res.Asks[0].BookName));
        }
Example #11
0
        public void GetAllTickersExpected()
        {
            var client = new BitsoClient(this.TestingServerUrl);

            var res = client.GetAllTickers();

            Assert.AreNotEqual <int>(0, res.Count);
        }
Example #12
0
        //https://bitso.com/api_info#account-creation
        public NewAccountInfo CreateAccount(Dictionary <string, string> requiredFieldValues, string webhookUrl = null)
        {
            if (!string.IsNullOrEmpty(webhookUrl))
            {
                requiredFieldValues.Add("webhook_url", webhookUrl);
            }
            var rawResponse = BitsoClient.SendRequest("accounts", "POST", true, BitsoUtils.BuildJson(requiredFieldValues));

            return(JsonConvert.DeserializeObject <NewAccountInfo>(rawResponse));
        }
Example #13
0
        public Funding GetFunding(string fid)
        {
            var rawResponse = BitsoClient.SendRequest($"fundings/{fid}", "GET");
            var funding     = JsonConvert.DeserializeObject <Funding[]>(rawResponse);

            if (funding != null && funding.Length > 0)
            {
                return(funding[0]);
            }
            return(null);
        }
Example #14
0
        //https://bitso.com/developers#phone-number-withdrawal
        public Withdrawal WithdrawToPhoneNumber(double amount, string recipientGivenNames, string recipientFamilyNames, string phoneNumber, string bankCode)
        {
            var rawResponse = BitsoClient.SendRequest($"phone_withdrawal", "POST", true,
                                                      $"{{ \"amount\": \"{amount}\"," +
                                                      $"\"recipient_given_names\": \"{recipientGivenNames}\"," +
                                                      $"\"recipient_family_names\": \"{recipientFamilyNames}\"," +
                                                      $"\"phone_number\": \"{phoneNumber}\"," +
                                                      $"\"bank_code\": \"{bankCode}\"}}");

            return(JsonConvert.DeserializeObject <Withdrawal>(rawResponse));
        }
Example #15
0
        //https://bitso.com/developers#lookup-orders
        public OpenOrder LookupOrder(string oid)
        {
            var rawResponse = BitsoClient.SendRequest($"orders/{oid}", "GET");
            var orders      = JsonConvert.DeserializeObject <OpenOrder[]>(rawResponse);

            if (orders != null && orders.Length > 0)
            {
                return(orders[0]);
            }
            return(null);
        }
Example #16
0
        public UserTrade GetUserTrade(string tid)
        {
            var rawResponse = BitsoClient.SendRequest($"user_trades/{tid}", "GET");
            var userTrades  = JsonConvert.DeserializeObject <UserTrade[]>(rawResponse);

            if (userTrades != null && userTrades.Length > 0)
            {
                return(userTrades[0]);
            }
            return(null);
        }
Example #17
0
        public Withdrawal GetWithdrawal(string wid)
        {
            var rawResponse = BitsoClient.SendRequest($"withdrawals/{wid}", "GET");
            var withdrawal  = JsonConvert.DeserializeObject <Withdrawal[]>(rawResponse);

            if (withdrawal != null && withdrawal.Length > 0)
            {
                return(withdrawal[0]);
            }
            return(null);
        }
Example #18
0
        //https://bitso.com/developers#spei-withdrawal
        public Withdrawal WithdrawToSPEI(decimal amount, string recipientGivenNames, string recipientFamilyNames, string clabe, string notesRef, string numericRef)
        {
            var rawResponse = BitsoClient.SendRequest($"spei_withdrawal", "POST", true,
                                                      $"{{\"amount\":\"{amount}\"," +
                                                      $"\"recipient_given_names\":\"{recipientGivenNames}\"," +
                                                      $"\"recipient_family_names\":\"{recipientFamilyNames}\"," +
                                                      $"\"clabe\":\"{clabe}\"," +
                                                      $"\"notes_ref\":\"{notesRef}\"," +
                                                      $"\"numeric_ref\":\"{numericRef}\"}}");

            return(JsonConvert.DeserializeObject <Withdrawal>(rawResponse));
        }
Example #19
0
        //https://bitso.com/api_info#place-an-order
        public OpenOrder PlaceOrder(string book, string side, string type, decimal price, decimal?minorAmount = null, decimal?majorAmount = null)
        {
            var rawResponse = BitsoClient.SendRequest("orders", "POST", true,
                                                      $"{{\"book\":\"{book}\"," +
                                                      $"\"side\":\"{side}\"," +
                                                      $"\"type\":\"{type}\"," +
                                                      (minorAmount.HasValue ? $"\"minor\":\"{minorAmount.Value}\"," : "") +
                                                      (majorAmount.HasValue ? $"\"major\":\"{majorAmount.Value}\"," : "") +
                                                      $"\"price\":\"{price}\"}}");

            return(JsonConvert.DeserializeObject <OpenOrder>(rawResponse));
        }
Example #20
0
        public void AvailableBooksExpected()
        {
            var client = new BitsoClient(this.TestingServerUrl);

            var res = client.GetAvailablePairs();

            Assert.AreNotEqual <int>(0, res.Count);
            Assert.IsFalse(string.IsNullOrWhiteSpace(res[0].BookName));
            Assert.AreNotEqual <decimal>(0M, res[0].MaximumAmount);
            Assert.AreNotEqual <decimal>(0M, res[0].MaximumPrice);
            Assert.AreNotEqual <decimal>(0M, res[0].MaximumValue);
            Assert.AreNotEqual <decimal>(0M, res[0].MinimumAmount);
            Assert.AreNotEqual <decimal>(0M, res[0].MinimumPrice);
            Assert.AreNotEqual <decimal>(0M, res[0].MinimumValue);
        }
Example #21
0
        public string[] CancelOpenOrders(params string[] oids)
        {
            var oidsBuilder = new StringBuilder();
            var index       = 0;

            foreach (var oid in oids)
            {
                if (index > 0)
                {
                    oidsBuilder.Append("-");
                }
                oidsBuilder.Append(oid);
                index++;
            }
            var rawResponse = BitsoClient.SendRequest($"orders/{oidsBuilder.ToString()}", "DELETE");

            return(JsonConvert.DeserializeObject <string[]>(rawResponse));
        }
Example #22
0
        public UserTrade[] GetUserTrades(params string[] tids)
        {
            var tidsBuilder = new StringBuilder();
            var index       = 0;

            foreach (var tid in tids)
            {
                if (index > 0)
                {
                    tidsBuilder.Append("-");
                }
                tidsBuilder.Append(tid);
                index++;
            }
            var rawResponse = BitsoClient.SendRequest($"user_trades/{tidsBuilder.ToString()}", "GET");

            return(JsonConvert.DeserializeObject <UserTrade[]>(rawResponse));
        }
Example #23
0
        public Funding[] GetFundings(params string[] fids)
        {
            var fidsBuilder = new StringBuilder();
            var index       = 0;

            foreach (var fid in fids)
            {
                if (index > 0)
                {
                    fidsBuilder.Append("-");
                }
                fidsBuilder.Append(fid);
                index++;
            }
            var rawResponse = BitsoClient.SendRequest($"fundings/{fidsBuilder.ToString()}", "GET");

            return(JsonConvert.DeserializeObject <Funding[]>(rawResponse));
        }
Example #24
0
        public Withdrawal[] GetWithdrawals(params string[] wids)
        {
            var widsBuilder = new StringBuilder();
            var index       = 0;

            foreach (var wid in wids)
            {
                if (index > 0)
                {
                    widsBuilder.Append("-");
                }
                widsBuilder.Append(wid);
                index++;
            }
            var rawResponse = BitsoClient.SendRequest($"withdrawals/{widsBuilder.ToString()}", "GET");

            return(JsonConvert.DeserializeObject <Withdrawal[]>(rawResponse));
        }
Example #25
0
 public void GetBanksInfoExpected()
 {
     using (var client = new BitsoClient(this.TestingServerUrl, this.ApiKey, this.ApiSecret))
     {
         try
         {
             var res = client.GetBanksInfo();
             Assert.IsNotNull(res);
             Assert.AreNotEqual <int>(0, res.Count);
             Assert.IsFalse(string.IsNullOrEmpty(res[0].Name));
             Assert.IsFalse(string.IsNullOrEmpty(res[0].Code));
         }
         catch (BitsoException ex)
         {
             this.TestContext.WriteLine(ex.Header);
             throw;
         }
     }
 }
Example #26
0
        public void GetTradesExpected()
        {
            var client = new BitsoClient(this.TestingServerUrl);

            var res = client.GetTrades("btc_mxn");

            Assert.AreNotEqual <int>(0, res.Count);
            Assert.AreNotEqual <decimal>(0, res[0].Amount);
            Assert.IsFalse(string.IsNullOrEmpty(res[0].BookName));

            Assert.IsTrue(res[0].MakerSide != MarketSide.None);
            Assert.AreNotEqual <decimal>(0M, res[0].Price);
            Assert.AreNotEqual <decimal>(0M, res[0].Amount);
            Assert.AreNotEqual <long>(0, res[0].TradeId);

            var diff = res[0].CreatedAt - default(System.DateTime);

            Assert.IsTrue(diff > System.TimeSpan.Zero);
        }
Example #27
0
        public void GetOpenTradeOrdersExpected()
        {
            const string BookName = "btc_mxn";

            using (var client = new BitsoClient(this.TestingServerUrl, this.ApiKey, this.ApiSecret))
            {
                try
                {
                    var res = client.GetOpenTradeOrders(BookName);

                    Assert.IsNotNull(res);
                }
                catch (BitsoException ex)
                {
                    this.TestContext.WriteLine(ex.Header);
                    throw;
                }
            }
        }
Example #28
0
        public void GetFundingDestinationsExpected()
        {
            const string CurrencyName = "mxn";

            using (var client = new BitsoClient(this.TestingServerUrl, this.ApiKey, this.ApiSecret))
            {
                try
                {
                    var res = client.GetFundingDestinations(CurrencyName);
                    Assert.IsNotNull(res);
                    Assert.IsFalse(string.IsNullOrEmpty(res.AccountIdentifierName));
                    Assert.IsFalse(string.IsNullOrEmpty(res.AccountIdentifier));
                }
                catch (BitsoException ex)
                {
                    this.TestContext.WriteLine(ex.Header);
                    throw;
                }
            }
        }
Example #29
0
        public void GetLedgerFundingExpected()
        {
            using (var client = new BitsoClient(this.TestingServerUrl, this.ApiKey, this.ApiSecret))
            {
                try
                {
                    var res = client.GetLedgerFunding();
                    Assert.IsNotNull(res);
                    Assert.AreNotEqual <int>(0, res.Count);

                    res = client.GetLedgerFunding(string.Empty, SortDirection.Ascending, 5);
                    Assert.IsNotNull(res);
                    Assert.AreEqual <int>(5, res.Count);
                }
                catch (BitsoException ex)
                {
                    this.TestContext.WriteLine(ex.Header);
                    throw;
                }
            }
        }
Example #30
0
        public void GetTickerExpected1()
        {
            var client = new BitsoClient(this.TestingServerUrl);

            var res = client.GetTicker("btc_mxn");

            Assert.IsNotNull(res);
            Assert.IsFalse(string.IsNullOrWhiteSpace(res.BookName));

            Assert.AreNotEqual <decimal>(0M, res.Ask);
            Assert.AreNotEqual <decimal>(0M, res.Bid);
            Assert.AreNotEqual <decimal>(0M, res.VolumeWeightedAveragePrice);
            Assert.AreNotEqual <decimal>(0M, res.Low);
            Assert.AreNotEqual <decimal>(0M, res.High);
            Assert.AreNotEqual <decimal>(0M, res.Last);
            Assert.AreNotEqual <decimal>(0M, res.Volume);

            var diff = res.CreatedAt - default(System.DateTime);

            Assert.IsTrue(diff > System.TimeSpan.Zero);
        }