Skip to content

Commit 8a93aed

Browse files
committed
Currencies option for testing
1 parent 0be9484 commit 8a93aed

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using CommandLine;
2+
using ExchangeSharpConsole.Options.Interfaces;
3+
using Newtonsoft.Json;
4+
using System;
5+
using System.Threading.Tasks;
6+
7+
namespace ExchangeSharpConsole.Options
8+
{
9+
[Verb("currencies", HelpText = "Gets a list of currencies available on the exchange")]
10+
public class CurrenciesOption : BaseOption, IOptionPerExchange
11+
{
12+
public string ExchangeName { get; set; }
13+
14+
public override async Task RunCommand()
15+
{
16+
using var api = GetExchangeInstance(ExchangeName);
17+
18+
Authenticate(api);
19+
20+
var currencies = await api.GetCurrenciesAsync();
21+
22+
foreach (var c in currencies)
23+
{
24+
Console.WriteLine($"{c.Key}: {c.Value.FullName}, {c.Value.AltName}");
25+
}
26+
}
27+
}
28+
}

src/ExchangeSharpConsole/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public partial class Program
1818
typeof(CancelOrderOption),
1919
typeof(CandlesOption),
2020
typeof(ConvertOption),
21+
typeof(CurrenciesOption),
2122
typeof(ExampleOption),
2223
typeof(ExportOption),
2324
typeof(InteractiveOption),

0 commit comments

Comments
 (0)