mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-19 21:58:10 +00:00
MtApi5: small update in requesting quote
This commit is contained in:
+1
-4
@@ -1,7 +1,4 @@
|
|||||||
// ReSharper disable InconsistentNaming
|
namespace MtApi5
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace MtApi5
|
|
||||||
{
|
{
|
||||||
public class MqlTick
|
public class MqlTick
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-20
@@ -1,6 +1,4 @@
|
|||||||
using System;
|
namespace MtApi5
|
||||||
|
|
||||||
namespace MtApi5
|
|
||||||
{
|
{
|
||||||
public class Mt5Quote
|
public class Mt5Quote
|
||||||
{
|
{
|
||||||
@@ -13,22 +11,5 @@ namespace MtApi5
|
|||||||
public ulong Volume { get; set; }
|
public ulong Volume { get; set; }
|
||||||
// public long TimeMsc { get; set; }
|
// public long TimeMsc { get; set; }
|
||||||
// public uint Flags { get; set; }
|
// public uint Flags { get; set; }
|
||||||
|
|
||||||
internal Mt5Quote()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Mt5Quote(string instrument, double bid, double ask)
|
|
||||||
{
|
|
||||||
Instrument = instrument;
|
|
||||||
Bid = bid;
|
|
||||||
Ask = ask;
|
|
||||||
}
|
|
||||||
|
|
||||||
//internal Mt5Quote(MtQuote quote)
|
|
||||||
// :this(quote.Instrument, quote.Bid, quote.Ask)
|
|
||||||
//{
|
|
||||||
// ExpertHandle = quote.ExpertHandle;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+21
-4
@@ -4,6 +4,7 @@ using Newtonsoft.Json;
|
|||||||
using MtApi5.Events;
|
using MtApi5.Events;
|
||||||
using MtClient;
|
using MtClient;
|
||||||
using System.Reflection.Metadata;
|
using System.Reflection.Metadata;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace MtApi5
|
namespace MtApi5
|
||||||
{
|
{
|
||||||
@@ -3478,9 +3479,22 @@ namespace MtApi5
|
|||||||
private Mt5Quote? GetQuote(int expertHandle)
|
private Mt5Quote? GetQuote(int expertHandle)
|
||||||
{
|
{
|
||||||
Log?.Debug($"GetQuote: expertHandle = {expertHandle}");
|
Log?.Debug($"GetQuote: expertHandle = {expertHandle}");
|
||||||
var quote = SendCommand<Mt5Quote>(expertHandle, Mt5CommandType.GetQuote);
|
|
||||||
if (quote != null)
|
var e = SendCommand<OnTickEvent>(expertHandle, Mt5CommandType.GetQuote);
|
||||||
quote.ExpertHandle = expertHandle;
|
if (e == null || string.IsNullOrEmpty(e.Instrument) || e.Tick == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
Mt5Quote quote = new()
|
||||||
|
{
|
||||||
|
Instrument = e.Instrument,
|
||||||
|
Bid = e.Tick.bid,
|
||||||
|
Ask = e.Tick.ask,
|
||||||
|
ExpertHandle = expertHandle,
|
||||||
|
Volume = e.Tick.volume,
|
||||||
|
Time = e.Tick.time,
|
||||||
|
Last = e.Tick.last
|
||||||
|
};
|
||||||
|
|
||||||
return quote;
|
return quote;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3530,8 +3544,11 @@ namespace MtApi5
|
|||||||
|
|
||||||
QuoteUpdated?.Invoke(this, e.Instrument, e.Tick.bid, e.Tick.ask);
|
QuoteUpdated?.Invoke(this, e.Instrument, e.Tick.bid, e.Tick.ask);
|
||||||
|
|
||||||
var quote = new Mt5Quote(e.Instrument, e.Tick.bid, e.Tick.ask)
|
Mt5Quote quote = new()
|
||||||
{
|
{
|
||||||
|
Instrument = e.Instrument,
|
||||||
|
Bid = e.Tick.bid,
|
||||||
|
Ask = e.Tick.ask,
|
||||||
ExpertHandle = expertHandler,
|
ExpertHandle = expertHandler,
|
||||||
Volume = e.Tick.volume,
|
Volume = e.Tick.volume,
|
||||||
Time = e.Tick.time,
|
Time = e.Tick.time,
|
||||||
|
|||||||
Reference in New Issue
Block a user