/// <summary> /// Execute a transfer between the spot account and a futures account /// </summary> /// <param name="asset">The asset to transfer</param> /// <param name="amount">Amount to transfer</param> /// <param name="transferType">The transfer direction</param> /// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param> /// <param name="ct">Cancellation token</param> /// <returns>The transaction id</returns> public async Task <WebCallResult <BinanceTransaction> > TransferFuturesAccountAsync(string asset, decimal amount, FuturesTransferType transferType, long?receiveWindow = null, CancellationToken ct = default) { var timestampResult = await _baseClient.CheckAutoTimestamp(ct).ConfigureAwait(false); if (!timestampResult) { return(new WebCallResult <BinanceTransaction>(timestampResult.ResponseStatusCode, timestampResult.ResponseHeaders, null, timestampResult.Error)); } var parameters = new Dictionary <string, object> { { "asset", asset }, { "amount", amount }, { "type", JsonConvert.SerializeObject(transferType, new FuturesTransferTypeConverter(false)) }, { "timestamp", _baseClient.GetTimestamp() } }; parameters.AddOptionalParameter("recvWindow", receiveWindow?.ToString(CultureInfo.InvariantCulture) ?? _baseClient.DefaultReceiveWindow.TotalMilliseconds.ToString(CultureInfo.InvariantCulture)); return(await _baseClient.SendRequestInternal <BinanceTransaction>(_baseClient.GetUrlSpot(futuresTransferEndpoint, api, publicVersion), HttpMethod.Post, ct, parameters, true).ConfigureAwait(false)); }
/// <summary> /// Execute a transfer between the spot account and a futures account /// </summary> /// <param name="asset">The asset to transfer</param> /// <param name="amount">Amount to transfer</param> /// <param name="transferType">The transfer direction</param> /// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param> /// <param name="ct">Cancellation token</param> /// <returns>The transaction id</returns> public WebCallResult <BinanceTransaction> TransferFuturesAccount(string asset, decimal amount, FuturesTransferType transferType, long?receiveWindow = null, CancellationToken ct = default) => TransferFuturesAccountAsync(asset, amount, transferType, receiveWindow, ct).Result;