forked from DigitalRuby/ExchangeSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCandlesOption.cs
38 lines (31 loc) · 933 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
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; }
}
}