Issue #136: Updated structures MqlTick, MqlBook with new field volume_real. Remove redundant code from MtApiService.

This commit is contained in:
vdemydiuk
2019-03-18 17:31:54 +02:00
parent d1387148df
commit 44fab4dae1
15 changed files with 81 additions and 228 deletions
+1
View File
@@ -16,6 +16,7 @@ namespace MtApi5
public ENUM_BOOK_TYPE type { get; set; } // Order type from ENUM_BOOK_TYPE enumeration
public double price { get; set; } // Price
public long volume { get; set; } // Volume
public double volume_real { get; set; } // Volume for the current Last price with greater accuracy
public override string ToString()
{
+2 -1
View File
@@ -23,7 +23,8 @@ namespace MtApi5
public double bid { get; set; } // Current Bid price
public double ask { get; set; } // Current Ask price
public double last { get; set; } // Price of the last deal (Last)
public ulong volume { get; set; } // Volume for the current Last price
public ulong volume { get; set; } // Volume for the current Last price
public double volume_real { get; set; } // Volume for the current Last price with greater accuracy
public DateTime time => Mt5TimeConverter.ConvertFromMtTime(MtTime);
}
+1
View File
@@ -98,6 +98,7 @@
<Compile Include="Requests\Response.cs" />
<Compile Include="Requests\SymbolInfoStringRequest.cs" />
<Compile Include="Requests\SymbolInfoStringResult.cs" />
<Compile Include="Requests\SymbolInfoTickRequest.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MTApiService\MTApiService.csproj">
+16 -8
View File
@@ -1476,19 +1476,27 @@ namespace MtApi5
///<param name="tick"> Link to the structure of the MqlTick type, to which the current prices and time of the last price update will be placed.</param>
public bool SymbolInfoTick(string symbol, out MqlTick tick)
{
var commandParameters = new ArrayList { symbol };
var retVal = SendCommand<MtMqlTick>(Mt5CommandType.SymbolInfoTick, commandParameters);
tick = null;
if (retVal != null)
tick = SendRequest<MqlTick>(new SymbolInfoTickRequest
{
tick = new MqlTick { MtTime = retVal.time, ask = retVal.ask, bid = retVal.bid, last = retVal.last, volume = retVal.volume };
}
SymbolName = symbol
});
return tick != null;
}
///<summary>
///The function returns current prices of a specified symbol in a variable of the MqlTick type.
///</summary>
///<param name="symbol">Symbol name.</param>
public MqlTick SymbolInfoTick(string symbol)
{
var tick = SendRequest<MqlTick>(new SymbolInfoTickRequest
{
SymbolName = symbol
});
return tick;
}
///<summary>
///Allows receiving time of beginning and end of the specified quoting sessions for a specified symbol and weekday.
+2 -1
View File
@@ -15,6 +15,7 @@ namespace MtApi5.Requests
SymbolInfoString = 8,
ChartTimePriceToXY = 9,
ChartXYToTimePrice = 10,
PositionClose = 11
PositionClose = 11,
SymbolInfoTick = 12
}
}
+14
View File
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi5.Requests
{
internal class SymbolInfoTickRequest : RequestBase
{
public override RequestType RequestType => RequestType.SymbolInfoTick;
public string SymbolName { get; set; }
}
}