Skip to content

Commit

Permalink
Last Update Members FTS
Browse files Browse the repository at this point in the history
  • Loading branch information
Влад Алексеев committed Sep 24, 2024
1 parent 393fde4 commit 62b5077
Show file tree
Hide file tree
Showing 27 changed files with 333 additions and 351 deletions.
2 changes: 0 additions & 2 deletions Messages/FIX44/OrderCancelReject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ public OrderCancelReject() : base()
public OrderCancelReject(
QuickFix.Fields.OrderID aOrderID,
QuickFix.Fields.ClOrdID aClOrdID,
QuickFix.Fields.OrigClOrdID aOrigClOrdID,
QuickFix.Fields.OrdStatus aOrdStatus,
QuickFix.Fields.CxlRejResponseTo aCxlRejResponseTo
) : this()
{
this.OrderID = aOrderID;
this.ClOrdID = aClOrdID;
this.OrigClOrdID = aOrigClOrdID;
this.OrdStatus = aOrdStatus;
this.CxlRejResponseTo = aCxlRejResponseTo;
}
Expand Down
11 changes: 6 additions & 5 deletions Messages/FIX44/QuickFix.FIX44.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<LangVersion>Preview</LangVersion>
<GenerateAppxPackageOnBuild>true</GenerateAppxPackageOnBuild>
<Title>QuickFIX/n FIX4.4 Messages</Title>
<PackageId>QuickFIXn.FIX4.4</PackageId>
Expand All @@ -19,6 +20,10 @@
<PackageTags>QuickFIX QuickFIX/n FIX</PackageTags>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>C:\SCRIPT_DONOT_DELETE_THIS\FTSEngine\FTSEngine.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<DebugType>portable</DebugType>
</PropertyGroup>

<ItemGroup>
Expand All @@ -32,8 +37,4 @@
</None>
</ItemGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)$(SolutionName).Connect.Fix\Dependencies\$(TargetFileName)&quot;" />
</Target>

</Project>
18 changes: 11 additions & 7 deletions QuickFIXn/AbstractInitiator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ public AbstractInitiator(
HashSet<SessionID> definedSessions = _settings.GetSessions();
if (0 == definedSessions.Count)
throw new ConfigError("No sessions defined");

// create all sessions
sessionFactory_ = new SessionFactory(_app, _storeFactory, _logFactory, _msgFactory);
foreach (SessionID sessionID in definedSessions) {
Dictionary dict = _settings.Get(sessionID);
CreateSession(sessionID, dict);
}
}

public void Start()
Expand All @@ -60,12 +67,13 @@ public void Start()
throw new System.ObjectDisposedException(this.GetType().Name);

// create all sessions
/*
sessionFactory_ = new SessionFactory(_app, _storeFactory, _logFactory, _msgFactory);
foreach (SessionID sessionID in _settings.GetSessions())
{
foreach (SessionID sessionID in definedSessions) {
Dictionary dict = _settings.Get(sessionID);
CreateSession(sessionID, dict);
}
*/

if (0 == sessions_.Count)
throw new ConfigError("No sessions defined for initiator");
Expand Down Expand Up @@ -105,7 +113,7 @@ public bool AddSession(SessionID sessionID, Dictionary dict)
/// <param name="sessionID">ID of new session</param>
/// <param name="dict">config settings for new session</param>
/// <returns>true if session added successfully, false if session already exists or is not an initiator</returns>
private bool CreateSession(SessionID sessionID, Dictionary dict)
protected bool CreateSession(SessionID sessionID, Dictionary dict)
{
if (dict.GetString(SessionSettings.CONNECTION_TYPE) == "initiator" && !sessionIDs_.Contains(sessionID))
{
Expand Down Expand Up @@ -260,10 +268,6 @@ protected virtual void OnConfigure(SessionSettings settings)
protected virtual void OnRemove(SessionID sessionID)
{ }

[System.Obsolete("This method's intended purpose is unclear. Don't use it.")]
protected virtual void OnInitialize(SessionSettings settings)
{ }

#endregion

#region Abstract Methods
Expand Down
16 changes: 4 additions & 12 deletions QuickFIXn/ClientHandlerThread.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,6 @@ public ExitedEventArgs(ClientHandlerThread clientHandlerThread)
private SocketReader socketReader_;
private FileLog log_;

[Obsolete("Don't use this constructor")]
public ClientHandlerThread(TcpClient tcpClient, long clientId)
: this(tcpClient, clientId, new QuickFix.Dictionary())
{ }


[Obsolete("Don't use this constructor")]
public ClientHandlerThread(TcpClient tcpClient, long clientId, QuickFix.Dictionary settingsDict)
: this(tcpClient, clientId, settingsDict, new SocketSettings())
{
}

/// <summary>
/// Creates a ClientHandlerThread
/// </summary>
Expand Down Expand Up @@ -143,6 +131,10 @@ public bool Send(string data)
return socketReader_.Send(data) > 0;
}

public bool Send(ReadOnlySpan<byte> rawData) {
return socketReader_.Send(rawData) > 0;
}

public void Disconnect()
{
Shutdown("Disconnected");
Expand Down
9 changes: 9 additions & 0 deletions QuickFIXn/CompositeLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ public void OnEvent(string s)
log.OnEvent(s);
}

#region ILog Members FTS

public void FTSLogTraceAppend(string s) { }
public void FTSLogTraceAppendElapsedTicks() { }

public void FTSLogTraceAppendElapsedTicksTotal() { }

#endregion

public void Dispose()
{
Dispose(true);
Expand Down
57 changes: 4 additions & 53 deletions QuickFIXn/DataDictionary/DDField.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QuickFix.DataDictionary
{
Expand All @@ -23,26 +21,6 @@ public DDField(int tag, String name, Dictionary<String, String> enums, String fi
this.FieldType = FieldTypeFromFix(this.FixFldType, out this._isMultipleValueFieldWithEnums);
}

/// <summary>
/// Converter used only by the obsolete constructor and Enums attribute.
/// </summary>
private static Dictionary<string,string> HashSetToDict(HashSet<String> enums)
{
Dictionary<String, String> dict = new Dictionary<string, string>();
foreach (String s in enums)
dict[s] = "";
return dict;
}

/// <summary>
/// Old version of constructor. Discarded in favor of version that takes Dictionary instead of HashSet
/// (so that enum desc strings can be preserved).
/// </summary>
[Obsolete("Use DDField(int,String,Dictionary<String,String>,string) instead")]
public DDField(int tag, String name, HashSet<String> enums, String fixFldType)
: this(tag, name, HashSetToDict(enums), fixFldType)
{ }

//TODO in version 2.0 - these probably shouldn't be public writable
public int Tag;
public String Name;
Expand All @@ -56,42 +34,11 @@ public DDField(int tag, String name, HashSet<String> enums, String fixFldType)
public bool IsMultipleValueFieldWithEnums { get { return _isMultipleValueFieldWithEnums; } }
private bool _isMultipleValueFieldWithEnums;

/// <summary>
/// Replaced by EnumDict, which preserves the enum's description.
/// This attribute is a wrapper around EnumDict for backward-compatibility only.
/// The getter constructs a new HashSet, so is probably inefficient.
/// The setter sets EnumDict where all values are empty string.
/// </summary>
[Obsolete("Use EnumDict instead. See this property's doc comments.")]
public HashSet<String> Enums
{
get { return new HashSet<String>(EnumDict.Keys); }
set { EnumDict = HashSetToDict(value); }
}

/// <summary>
/// This field deprecated because it makes no sense; being required is not a quality of the field,
/// but a quality of the message that contains the field.
/// </summary>
[Obsolete("Always false. Use the containing message's DDMap.ReqFields instead.")]
public Boolean Required
{
get { return false; }
set { }
}

public Boolean HasEnums()
{
return EnumDict.Count > 0;
}

[Obsolete("Will be removed from the public interface in a future major release.")]
public Type FieldTypeFromFix(String type)
{
bool discardedVar = false;
return FieldTypeFromFix(type, out discardedVar);
}

private Type FieldTypeFromFix(String type, out bool multipleValueFieldWithEnums )
{
multipleValueFieldWithEnums = false;
Expand All @@ -112,6 +59,7 @@ private Type FieldTypeFromFix(String type, out bool multipleValueFieldWithEnums
case "UTCTIMESTAMP": return typeof(Fields.DateTimeField);
case "BOOLEAN": return typeof(Fields.BooleanField);
case "LOCALMKTDATE": return typeof(Fields.StringField);
case "LOCALMKTTIME": return typeof(Fields.StringField);
case "DATA": return typeof(Fields.StringField);
case "FLOAT": return typeof(Fields.DecimalField);
case "PRICEOFFSET": return typeof(Fields.DecimalField);
Expand All @@ -123,12 +71,15 @@ private Type FieldTypeFromFix(String type, out bool multipleValueFieldWithEnums
case "NUMINGROUP": return typeof(Fields.IntField);
case "PERCENTAGE": return typeof(Fields.DecimalField);
case "SEQNUM": return typeof(Fields.IntField);
case "TAGNUM": return typeof(Fields.IntField);
case "LENGTH": return typeof(Fields.IntField);
case "COUNTRY": return typeof(Fields.StringField);
case "TZTIMEONLY": return typeof(Fields.StringField);
case "TZTIMESTAMP": return typeof(Fields.StringField);
case "XMLDATA": return typeof(Fields.StringField);
case "LANGUAGE": return typeof(Fields.StringField);
case "XID": return typeof(Fields.StringField);
case "XIDREF": return typeof(Fields.StringField);

case "TIME": return typeof(Fields.DateTimeField);
case "DATE": return typeof(Fields.StringField);
Expand Down
18 changes: 14 additions & 4 deletions QuickFIXn/DataDictionary/DataDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class DataDictionary
public Dictionary<String, DDField> FieldsByName = new Dictionary<string, DDField>();
public Dictionary<String, DDMap> Messages = new Dictionary<string, DDMap>();
private XmlDocument RootDoc;
private Dictionary<String, XmlNode> ComponentsByName = new Dictionary<string, XmlNode>();

public bool CheckFieldsOutOfOrder { get; set; }
public bool CheckFieldsHaveValues { get; set; }
Expand Down Expand Up @@ -67,11 +68,11 @@ public DataDictionary(DataDictionary src)
this.FieldsByName = src.FieldsByName;
this.FieldsByTag = src.FieldsByTag;
if (null != src.MajorVersion)
this.MajorVersion = string.Copy(src.MajorVersion);
this.MajorVersion = src.MajorVersion;
if (null != src.MinorVersion)
this.MinorVersion = string.Copy(src.MinorVersion);
this.MinorVersion = src.MinorVersion;
if (null != src.Version)
this.Version = string.Copy(src.Version);
this.Version = src.Version;
this.CheckFieldsHaveValues = src.CheckFieldsHaveValues;
this.CheckFieldsOutOfOrder = src.CheckFieldsOutOfOrder;
this.CheckUserDefinedFields = src.CheckUserDefinedFields;
Expand Down Expand Up @@ -448,6 +449,7 @@ public bool IsTrailerField(int tag)

public void Load(String path)
{
path = Path.GetFullPath(Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), path));
var stream = new FileStream(path, FileMode.Open, FileAccess.Read);
Load(stream);
}
Expand All @@ -463,6 +465,7 @@ public void Load(Stream stream)
RootDoc.Load(reader);
SetVersionInfo(RootDoc);
ParseFields(RootDoc);
CacheComponents(RootDoc);
ParseMessages(RootDoc);
ParseHeader(RootDoc);
ParseTrailer(RootDoc);
Expand Down Expand Up @@ -502,6 +505,13 @@ private void ParseFields(XmlDocument doc)
}
}

private void CacheComponents(XmlDocument doc) {
XmlNodeList nodeList = doc.SelectNodes("//components/component");
foreach (XmlNode compEl in nodeList) {
ComponentsByName[compEl.Attributes["name"].Value] = compEl;
}
}

private DDField NewField(XmlNode fldEl)
{
String tagstr = fldEl.Attributes["number"].Value;
Expand Down Expand Up @@ -645,7 +655,7 @@ private void ParseMsgEl(XmlNode node, DDMap ddmap, bool? componentRequired)
break;

case "component":
XmlNode compNode = RootDoc.SelectSingleNode("//components/component[@name='" + nameAttribute + "']");
XmlNode compNode = ComponentsByName[nameAttribute];
ParseMsgEl(compNode, ddmap, (childNode.Attributes["required"]?.Value == "Y"));
break;

Expand Down
3 changes: 2 additions & 1 deletion QuickFIXn/Fields/FieldBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public override int Tag
/// </summary>
public override string toStringField()
{
if (_changed.Equals(true))
if (_changed)
makeStringFields();
return _stringField;
}
Expand Down Expand Up @@ -123,6 +123,7 @@ private void makeStringFields()

#region Private members
private string _stringField;
//private string _stringField { get => Tag + "=" + _stringVal; }
private bool _changed;
private T _obj;
private int _tag;
Expand Down
Loading

0 comments on commit 62b5077

Please sign in to comment.