Skip to content

Commit

Permalink
Updated testing application (MT4) to test functions: SymbolsTotal, Sy…
Browse files Browse the repository at this point in the history
…mbolName, SymbolSelect, SymbolInfoInteger
  • Loading branch information
vdemydiuk committed Nov 1, 2016
1 parent 09b72fc commit 7d3af82
Show file tree
Hide file tree
Showing 2 changed files with 189 additions and 21 deletions.
164 changes: 146 additions & 18 deletions TestClients/TestApiClientUI/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 43 additions & 3 deletions TestClients/TestApiClientUI/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public Form1()

comboBox1.SelectedIndex = 0;
comboBox2.SelectedIndex = 0;
comboBox4.SelectedIndex = 0;

_timerTradeMonitor = new TimerTradeMonitor(_apiClient);
_timerTradeMonitor.Interval = 10000; // 10 sec
Expand Down Expand Up @@ -500,7 +501,8 @@ private void AddToLog(string msg)
{
RunOnUiThread(() =>
{
listBoxEventLog.Items.Add(msg);
var time = DateTime.Now.ToString("h:mm:ss tt");
listBoxEventLog.Items.Add($"[{time}]: {msg}");
listBoxEventLog.SetSelected(listBoxEventLog.Items.Count - 1, true);
listBoxEventLog.SetSelected(listBoxEventLog.Items.Count - 1, false);
});
Expand Down Expand Up @@ -1125,7 +1127,7 @@ private async void button26_Click(object sender, EventArgs e)
{
string symbol = textBoxSelectedSymbol.Text;
ENUM_TIMEFRAMES timeframes;
Enum.TryParse<ENUM_TIMEFRAMES>(comboBox3.SelectedValue.ToString(), out timeframes);
Enum.TryParse(comboBox3.SelectedValue.ToString(), out timeframes);

DateTime startTime = dateTimePicker1.Value;
DateTime stopTime = dateTimePicker1.Value;
Expand Down Expand Up @@ -1158,6 +1160,45 @@ private void button27_Click(object sender, EventArgs e)
}
}

//SymbolsTotal
private async void button28_Click(object sender, EventArgs e)
{
var result_true = await Execute(() => _apiClient.SymbolsTotal(true));
AddToLog($"SymbolsTotal [true]: result = {result_true}");

var result_false = await Execute(() => _apiClient.SymbolsTotal(false));
AddToLog($"SymbolsTotal [false]: result = {result_false}");
}

//SymbolName
private async void button29_Click(object sender, EventArgs e)
{
int pos = 1;
bool selected = false;
var result = await Execute(() => _apiClient.SymbolName(pos, selected));
AddToLog($"SymbolName [true]: result = {result}");
}

//SymbolSelect
private async void button30_Click(object sender, EventArgs e)
{
var symbol = textBox1.Text;
bool select = true;
var result = await Execute(() => _apiClient.SymbolSelect(symbol, select));
AddToLog($"SymbolSelect [true]: result = {result}");
}

//SymbolInfoInteger
private async void button32_Click(object sender, EventArgs e)
{
var symbol = textBox1.Text;
EnumSymbolInfoInteger propId;
Enum.TryParse(comboBox4.Text, out propId);

var result = await Execute(() => _apiClient.SymbolInfoInteger(symbol, propId));
AddToLog($"SymbolInfoInteger [true]: result = {result}");
}

private void _tradeMonitor_AvailabilityOrdersChanged(object sender, AvailabilityOrdersEventArgs e)
{
if (e.Opened != null)
Expand All @@ -1170,6 +1211,5 @@ private void _tradeMonitor_AvailabilityOrdersChanged(object sender, Availability
AddToLog($"{sender.GetType()}: Closed orders - {string.Join(", ", e.Closed.Select(o => o.Ticket).ToList())}");
}
}

}
}

0 comments on commit 7d3af82

Please sign in to comment.