コード例 #1
0
        protected override async Task <ExchangeWithdrawalResponse> OnWithdrawAsync(ExchangeWithdrawalRequest withdrawalRequest)
        {
            ExchangeWithdrawalResponse response = new ExchangeWithdrawalResponse {
                Success = false
            };

            if (!String.IsNullOrEmpty(withdrawalRequest.AddressTag))
            {
                withdrawalRequest.AddressTag = "::" + withdrawalRequest.AddressTag;
            }

            // {"fault": null,"userId": 797,"userName": "******","id": 11285042,"state": "APPROVED","createDate": 1432197911364,"lastModifyDate": 1432197911802,"verificationType": "NONE","verificationData": null, "comment": null, "description": "Transfer from Livecoin", "amount": 0.002, "currency": "BTC", "accountTo": "B1099909", "acceptDate": null, "valueDate": null, "docDate": 1432197911364, "docNumber": 11111111, "correspondentDetails": null, "accountFrom": "B0000001", "outcome": false, "external": null, "externalKey": "1111111", "externalSystemId": 18, "externalServiceId": null, "wallet": "1111111" }
            JToken token = await MakeJsonRequestAsync <JToken>("/payment/out/coin?currency=" + withdrawalRequest.Symbol + "&wallet=" + withdrawalRequest.Address + withdrawalRequest.AddressTag + "&amount=" + withdrawalRequest.Amount, BaseUrl, await OnGetNoncePayloadAsync(), "POST");

            response.Success = true;
            return(response);
        }
コード例 #2
0
        protected override async Task <ExchangeWithdrawalResponse> OnWithdrawAsync(ExchangeWithdrawalRequest withdrawalRequest)
        {
            ExchangeWithdrawalResponse response = new ExchangeWithdrawalResponse {
                Success = false
            };

            var payload = await OnGetNoncePayloadAsync();

            payload.Add("method", "withdraw");
            payload.Add("coin", withdrawalRequest.Symbol);
            payload.Add("amount", withdrawalRequest.Amount);
            payload.Add("address", withdrawalRequest.Address);
            // ( [success] => 1 [error] => Array ([0] => Withdraw requested. ))
            JToken token = await MakeJsonRequestAsync <JToken>("/api", null, payload, "POST");

            if (token["success"].ConvertInvariant <int>() == 1)
            {
                response.Success = true;
            }
            return(response);
        }
コード例 #3
0
        protected override async Task <ExchangeWithdrawalResponse> OnWithdrawAsync(ExchangeWithdrawalRequest withdrawalRequest)
        {
            ExchangeWithdrawalResponse response = new ExchangeWithdrawalResponse {
                Success = false
            };

            var payload = await OnGetNoncePayloadAsync();

            payload.Add("Currency", withdrawalRequest.Symbol);
            payload.Add("Address", withdrawalRequest.Address);
            if (!string.IsNullOrEmpty(withdrawalRequest.AddressTag))
            {
                payload.Add("PaymentId", withdrawalRequest.AddressTag);
            }
            payload.Add("Amount", withdrawalRequest.Amount);
            JToken token = await MakeJsonRequestAsync <JToken>("/SubmitWithdraw", null, payload, "POST");

            response.Id      = token.ConvertInvariant <int>().ToStringInvariant();
            response.Success = true;
            return(response);
        }
コード例 #4
0
        /// <summary>A withdrawal request. Fee is automatically subtracted from the amount.</summary>
        /// <param name="withdrawalRequest">The withdrawal request.</param>
        /// <returns>Withdrawal response from Binance</returns>
        protected override async Task <ExchangeWithdrawalResponse> OnWithdrawAsync(ExchangeWithdrawalRequest withdrawalRequest)
        {
            if (string.IsNullOrWhiteSpace(withdrawalRequest.Symbol))
            {
                throw new ArgumentException("Symbol must be provided for Withdraw");
            }
            else if (string.IsNullOrWhiteSpace(withdrawalRequest.Address))
            {
                throw new ArgumentException("Address must be provided for Withdraw");
            }
            else if (withdrawalRequest.Amount <= 0)
            {
                throw new ArgumentException("Withdrawal amount must be positive and non-zero");
            }

            Dictionary <string, object> payload = await OnGetNoncePayloadAsync();

            payload["asset"]   = withdrawalRequest.Symbol;
            payload["address"] = withdrawalRequest.Address;
            payload["amount"]  = withdrawalRequest.Amount;
            payload["name"]    = withdrawalRequest.Description ?? "apiwithdrawal"; // Contrary to what the API docs say, name is required

            if (!string.IsNullOrWhiteSpace(withdrawalRequest.AddressTag))
            {
                payload["addressTag"] = withdrawalRequest.AddressTag;
            }

            JToken response = await MakeJsonRequestAsync <JToken>("/withdraw.html", WithdrawalUrlPrivate, payload, "POST");

            ExchangeWithdrawalResponse withdrawalResponse = new ExchangeWithdrawalResponse
            {
                Id      = response["id"].ToStringInvariant(),
                Message = response["msg"].ToStringInvariant(),
            };

            return(withdrawalResponse);
        }