Beispiel #1
0
        public void GetAnswerAsJsonString(string key, string secret, string apiUri)
        {
            // Arrange
            var operations = new Dictionary <string, string>
            {
                { "method", "dummyOperation" }
            };

            // Act
            var    webApi     = new BTCEWebApi(key, secret);
            string jsonString = webApi.GetAnswerAsJsonString(operations, apiUri);

            // Assert
            if (apiUri == "http://www.invalid.test")
            {
                Assert.IsFalse(jsonString.Contains("success"));
            }
            else
            {
                Assert.IsTrue(jsonString.Contains("success"));
            }

            // This must be ensured because each operation can only use one nonce a nonce can only be generated every one second
            // due to its UnixTime nature.
            Thread.Sleep(1000);
        }
Beispiel #2
0
        /// <summary>
        /// Sets the key and secret to define the account to be used for further operations.
        /// </summary>
        /// <param name="apiKey">The key that the Market Place Website (eg.: BTC-e) issues to you.</param>
        /// <param name="apiSecret">The secret that the Market Place Website (eg.: BTC-e) issues to you.</param>
        /// <exception cref="ArgumentNullException">Thrown when API key and/or secret are null or empty.</exception>
        public void SetKeyAndSecret(string apiKey, string apiSecret)
        {
            _btceWebApi = new BTCEWebApi(apiKey, apiSecret);

            LoggedOnOperationsAreAllowed = true;
        }
Beispiel #3
0
 /// <summary>
 /// Creates an instance of the API without setting key and secret. Only operations which do not require these properties are allowed.
 /// </summary>
 public ViolinBtce()
 {
     _btceWebApi = new BTCEWebApi("dummyKey", "dummySecret");
     LoggedOnOperationsAreAllowed = false;
 }
Beispiel #4
0
 /// <summary>
 /// Creates an instance of the API and sets the key and secret to define the account to be used for further operations.
 /// </summary>
 /// <param name="apiKey">The key that the Market Place Website (eg.: BTC-e) issues to you.</param>
 /// <param name="apiSecret">The secret that the Market Place Website (eg.: BTC-e) issues to you.</param>
 /// <exception cref="ArgumentNullException">Thrown when API key and/or secret are null or empty.</exception>
 public ViolinBtce(string apiKey, string apiSecret)
 {
     _btceWebApi = new BTCEWebApi(apiKey, apiSecret);
     LoggedOnOperationsAreAllowed = true;
 }