Exemple #1
0
        /// <summary>
        /// Used to retrieve the balance from your account for a specific currency.
        /// </summary>
        /// <param name="currency">a string literal for the currency (ie. BTC)</param>
        /// <param name="keys">The account information. Uses 'DefaultAccountKeys' when null.</param>
        /// <returns></returns>
        public Task <JObject> API_GetDepositAddressAsync(String currency, AccountKeys keys = null)
        {
            var data = new Dictionary <String, String>();

            data.Add("currency", currency);
            return(CallPrivateBittrexAPIAsync("account/getdepositaddress", keys, data));
        }
Exemple #2
0
        /// <summary>
        /// Used to retrieve your deposit history.
        /// </summary>
        /// <param name="currency">a string literal for the currecy (ie. BTC). If omitted, will return for all currencies</param>
        /// <param name="keys">The account information. Uses 'DefaultAccountKeys' when null.</param>
        /// <returns></returns>
        public Task <JObject> API_GetDepositHistoryAsync
            (String currency = null, AccountKeys keys = null)
        {
            var data = new Dictionary <String, String>();

            data.AddOptional("currency", currency);
            return(CallPrivateBittrexAPIAsync("account/getdeposithistory", keys, data));
        }
Exemple #3
0
        /// <summary>
        /// Used to retrieve your order history.
        /// </summary>
        /// <param name="market">a string literal for the market (ie. BTC-LTC). If ommited, will return for all markets</param>
        /// <param name="keys">The account information. Uses 'DefaultAccountKeys' when null.</param>
        /// <returns></returns>
        public Task <JObject> API_GetOrderHistoryAsync
            (String market = null, AccountKeys keys = null)
        {
            var data = new Dictionary <String, String>();

            data.AddOptional("market", market);
            return(CallPrivateBittrexAPIAsync("account/getorderhistory", keys, data));
        }
Exemple #4
0
        /// <summary>
        /// Used to retrieve a single order by uuid.
        /// </summary>
        /// <param name="uuid">the uuid of the buy or sell order</param>
        /// <param name="keys">The account information. Uses 'DefaultAccountKeys' when null.</param>
        /// <returns></returns>
        public Task <JObject> API_GetOrderAsync
            (String uuid, AccountKeys keys = null)
        {
            var data = new Dictionary <String, String>();

            data.Add("uuid", uuid);
            return(CallPrivateBittrexAPIAsync("account/getorder", keys, data));
        }
Exemple #5
0
        /// <summary>
        /// Used to cancel a buy or sell order.
        /// </summary>
        /// <param name="keys">The account information. Uses 'DefaultAccountKeys' when null.</param>
        /// <returns></returns>
        public Task <JObject> API_CancelAsync
            (String uuid, AccountKeys keys = null)
        {
            var data = new Dictionary <String, String>();

            data.Add("uuid", uuid);
            return(CallPrivateBittrexAPIAsync("market/cancel", keys, data));
        }
Exemple #6
0
        /// <summary>
        /// Used to place an sell order in a specific market. Use selllimit to place limit orders. Make sure you have the proper permissions set on your API keys for this call to work
        /// </summary>
        /// <param name="market">a string literal for the market (ex: BTC-LTC)</param>
        /// <param name="quantity">the amount to purchase</param>
        /// <param name="rate">the rate at which to place the order.</param>
        /// <param name="keys">The account information. Uses 'DefaultAccountKeys' when null.</param>
        /// <returns></returns>
        public Task <JObject> API_SellLimitAsync
            (String market, Decimal quantity, Decimal rate, AccountKeys keys = null)
        {
            var data = new Dictionary <String, String>();

            data.Add("market", market);
            data.Add("quantity", quantity.ToString(this.ExchangeCulture));
            data.Add("rate", rate.ToString(this.ExchangeCulture));
            return(CallPrivateBittrexAPIAsync("market/selllimit", keys, data));
        }
Exemple #7
0
        public async Task <JObject> CallPrivateBittrexAPIAsync
            (string function, AccountKeys keys = null, Dictionary <String, String> data = null)
        {
            var account = keys ?? DefaultAccountKeys;

            if (account == null)
            {
                throw new ArgumentNullException("accountKeys", "DefaultAccountKeys was not set and no keys were provided.");
            }


            var nonce = ObtainNonce.Invoke();
            var uri   = String.Format("{0}/{1}?apikey={2}&nonce={3}", ApiUrl, function, account.ApiKey, nonce);

            StringBuilder sb = new StringBuilder(uri);

            if (data != null)
            {
                foreach (var kvp in data)
                {
                    sb.AppendFormat("&{0}={1}", kvp.Key, kvp.Value);
                }
            }
            uri = sb.ToString();

            HttpWebRequest webRequest = (HttpWebRequest)HttpWebRequest.Create(uri);

            webRequest.Method = "GET";

            byte[] secretKey = ExchangeEncoding.GetBytes(account.SecretKey);
            var    sign      = base.HashAsHMACSHA512(secretKey, ExchangeEncoding.GetBytes(uri));

            webRequest.Headers.Add("apisign", ByteArrayToHexString(sign));

            try
            {
                var fullResult = await CallApiAsync <JObject>(webRequest);

                return(fullResult);
            }
            finally
            {
            }
        }
Exemple #8
0
 public CryptocoinExchange(String apiKey, String secretKey) : this()
 {
     DefaultAccountKeys = new AccountKeys(apiKey, secretKey);
 }
Exemple #9
0
        /// <summary>
        /// Used to withdraw funds from your account. note: please account for txfee.
        /// </summary>
        /// <param name="currency">a string literal for the currency (ie. BTC)</param>
        /// <param name="quantity">the quantity of coins to withdraw</param>
        /// <param name="address"> the address where to send the funds</param>
        /// <param name="paymentid">used for CryptoNotes/BitShareX/Nxt optional field (memo/paymentid)</param>
        /// <param name="keys">The account information. Uses 'DefaultAccountKeys' when null.</param>
        /// <returns></returns>
        public Task <JObject> API_WithdrawAsync
            (String currency, Decimal quantity, String address, String paymentid = null, AccountKeys keys = null)
        {
            var data = new Dictionary <String, String>();

            data.Add("currency", currency);
            data.Add("quantity", quantity.ToString(this.ExchangeCulture));
            data.Add("address", address);
            data.AddOptional("paymentid", paymentid);
            return(CallPrivateBittrexAPIAsync("account/withdraw", keys, data));
        }
Exemple #10
0
 /// <summary>
 /// Used to retrieve all balances from your account
 /// </summary>
 /// <param name="keys">The account information. Uses 'DefaultAccountKeys' when null.</param>
 /// <returns></returns>
 public Task <JObject> API_GetBalancesAsync(AccountKeys keys = null)
 {
     return(CallPrivateBittrexAPIAsync("account/getbalances", keys));
 }