Issue #25: Implemented function CopyTicks. Used json request

This commit is contained in:
vdemydiuk
2016-11-05 00:52:52 +02:00
parent ad55740bc7
commit ddcd6fa2d5
21 changed files with 2243 additions and 27 deletions
+29 -1
View File
@@ -31,6 +31,7 @@ namespace MtApi5TestClient
public DelegateCommand CopyTickVolumeCommand { get; private set; }
public DelegateCommand CopyRealVolumeCommand { get; private set; }
public DelegateCommand CopySpreadCommand { get; private set; }
public DelegateCommand CopyTicksCommand { get; private set; }
public DelegateCommand SymbolsTotalCommand { get; private set; }
public DelegateCommand SymbolNameCommand { get; private set; }
@@ -207,7 +208,8 @@ namespace MtApi5TestClient
CopyTickVolumeCommand = new DelegateCommand(ExecuteCopyTickVolume);
CopyRealVolumeCommand = new DelegateCommand(ExecuteCopyRealVolume);
CopySpreadCommand = new DelegateCommand(ExecuteCopySpread);
CopyTicksCommand = new DelegateCommand(ExecuteCopyTicks);
SymbolsTotalCommand = new DelegateCommand(ExecuteSymbolsTotal);
SymbolNameCommand = new DelegateCommand(ExecuteSymbolName);
SymbolSelectCommand = new DelegateCommand(ExecuteSymbolSelect);
@@ -569,6 +571,32 @@ namespace MtApi5TestClient
AddLog("CopySpread: success");
}
private async void ExecuteCopyTicks(object o)
{
if (string.IsNullOrEmpty(TimeSeriesValues?.SymbolValue)) return;
TimeSeriesResults.Clear();
var result = await Execute(() => _mtApiClient.CopyTicks(TimeSeriesValues.SymbolValue));
if (result == null)
{
AddLog("CopyTicks: result is null");
return;
}
AddLog("CopyTicks: success.");
RunOnUiThread(() =>
{
foreach (var v in result)
{
var tickStr = $"time = {v.time}, bid = {v.bid}, ask = {v.ask}, last = {v.last}, volume = {v.volume}";
TimeSeriesResults.Add(tickStr);
}
});
}
private async void ExecuteSymbolsTotal(object o)
{
var selectedCount = await Execute(() => _mtApiClient.SymbolsTotal(true));