forked from DigitalRuby/ExchangeSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWithdrawOption.cs
47 lines (38 loc) · 1.04 KB
/
WithdrawOption.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Threading.Tasks;
using CommandLine;
using ExchangeSharp;
using ExchangeSharpConsole.Options.Interfaces;
namespace ExchangeSharpConsole.Options
{
[Verb("withdraw", HelpText = "Withdraw given amount in given currency to target address")]
public class WithdrawOption
: BaseOption,
IOptionPerExchange,
IOptionWithAddress,
IOptionWithCurrencyAmount
{
public string ExchangeName { get; set; }
public string Address { get; set; }
public string Tag { get; set; }
public decimal Amount { get; set; }
public string Currency { get; set; }
public override async Task RunCommand()
{
using var api = await GetExchangeInstanceAsync(ExchangeName);
Authenticate(api);
var result = await api.WithdrawAsync(
new ExchangeWithdrawalRequest
{
Address = Address,
AddressTag = Tag,
Amount = Amount,
Currency = Currency
}
);
Console.WriteLine(
$"Withdrawal successful: {result.Success}, id: {result.Id}, optional message: {result.Message}"
);
}
}
}