Issue #31: Implemented function SymbolInfoTick in MtApi MT4

This commit is contained in:
vdemydiuk
2016-11-14 16:31:01 +02:00
parent 32f6018858
commit 563a5a895b
12 changed files with 168 additions and 102 deletions
+1 -6
View File
@@ -5,12 +5,7 @@ namespace MtApi
public class MqlRates
{
public int MtTime { get; set; }
public DateTime Time
{
get { return MtApiTimeConverter.ConvertFromMtTime(MtTime); }
}
public DateTime Time => MtApiTimeConverter.ConvertFromMtTime(MtTime);
public double Open { get; set; }
public double High { get; set; }
public double Low { get; set; }
+14
View File
@@ -0,0 +1,14 @@
using System;
namespace MtApi
{
public class MqlTick
{
public int MtTime { get; set; }
public DateTime Time => MtApiTimeConverter.ConvertFromMtTime(MtTime);
public double Bid { get; set; }
public double Ask { get; set; }
public double Last { get; set; }
public ulong Volume { get; set; }
}
}
+3
View File
@@ -65,6 +65,7 @@
<Compile Include="ExtensionMethods.cs" />
<Compile Include="Monitors\AvailabilityOrdersEventArgs.cs" />
<Compile Include="MqlRates.cs" />
<Compile Include="MqlTick.cs" />
<Compile Include="MtConnectionEventArgs.cs" />
<Compile Include="MtConnectionException.cs" />
<Compile Include="MtConnectionState.cs" />
@@ -99,6 +100,7 @@
<Compile Include="Requests\RequestBase.cs" />
<Compile Include="Requests\RequestType.cs" />
<Compile Include="Requests\SymbolInfoDoubleRequest.cs" />
<Compile Include="Requests\SymbolInfoTickRequest.cs" />
<Compile Include="Responses\CopyRatesResponse.cs" />
<Compile Include="Responses\GetOrderResponse.cs" />
<Compile Include="Responses\GetOrdersResponse.cs" />
@@ -108,6 +110,7 @@
<Compile Include="Responses\SessionResponse.cs" />
<Compile Include="Responses\ResponseBase.cs" />
<Compile Include="Responses\SymbolInfoDoubleResponse.cs" />
<Compile Include="Responses\SymbolInfoTickResponse.cs" />
<Compile Include="SeriesIdentifier.cs" />
<Compile Include="TimeBarArgs.cs" />
<Compile Include="Monitors\TimeframeTradeMonitor.cs" />
+17
View File
@@ -1546,6 +1546,23 @@ namespace MtApi
return response?.Value ?? 0;
}
///<summary>
///Returns the corresponding property of a specified symbol.
///</summary>
///<param name="symbol">Symbol name.</param>
/// <returns>
/// MqlTick object, to which the current prices and time of the last price update will be placed.
/// </returns>
public MqlTick SymbolInfoTick(string symbol)
{
var response = SendRequest<SymbolInfoTickResponse>(new SymbolInfoTickRequest
{
Symbol = symbol
});
return response?.Tick;
}
#endregion
#region Private Methods
+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 class MtQuote
{
+2 -1
View File
@@ -14,6 +14,7 @@
CopyRates = 9,
Session = 10,
SeriesInfoInteger = 11,
SymbolInfoDouble = 12
SymbolInfoDouble = 12,
SymbolInfoTick = 13
}
}
+9
View File
@@ -0,0 +1,9 @@
namespace MtApi.Requests
{
internal class SymbolInfoTickRequest: RequestBase
{
public override RequestType RequestType => RequestType.SymbolInfoTick;
public string Symbol { get; set; }
}
}
+7
View File
@@ -0,0 +1,7 @@
namespace MtApi.Responses
{
internal class SymbolInfoTickResponse: ResponseBase
{
public MqlTick Tick { get; set; }
}
}