mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-05 23:17:52 +00:00
Issue #284: MtApi4/MQL4 - added function GetSymbols
This commit is contained in:
+1860
-1724
File diff suppressed because it is too large
Load Diff
@@ -8,44 +8,12 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace TestApiClientUI
|
||||
{
|
||||
class MtLogger : IMtLogger
|
||||
{
|
||||
public void Debug(object message)
|
||||
{
|
||||
Write("DEBUG", message);
|
||||
}
|
||||
|
||||
public void Error(object message)
|
||||
{
|
||||
Write("ERROR", message);
|
||||
}
|
||||
|
||||
public void Fatal(object message)
|
||||
{
|
||||
Write("FATAL", message);
|
||||
}
|
||||
|
||||
public void Info(object message)
|
||||
{
|
||||
Write("INFO", message);
|
||||
}
|
||||
|
||||
public void Warn(object message)
|
||||
{
|
||||
Write("WARN", message);
|
||||
}
|
||||
private void Write(string level, object message)
|
||||
{
|
||||
Console.WriteLine($"[{Environment.CurrentManagedThreadId}] [{level}] {message}");
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private readonly List<Action> _groupOrderCommands = [];
|
||||
private readonly MtApiClient _apiClient = new (new MtLogger());
|
||||
private readonly MtApiClient _apiClient = new(new MtLogger());
|
||||
private readonly TimerTradeMonitor _timerTradeMonitor;
|
||||
private readonly TimeframeTradeMonitor _timeframeTradeMonitor;
|
||||
|
||||
@@ -742,7 +710,7 @@ namespace TestApiClientUI
|
||||
|
||||
var symbol = textBoxOrderSymbol.Text;
|
||||
|
||||
var cmd = (TradeOperation) comboBoxOrderCommand.SelectedIndex;
|
||||
var cmd = (TradeOperation)comboBoxOrderCommand.SelectedIndex;
|
||||
|
||||
double volume;
|
||||
double.TryParse(textBoxOrderVolume.Text, out volume);
|
||||
@@ -750,7 +718,7 @@ namespace TestApiClientUI
|
||||
double price;
|
||||
double.TryParse(textBoxOrderPrice.Text, out price);
|
||||
|
||||
var slippage = (int) numericOrderSlippage.Value;
|
||||
var slippage = (int)numericOrderSlippage.Value;
|
||||
|
||||
double stoploss;
|
||||
double.TryParse(textBoxOrderStoploss.Text, out stoploss);
|
||||
@@ -805,8 +773,8 @@ namespace TestApiClientUI
|
||||
private async void button16_Click(object sender, EventArgs e)
|
||||
{
|
||||
var ticket = int.Parse(textBoxIndexTicket.Text);
|
||||
var selectMode = (OrderSelectMode) comboBox1.SelectedIndex;
|
||||
var selectSource = (OrderSelectSource) comboBox2.SelectedIndex;
|
||||
var selectMode = (OrderSelectMode)comboBox1.SelectedIndex;
|
||||
var selectSource = (OrderSelectSource)comboBox2.SelectedIndex;
|
||||
|
||||
var order = await Execute(() => _apiClient.GetOrder(ticket, selectMode, selectSource));
|
||||
|
||||
@@ -1544,5 +1512,19 @@ namespace TestApiClientUI
|
||||
PrintLog($"iBarShift result1 = {result1}, time = {time1}");
|
||||
PrintLog($"iBarShift result2 = {result2}, time = {time2}");
|
||||
}
|
||||
|
||||
private async void button74_Click(object sender, EventArgs e)
|
||||
{
|
||||
listBoxAllSymbols.Items.Clear();
|
||||
|
||||
var result = await Execute(() => _apiClient.GetSymbols(checkBox3.Checked));
|
||||
if (result != null)
|
||||
{
|
||||
foreach (string? r in result)
|
||||
listBoxAllSymbols.Items.Add(r);
|
||||
}
|
||||
int count = result != null ? result.Count : 0;
|
||||
PrintLog($"GetSymbols: {count}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
@@ -26,36 +26,36 @@
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
using MtApi;
|
||||
|
||||
namespace TestApiClientUI
|
||||
{
|
||||
class MtLogger : IMtLogger
|
||||
{
|
||||
public void Debug(object message)
|
||||
{
|
||||
Write("DEBUG", message);
|
||||
}
|
||||
|
||||
public void Error(object message)
|
||||
{
|
||||
Write("ERROR", message);
|
||||
}
|
||||
|
||||
public void Fatal(object message)
|
||||
{
|
||||
Write("FATAL", message);
|
||||
}
|
||||
|
||||
public void Info(object message)
|
||||
{
|
||||
Write("INFO", message);
|
||||
}
|
||||
|
||||
public void Warn(object message)
|
||||
{
|
||||
Write("WARN", message);
|
||||
}
|
||||
private void Write(string level, object message)
|
||||
{
|
||||
Console.WriteLine($"[{Environment.CurrentManagedThreadId}] [{level}] {message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user