Issue #31: Implemented function SymbolInfoDouble in MtApi MT4

This commit is contained in:
vdemydiuk
2016-11-14 14:04:31 +02:00
parent c64417474a
commit 32f6018858
13 changed files with 332 additions and 188 deletions
+46
View File
@@ -0,0 +1,46 @@
namespace MtApi
{
// https://docs.mql4.com/constants/environment_state/marketinfoconstants#enum_symbol_info_double
public enum EnumSymbolInfoDouble
{
SYMBOL_BID = 1, // Bid - best sell offer
SYMBOL_BIDHIGH = 2, // Not supported
SYMBOL_BIDLOW = 3, // Not supported
SYMBOL_ASK = 4, // Ask - best buy offer
SYMBOL_ASKHIGH = 5, // Not supported
SYMBOL_ASKLOW = 6, // Not supported
SYMBOL_LAST = 7, // Not supported
SYMBOL_LASTHIGH = 8, // Not supported
SYMBOL_LASTLOW = 9, // Not supported
SYMBOL_POINT = 16, // Symbol point value
SYMBOL_TRADE_TICK_VALUE = 26, // Value of SYMBOL_TRADE_TICK_VALUE_PROFIT
SYMBOL_TRADE_TICK_VALUE_PROFIT = 53, // Not supported
SYMBOL_TRADE_TICK_VALUE_LOSS = 54, // Not supported
SYMBOL_TRADE_TICK_SIZE = 27, // Minimal price change
SYMBOL_TRADE_CONTRACT_SIZE = 28, // Trade contract size
SYMBOL_VOLUME_MIN = 34, // Minimal volume for a deal
SYMBOL_VOLUME_MAX = 35, // Maximal volume for a deal
SYMBOL_VOLUME_STEP = 36, // Minimal volume change step for deal execution
SYMBOL_VOLUME_LIMIT = 55, // Not supported
SYMBOL_SWAP_LONG = 38, // Buy order swap value
SYMBOL_SWAP_SHORT = 39, // Sell order swap value
SYMBOL_MARGIN_INITIAL = 42, // Initial margin means the amount in the margin currency required for opening an order with the volume of one lot. It is used for checking a client's assets when he or she enters the market.
SYMBOL_MARGIN_MAINTENANCE = 43, // The maintenance margin. If it is set, it sets the margin amount in the margin currency of the symbol, charged from one lot. It is used for checking a client's assets when his/her account state changes. If the maintenance margin is equal to 0, the initial margin is used.
SYMBOL_MARGIN_LONG = 44, // Not supported
SYMBOL_MARGIN_SHORT = 45, // Not supported
SYMBOL_MARGIN_LIMIT = 46, // Not supported
SYMBOL_MARGIN_STOP = 47, // Not supported
SYMBOL_MARGIN_STOPLIMIT = 48, // Not supported
SYMBOL_SESSION_VOLUME = 57, // Not supported
SYMBOL_SESSION_TURNOVER = 58, // Not supported
SYMBOL_SESSION_INTEREST = 59, // Not supported
SYMBOL_SESSION_BUY_ORDERS_VOLUME = 61, // Not supported
SYMBOL_SESSION_SELL_ORDERS_VOLUME = 63, // Not supported
SYMBOL_SESSION_OPEN = 64, // Not supported
SYMBOL_SESSION_CLOSE = 65, // Not supported
SYMBOL_SESSION_AW = 66, // Not supported
SYMBOL_SESSION_PRICE_SETTLEMENT = 67, // Not supported
SYMBOL_SESSION_PRICE_LIMIT_MIN = 68, // Not supported
SYMBOL_SESSION_PRICE_LIMIT_MAX = 69, // Not supported
}
}
+1 -6
View File
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi
namespace MtApi
{
public enum MarketInfoModeType
{
+3
View File
@@ -60,6 +60,7 @@
<ItemGroup>
<Compile Include="ChartPeriod.cs" />
<Compile Include="EnumSeriesInfoInteger.cs" />
<Compile Include="EnumSymbolInfoDouble.cs" />
<Compile Include="EnumSymbolInfoInteger.cs" />
<Compile Include="ExtensionMethods.cs" />
<Compile Include="Monitors\AvailabilityOrdersEventArgs.cs" />
@@ -97,6 +98,7 @@
<Compile Include="Requests\SessionRequest.cs" />
<Compile Include="Requests\RequestBase.cs" />
<Compile Include="Requests\RequestType.cs" />
<Compile Include="Requests\SymbolInfoDoubleRequest.cs" />
<Compile Include="Responses\CopyRatesResponse.cs" />
<Compile Include="Responses\GetOrderResponse.cs" />
<Compile Include="Responses\GetOrdersResponse.cs" />
@@ -105,6 +107,7 @@
<Compile Include="Responses\SeriesInfoIntegerResponse.cs" />
<Compile Include="Responses\SessionResponse.cs" />
<Compile Include="Responses\ResponseBase.cs" />
<Compile Include="Responses\SymbolInfoDoubleResponse.cs" />
<Compile Include="SeriesIdentifier.cs" />
<Compile Include="TimeBarArgs.cs" />
<Compile Include="Monitors\TimeframeTradeMonitor.cs" />
+113 -65
View File
@@ -658,63 +658,6 @@ namespace MtApi
#endregion
#region Symbols
///<summary>
///Returns the number of available (selected in Market Watch or all) symbols.
///</summary>
///<param name="selected">Request mode. Can be true or false.</param>
///<returns>
///If the 'selected' parameter is true, the function returns the number of symbols selected in MarketWatch. If the value is false, it returns the total number of all symbols.
///</returns>
public int SymbolsTotal(bool selected)
{
var commandParameters = new ArrayList { selected };
return SendCommand<int>(MtCommandType.SymbolsTotal, commandParameters);
}
///<summary>
///Returns the name of a symbol.
///</summary>
///<param name="pos">Order number of a symbol.</param>
///<param name="selected">Request mode. If the value is true, the symbol is taken from the list of symbols selected in MarketWatch. If the value is false, the symbol is taken from the general list.</param>
///<returns>
///Value of string type with the symbol name.
///</returns>
public string SymbolName(int pos, bool selected)
{
var commandParameters = new ArrayList { pos, selected };
return SendCommand<string>(MtCommandType.SymbolName, commandParameters);
}
///<summary>
///Selects a symbol in the Market Watch window or removes a symbol from the window.
///</summary>
///<param name="name">Symbol name</param>
///<param name="select">Switch. If the value is false, a symbol should be removed from MarketWatch, otherwise a symbol should be selected in this window. A symbol can't be removed if the symbol chart is open, or there are open orders for this symbol.</param>
///<returns>
///In case of failure returns false.
///</returns>
public bool SymbolSelect(string name, bool select)
{
var commandParameters = new ArrayList { name, select };
return SendCommand<bool>(MtCommandType.SymbolSelect, commandParameters);
}
///<summary>
///Returns the corresponding property of a specified symbol.
///</summary>
///<param name="name">Symbol name</param>
///<param name="propId">Identifier of a symbol property. The value can be one of the values of the EnumSymbolInfoInteger enumeration</param>
///<returns>
///The value of long type.
///</returns>
public long SymbolInfoInteger(string name, EnumSymbolInfoInteger propId)
{
var commandParameters = new ArrayList { name, (int)propId };
return SendCommand<long>(MtCommandType.SymbolInfoInteger, commandParameters);
}
#endregion
#region Common Function
public void Alert(string msg)
@@ -734,12 +677,6 @@ namespace MtApi
return SendCommand<int>(MtCommandType.GetTickCount, null);
}
public double MarketInfo(string symbol, MarketInfoModeType type)
{
var commandParameters = new ArrayList { symbol, (int)type };
return SendCommand<double>(MtCommandType.MarketInfo, commandParameters);
}
public int MessageBox(string text, string caption, int flag)
{
var commandParameters = new ArrayList { text, caption, flag };
@@ -1487,16 +1424,127 @@ namespace MtApi
return SendCommand<string>(MtCommandType.TerminalInfoString, commandParameters);
}
#endregion
#region Market Info
///<summary>
///Returns various data about securities listed in the "Market Watch" window.
///</summary>
///<param name="symbol">Symbol name.</param>
///<param name="type">Request identifier that defines the type of information to be returned. Can be any of values of request identifiers.</param>
///<returns>
///Returns various data about securities listed in the "Market Watch" window.
///</returns>
public double MarketInfo(string symbol, MarketInfoModeType type)
{
var commandParameters = new ArrayList { symbol, (int)type };
return SendCommand<double>(MtCommandType.MarketInfo, commandParameters);
}
///<summary>
///Returns the number of available (selected in Market Watch or all) symbols.
///</summary>
///<param name="selected">Request mode. Can be true or false.</param>
///<returns>
///If the 'selected' parameter is true, the function returns the number of symbols selected in MarketWatch. If the value is false, it returns the total number of all symbols.
///</returns>
public int SymbolsTotal(bool selected)
{
var commandParameters = new ArrayList { selected };
return SendCommand<int>(MtCommandType.SymbolsTotal, commandParameters);
}
///<summary>
///Returns the name of a symbol.
///</summary>
///<param name="pos">Order number of a symbol.</param>
///<param name="selected">Request mode. If the value is true, the symbol is taken from the list of symbols selected in MarketWatch. If the value is false, the symbol is taken from the general list.</param>
///<returns>
///Value of string type with the symbol name.
///</returns>
public string SymbolName(int pos, bool selected)
{
var commandParameters = new ArrayList { pos, selected };
return SendCommand<string>(MtCommandType.SymbolName, commandParameters);
}
///<summary>
///Selects a symbol in the Market Watch window or removes a symbol from the window.
///</summary>
///<param name="name">Symbol name</param>
///<param name="select">Switch. If the value is false, a symbol should be removed from MarketWatch, otherwise a symbol should be selected in this window. A symbol can't be removed if the symbol chart is open, or there are open orders for this symbol.</param>
///<returns>
///In case of failure returns false.
///</returns>
public bool SymbolSelect(string name, bool select)
{
var commandParameters = new ArrayList { name, select };
return SendCommand<bool>(MtCommandType.SymbolSelect, commandParameters);
}
///<summary>
///Returns the corresponding property of a specified symbol.
///</summary>
///<param name="name">Symbol name</param>
///<param name="propId">Identifier of a symbol property. The value can be one of the values of the EnumSymbolInfoInteger enumeration</param>
///<returns>
///The value of long type.
///</returns>
public long SymbolInfoInteger(string name, EnumSymbolInfoInteger propId)
{
var commandParameters = new ArrayList { name, (int)propId };
return SendCommand<long>(MtCommandType.SymbolInfoInteger, commandParameters);
}
///<summary>
///Returns the corresponding property of a specified symbol.
///</summary>
///<param name="name">Symbol name</param>
///<param name="propId">Identifier of a symbol property. The value can be one of the values of the ENUM_SYMBOL_INFO_STRING enumeration.</param>
///<returns>
///The value of string type.
///</returns>
public string SymbolInfoString(string name, ENUM_SYMBOL_INFO_STRING propId)
{
var commandParameters = new ArrayList { name, (int)propId };
return SendCommand<string>(MtCommandType.SymbolInfoString, commandParameters); ;
return SendCommand<string>(MtCommandType.SymbolInfoString, commandParameters);
}
///<summary>
///Allows receiving time of beginning and end of the specified quoting/trading sessions for a specified symbol and day of week.
///
///</summary>
///<param name="symbol">Symbol name.</param>
///<param name="dayOfWeek">Day of the week.</param>
///<param name="index">Ordinal number of a session, whose beginning and end time we want to receive. Indexing of sessions starts with 0.</param>
///<param name="type">Session type: Quote, Trade</param>
///<returns>
///The value session.
///</returns>
public MtSession SymbolInfoSession(string symbol, DayOfWeek dayOfWeek, uint index, SessionType type)
{
var responce = SendRequest<SessionResponse>(new SessionRequest { Symbol = symbol, DayOfWeek = dayOfWeek, SessionIndex = (int)index, SessionType = type });
return responce != null ? responce.Session : null;
return responce?.Session;
}
///<summary>
///Returns the corresponding property of a specified symbol.
///</summary>
///<param name="symbolName">Symbol name.</param>
///<param name="propId">Identifier of a symbol property. The value can be one of the values of the ENUM_SYMBOL_INFO_DOUBLE enumeration.</param>
/// <returns>
/// The value of double type.
/// </returns>
public double SymbolInfoDouble(string symbolName, EnumSymbolInfoDouble propId)
{
var response = SendRequest<SymbolInfoDoubleResponse>(new SymbolInfoDoubleRequest
{
SymbolName = symbolName,
PropId = (int)propId
});
return response?.Value ?? 0;
}
#endregion
+23 -29
View File
@@ -1,29 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MtApi
{
public class MtSession
{
public string Symbol { get; set; }
public DayOfWeek DayOfWeek { get; set; }
public uint Index { get; set; }
public int MtFromTime { get; set; }
public DateTime From
{
get { return MtApiTimeConverter.ConvertFromMtTime(MtFromTime); }
}
public int MtToTime { get; set; }
public DateTime To
{
get { return MtApiTimeConverter.ConvertFromMtTime(MtToTime); }
}
public bool HasData { get; set; }
public SessionType Type { get; set; }
}
public enum SessionType { Quote, Trade }
}
using System;
namespace MtApi
{
public class MtSession
{
public string Symbol { get; set; }
public DayOfWeek DayOfWeek { get; set; }
public uint Index { get; set; }
public int MtFromTime { get; set; }
public DateTime From => MtApiTimeConverter.ConvertFromMtTime(MtFromTime);
public int MtToTime { get; set; }
public DateTime To => MtApiTimeConverter.ConvertFromMtTime(MtToTime);
public bool HasData { get; set; }
public SessionType Type { get; set; }
}
public enum SessionType
{
Quote,
Trade
}
}
+2 -1
View File
@@ -13,6 +13,7 @@
iCustom = 8,
CopyRates = 9,
Session = 10,
SeriesInfoInteger = 11
SeriesInfoInteger = 11,
SymbolInfoDouble = 12
}
}
+12
View File
@@ -0,0 +1,12 @@
using System;
namespace MtApi.Requests
{
internal class SymbolInfoDoubleRequest : RequestBase
{
public override RequestType RequestType => RequestType.SymbolInfoDouble;
public string SymbolName { get; set; }
public int PropId { get; set; }
}
}
+7
View File
@@ -0,0 +1,7 @@
namespace MtApi.Responses
{
internal class SymbolInfoDoubleResponse: ResponseBase
{
public double Value { get; set; }
}
}
+1 -6
View File
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi
namespace MtApi
{
public enum TradeOperation
{
+102 -75
View File
@@ -110,9 +110,12 @@
this.listBoxAccountInfo = new System.Windows.Forms.ListBox();
this.button4 = new System.Windows.Forms.Button();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.comboBox6 = new System.Windows.Forms.ComboBox();
this.label29 = new System.Windows.Forms.Label();
this.comboBox5 = new System.Windows.Forms.ComboBox();
this.button31 = new System.Windows.Forms.Button();
this.txtMarketInfoSymbol = new System.Windows.Forms.TextBox();
this.button5 = new System.Windows.Forms.Button();
this.listBoxMarketInfo = new System.Windows.Forms.ListBox();
this.tabPage5 = new System.Windows.Forms.TabPage();
this.dateTimePicker2 = new System.Windows.Forms.DateTimePicker();
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
@@ -154,8 +157,10 @@
this.button28 = new System.Windows.Forms.Button();
this.label28 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button31 = new System.Windows.Forms.Button();
this.comboBox5 = new System.Windows.Forms.ComboBox();
this.comboBox7 = new System.Windows.Forms.ComboBox();
this.button33 = new System.Windows.Forms.Button();
this.label30 = new System.Windows.Forms.Label();
this.comboBox8 = new System.Windows.Forms.ComboBox();
this.groupBox1.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.groupBox2.SuspendLayout();
@@ -1038,9 +1043,16 @@
//
// tabPage4
//
this.tabPage4.Controls.Add(this.comboBox8);
this.tabPage4.Controls.Add(this.label30);
this.tabPage4.Controls.Add(this.button33);
this.tabPage4.Controls.Add(this.comboBox7);
this.tabPage4.Controls.Add(this.comboBox6);
this.tabPage4.Controls.Add(this.label29);
this.tabPage4.Controls.Add(this.comboBox5);
this.tabPage4.Controls.Add(this.button31);
this.tabPage4.Controls.Add(this.txtMarketInfoSymbol);
this.tabPage4.Controls.Add(this.button5);
this.tabPage4.Controls.Add(this.listBoxMarketInfo);
this.tabPage4.Location = new System.Drawing.Point(4, 22);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Padding = new System.Windows.Forms.Padding(3);
@@ -1049,70 +1061,67 @@
this.tabPage4.Text = "MarketInfo";
this.tabPage4.UseVisualStyleBackColor = true;
//
// comboBox6
//
this.comboBox6.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox6.FormattingEnabled = true;
this.comboBox6.Location = new System.Drawing.Point(229, 10);
this.comboBox6.Name = "comboBox6";
this.comboBox6.Size = new System.Drawing.Size(121, 21);
this.comboBox6.TabIndex = 27;
//
// label29
//
this.label29.AutoSize = true;
this.label29.Location = new System.Drawing.Point(164, 13);
this.label29.Name = "label29";
this.label29.Size = new System.Drawing.Size(59, 13);
this.label29.TabIndex = 26;
this.label29.Text = "TimeFrame";
//
// comboBox5
//
this.comboBox5.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox5.FormattingEnabled = true;
this.comboBox5.Items.AddRange(new object[] {
"SERIES_BARS_COUNT",
"SERIES_FIRSTDATE",
"SERIES_LASTBAR_DATE",
"SERIES_SERVER_FIRSTDATE"});
this.comboBox5.Location = new System.Drawing.Point(13, 74);
this.comboBox5.Name = "comboBox5";
this.comboBox5.Size = new System.Drawing.Size(186, 21);
this.comboBox5.TabIndex = 25;
//
// button31
//
this.button31.Location = new System.Drawing.Point(208, 74);
this.button31.Name = "button31";
this.button31.Size = new System.Drawing.Size(111, 23);
this.button31.TabIndex = 24;
this.button31.Text = "SeriesInfoInteger";
this.button31.UseVisualStyleBackColor = true;
this.button31.Click += new System.EventHandler(this.button31_Click);
//
// txtMarketInfoSymbol
//
this.txtMarketInfoSymbol.Location = new System.Drawing.Point(208, 6);
this.txtMarketInfoSymbol.Location = new System.Drawing.Point(57, 10);
this.txtMarketInfoSymbol.Name = "txtMarketInfoSymbol";
this.txtMarketInfoSymbol.Size = new System.Drawing.Size(100, 20);
this.txtMarketInfoSymbol.TabIndex = 7;
//
// button5
//
this.button5.Location = new System.Drawing.Point(16, 328);
this.button5.Location = new System.Drawing.Point(208, 45);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(186, 23);
this.button5.Size = new System.Drawing.Size(111, 23);
this.button5.TabIndex = 6;
this.button5.Text = "Execute";
this.button5.Text = "MarketInfo";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// listBoxMarketInfo
//
this.listBoxMarketInfo.FormattingEnabled = true;
this.listBoxMarketInfo.Items.AddRange(new object[] {
"",
"MODE_LOW",
"MODE_HIGH",
"",
"",
"MODE_TIME",
"",
"",
"",
"MODE_BID",
"MODE_ASK",
"MODE_POINT",
"MODE_DIGITS",
"MODE_SPREAD",
"MODE_STOPLEVEL",
"MODE_LOTSIZE",
"MODE_TICKVALUE",
"MODE_TICKSIZE",
"MODE_SWAPLONG",
"MODE_SWAPSHORT",
"MODE_STARTING",
"MODE_EXPIRATION",
"MODE_TRADEALLOWED",
"MODE_MINLOT",
"MODE_LOTSTEP",
"MODE_MAXLOT",
"MODE_SWAPTYPE",
"MODE_PROFITCALCMODE",
"MODE_MARGINCALCMODE",
"MODE_MARGININIT",
"MODE_MARGINMAINTENANCE",
"MODE_MARGINHEDGED",
"MODE_MARGINREQUIRED",
"MODE_FREEZELEVEL"});
this.listBoxMarketInfo.Location = new System.Drawing.Point(16, 6);
this.listBoxMarketInfo.Name = "listBoxMarketInfo";
this.listBoxMarketInfo.Size = new System.Drawing.Size(186, 316);
this.listBoxMarketInfo.TabIndex = 5;
//
// tabPage5
//
this.tabPage5.Controls.Add(this.comboBox5);
this.tabPage5.Controls.Add(this.button31);
this.tabPage5.Controls.Add(this.dateTimePicker2);
this.tabPage5.Controls.Add(this.dateTimePicker1);
this.tabPage5.Controls.Add(this.label6);
@@ -1550,29 +1559,42 @@
this.textBox1.TabIndex = 0;
this.textBox1.Text = "EURUSD";
//
// button31
// comboBox7
//
this.button31.Location = new System.Drawing.Point(287, 298);
this.button31.Name = "button31";
this.button31.Size = new System.Drawing.Size(128, 23);
this.button31.TabIndex = 22;
this.button31.Text = "SeriesInfoInteger";
this.button31.UseVisualStyleBackColor = true;
this.button31.Click += new System.EventHandler(this.button31_Click);
this.comboBox7.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox7.FormattingEnabled = true;
this.comboBox7.Location = new System.Drawing.Point(13, 101);
this.comboBox7.Name = "comboBox7";
this.comboBox7.Size = new System.Drawing.Size(186, 21);
this.comboBox7.TabIndex = 28;
//
// comboBox5
// button33
//
this.comboBox5.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox5.FormattingEnabled = true;
this.comboBox5.Items.AddRange(new object[] {
"SERIES_BARS_COUNT",
"SERIES_FIRSTDATE",
"SERIES_LASTBAR_DATE",
"SERIES_SERVER_FIRSTDATE"});
this.comboBox5.Location = new System.Drawing.Point(160, 298);
this.comboBox5.Name = "comboBox5";
this.comboBox5.Size = new System.Drawing.Size(121, 21);
this.comboBox5.TabIndex = 23;
this.button33.Location = new System.Drawing.Point(208, 99);
this.button33.Name = "button33";
this.button33.Size = new System.Drawing.Size(111, 23);
this.button33.TabIndex = 29;
this.button33.Text = "SymbolInfoDouble";
this.button33.UseVisualStyleBackColor = true;
this.button33.Click += new System.EventHandler(this.button33_Click);
//
// label30
//
this.label30.AutoSize = true;
this.label30.Location = new System.Drawing.Point(10, 13);
this.label30.Name = "label30";
this.label30.Size = new System.Drawing.Size(41, 13);
this.label30.TabIndex = 30;
this.label30.Text = "Symbol";
//
// comboBox8
//
this.comboBox8.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox8.FormattingEnabled = true;
this.comboBox8.Location = new System.Drawing.Point(13, 47);
this.comboBox8.Name = "comboBox8";
this.comboBox8.Size = new System.Drawing.Size(186, 21);
this.comboBox8.TabIndex = 31;
//
// Form1
//
@@ -1687,7 +1709,6 @@
private System.Windows.Forms.Label label24;
private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.ListBox listBoxMarketInfo;
private System.Windows.Forms.TextBox txtMarketInfoSymbol;
private System.Windows.Forms.TabPage tabPage5;
private System.Windows.Forms.Button button6;
@@ -1746,8 +1767,14 @@
private System.Windows.Forms.Button button30;
private System.Windows.Forms.Button button32;
private System.Windows.Forms.ComboBox comboBox4;
private System.Windows.Forms.Button button31;
private System.Windows.Forms.ComboBox comboBox5;
private System.Windows.Forms.Button button31;
private System.Windows.Forms.ComboBox comboBox6;
private System.Windows.Forms.Label label29;
private System.Windows.Forms.ComboBox comboBox7;
private System.Windows.Forms.Button button33;
private System.Windows.Forms.Label label30;
private System.Windows.Forms.ComboBox comboBox8;
}
}
+22 -6
View File
@@ -28,6 +28,9 @@ namespace TestApiClientUI
InitializeComponent();
comboBox3.DataSource = Enum.GetNames(typeof(ENUM_TIMEFRAMES));
comboBox6.DataSource = Enum.GetNames(typeof(ENUM_TIMEFRAMES));
comboBox7.DataSource = Enum.GetNames(typeof(EnumSymbolInfoDouble));
comboBox8.DataSource = Enum.GetNames(typeof(MarketInfoModeType));
_apiClient.QuoteUpdated += apiClient_QuoteUpdated;
_apiClient.QuoteAdded += apiClient_QuoteAdded;
@@ -721,12 +724,14 @@ namespace TestApiClientUI
}
}
private void button5_Click(object sender, EventArgs e)
//MarketInfo
private async void button5_Click(object sender, EventArgs e)
{
if (listBoxMarketInfo.SelectedIndex < 0)
return;
var symbol = txtMarketInfoSymbol.Text;
MarketInfoModeType propId;
Enum.TryParse(comboBox8.Text, out propId);
var result = _apiClient.MarketInfo(txtMarketInfoSymbol.Text, (MarketInfoModeType)listBoxMarketInfo.SelectedIndex);
var result = await Execute(() => _apiClient.MarketInfo(symbol, propId));
AddToLog($"MarketInfo result: {result}");
}
@@ -1227,14 +1232,25 @@ namespace TestApiClientUI
//SeriesInfoInteger
private async void button31_Click(object sender, EventArgs e)
{
var symbol = textBoxSelectedSymbol.Text;
var symbol = txtMarketInfoSymbol.Text;
ENUM_TIMEFRAMES timeframes;
Enum.TryParse(comboBox3.Text, out timeframes);
Enum.TryParse(comboBox6.Text, out timeframes);
EnumSeriesInfoInteger propId;
Enum.TryParse(comboBox5.Text, out propId);
var result = await Execute(() => _apiClient.SeriesInfoInteger(symbol, timeframes, propId));
AddToLog($"SeriesInfoInteger: result = {result}");
}
//SymbolInfoDouble
private async void button33_Click(object sender, EventArgs e)
{
var symbol = txtMarketInfoSymbol.Text;
EnumSymbolInfoDouble propId;
Enum.TryParse(comboBox7.Text, out propId);
var result = await Execute(() => _apiClient.SymbolInfoDouble(symbol, propId));
AddToLog($"SymbolInfoDouble: result = {result}");
}
}
}
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.