예제 #1
0
        /// <summary>
        /// Transfer asset between parent and sub account
        /// </summary>
        /// <param name="subAccountId">The target sub account id to transfer to or from</param>
        /// <param name="currency">The crypto currency to transfer</param>
        /// <param name="amount">The amount of asset to transfer</param>
        /// <param name="transferType">The type of transfer</param>
        /// <returns>Unique transfer id</returns>
        public async Task <WebCallResult <long> > TransferWithSubAccountAsync(long subAccountId, string currency, decimal amount, HuobiTransferType transferType)
        {
            var parameters = new Dictionary <string, object>
            {
                { "sub-uid", subAccountId },
                { "currency", currency },
                { "amount", amount },
                { "type", JsonConvert.SerializeObject(transferType, new TransferTypeConverter(false)) }
            };

            var result = await ExecuteRequest <HuobiBasicResponse <long> >(GetUrl(TransferWithSubAccountEndpoint, "1"), "POST", parameters, true).ConfigureAwait(false);

            return(new WebCallResult <long>(result.ResponseStatusCode, result.ResponseHeaders, result.Data?.Data ?? 0, result.Error));
        }
예제 #2
0
        /// <summary>
        /// Transfer asset between parent and sub account
        /// </summary>
        /// <param name="subAccountId">The target sub account id to transfer to or from</param>
        /// <param name="currency">The crypto currency to transfer</param>
        /// <param name="amount">The amount of asset to transfer</param>
        /// <param name="transferType">The type of transfer</param>
        /// <param name="ct">Cancellation token</param>
        /// <returns>Unique transfer id</returns>
        public async Task <WebCallResult <long> > TransferWithSubAccountAsync(long subAccountId, string currency, decimal amount, HuobiTransferType transferType, CancellationToken ct = default)
        {
            currency.ValidateNotNull(nameof(currency));
            var parameters = new Dictionary <string, object>
            {
                { "sub-uid", subAccountId },
                { "currency", currency },
                { "amount", amount },
                { "type", JsonConvert.SerializeObject(transferType, new TransferTypeConverter(false)) }
            };

            return(await SendHuobiRequest <long>(GetUrl(TransferWithSubAccountEndpoint, "1"), HttpMethod.Post, ct, parameters, true).ConfigureAwait(false));
        }
예제 #3
0
 /// <summary>
 /// Transfer asset between parent and sub account
 /// </summary>
 /// <param name="subAccountId">The target sub account id to transfer to or from</param>
 /// <param name="currency">The crypto currency to transfer</param>
 /// <param name="amount">The amount of asset to transfer</param>
 /// <param name="transferType">The type of transfer</param>
 /// <returns>Unique transfer id</returns>
 public WebCallResult <long> TransferWithSubAccount(long subAccountId, string currency, decimal amount, HuobiTransferType transferType) => TransferWithSubAccountAsync(subAccountId, currency, amount, transferType).Result;
예제 #4
0
 /// <summary>
 /// Transfer asset between parent and sub account
 /// </summary>
 /// <param name="subAccountId">The target sub account id to transfer to or from</param>
 /// <param name="currency">The crypto currency to transfer</param>
 /// <param name="amount">The amount of asset to transfer</param>
 /// <param name="transferType">The type of transfer</param>
 /// <param name="ct">Cancellation token</param>
 /// <returns>Unique transfer id</returns>
 public WebCallResult <long> TransferWithSubAccount(long subAccountId, string currency, decimal amount, HuobiTransferType transferType, CancellationToken ct = default) =>
 TransferWithSubAccountAsync(subAccountId, currency, amount, transferType, ct).Result;