-
-
Notifications
You must be signed in to change notification settings - Fork 372
/
Copy pathCandlesOption.cs
45 lines (38 loc) · 965 Bytes
/
CandlesOption.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
using System;
using System.Threading.Tasks;
using CommandLine;
using ExchangeSharp;
using ExchangeSharpConsole.Options.Interfaces;
namespace ExchangeSharpConsole.Options
{
[Verb(
"candles",
HelpText = "Prints all candle data from a 12 days period for the given exchange."
)]
public class CandlesOption
: BaseOption,
IOptionPerExchange,
IOptionPerMarketSymbol,
IOptionWithPeriod
{
public override async Task RunCommand()
{
using var api = await GetExchangeInstanceAsync(ExchangeName);
var candles = await api.GetCandlesAsync(
MarketSymbol,
Period,
//TODO: Add interfaces for start and end date
CryptoUtility.UtcNow.AddDays(-12),
CryptoUtility.UtcNow
);
foreach (var candle in candles)
{
Console.WriteLine(candle.ToString());
}
WaitInteractively();
}
public string ExchangeName { get; set; }
public string MarketSymbol { get; set; }
public int Period { get; set; }
}
}