DP: Strategy
D:\VC\DsnPtrn\Cpp\PatternDesign\CaTeleStra01\CaTeleStra01.vcxproj
YAGNI (You Ain't Gonna Need It)
D:\VC\DsnPtrn\Cpp\PatternDesign\CaTelePoint01\CaTelePoint01.vcxproj
DP: Strategy
D:\VC\DsnPtrn\Cpp\PatternDesign\CaTeleStra01\CaTeleStra01.vcxproj
YAGNI (You Ain't Gonna Need It)
D:\VC\DsnPtrn\Cpp\PatternDesign\CaTelePoint01\CaTelePoint01.vcxproj
VS2019, VS2022 Work properly
D:\VC\2022\GS.Trade\GS.Quartz\CaSln01.sln
D:\VC\2022\GS.Trade\GS.Quartz\CaTensFlow01\CaTensFlow01.csproj
NetCore 3.1
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
D:\VC\Cpp\Boost01\Boost02\CaSerial01\CaSerial01.vcxproj
std::ofstream ofs(file_path, std::ios::binary);
boost::archive::binary_oarchive oa(ofs);
oa << a;
ofs.close();
std::ifstream ifs(file_path, std::ios::binary);
boost::archive::binary_iarchive ia(ifs);
ia >> b;
ifs.close();
D:\VC\1305\Other\OthersSln\OthersSln.sln
D:\VC\1305\Other\OthersSln\CaHashStruct01\
D:\VC\1305\Other\OthersSln\CaHashStruct01\
D:\VC\Cpp\Boost01\Boost01\Boost01.sln
VS2019
D:\DownLoads\Books\Cpp\Boost\The Boost C++ Libraries.pdf
Github
Vector ToString with Delimiters
D:\VC\Cpp\CppSln\Boost01\Boost79\Boost79\CaBoostTele01
https://www.techiedelight.com/ru/convert-a-vector-to-a-string-in-cpp/
D:\VC\OsEng231025\OsEngine
D:\VC\OsEngine\OsEngine
D:\VC\Alor\BondSharp
D:\VC\OsEng231025\OsEngineSln
static void Test3() from Reffs 2
{
var cts = new CancellationTokenSource();
var processingTask = Task.Factory.StartNew(() => GetStreamFromYoutubeDl(),cts.Token);
var readingFromConsoleTask = Task.Factory.StartNew(() =>
{
Console.WriteLine("Press 'q' to exit.");
while (true)
{
var read = Console.ReadKey(true);
if (read.Key == ConsoleKey.Q)
{
cts.Cancel();
return;
}
}
});
Task.WaitAny(processingTask, readingFromConsoleTask);
}
Network: TCP, UDP, WebSockets, SignalR, Http2
1. DDE, Server
2. SimulateTerminal, Server
3. Connectors, Server
4. Eventog, Server
5. TradeStorage, Server
6. Charts, Client
7. Strategies, Client
8. OptionDesk, Client
9. Portfolio, Client
10. Time Service, Server (Quarth)
11. Tickers Service, Server
12. DNS Service, Server
13. MarketData Service, Server
Serialization string in Anywhere
var x = xDoc.Descendants(root).FirstOrDefault();
TradeContext51
Init()
Dde
Dde = ConfigurationResourse1.Build<IDde, string, ITopicItem>("Dde", "Dde");
Dde.Parent = this;
Dde.Init();
http://localhost/GS.Trade.Web.Mvc.Cfg_01/CfgTrans
Strategies in TradeContext51
Strategies = ConfigurationResourse1.Build<IStrategies>("Strats", "Strategies");
if (Strategies == null)
{
throw new NullReferenceException("Stategies Build Failure");
}
Strategies.Parent = this;
Strategies.TradeContext = this;
Strategies.Init(); ******
foreach (var s in Strategies.StrategyCollection)
{
try
{
TradeStorage.Register(s);
TradeStorage.Register(s.Position);
TradeStorage.RegisterTotal(s.PositionTotal);
}
catch (Exception e)
{
SendExceptionMessage3(FullName, "TradeContext", "Strategy.Register:" + s.StrategyTickerString,
"", e);
// throw;
}
}
Thread.Sleep(1000);
Strategies.StrategyTradeEntityChangedEvent += EventHub.FireEvent;
Strategies.ExceptionEvent += EventHub.FireEvent;
Init()
IsEvlEnabled = true;
try
{
base.Init(TradeContext.EventLog);
_evl = TradeContext.EventLog;
//_evl.AddItem(EvlResult.INFO, EvlSubject.TECHNOLOGY, "Strategies",
// "Strategies","Init Start", Name + " " + Code, "Count: " + _strategyDictionary.Count());
Evlm2(EvlResult.INFO, EvlSubject.TECHNOLOGY, "Strategies",
"Strategies", "Init Start", Name + " " + Code, "Count: " + _strategyDictionary.Count());
//TradeContext.Orders.StopOrderFilledEvent += StopOrderFilledEventHandler;
//TradeContext.Orders.LimitOrderFilledEvent += LimitOrderFilledEventHandler;
//DeSerializationCollection();
// DeSerializationCollection3();
DeSerializationCollection32();
//var badInit = new List<string>();
//foreach (var s in StrategyCollection)
//{
// ((Strategy)s).SetParent(this);
// ((Strategy)s).SetTradeContext(TradeContext);
// s.Parent = this;
// ((Strategy)s).Init();
// if (!s.IsWrong) continue;
// badInit.Add(s.Key);
// _evl.AddItem(EvlResult.FATAL, EvlSubject.TECHNOLOGY, s.Name, s.Name, "Initialization Failure", s.ToString(), "");
//}
//foreach (var k in badInit) _strategyDictionary.Remove(k);
//_evl.AddItem(EvlResult.INFO, EvlSubject.TECHNOLOGY, "Strategies",
// "Strategies", "Init Finish", Name + " " + Code, "Count: " + _strategyDictionary.Count());
}
catch (Exception e)
{
// throw new NullReferenceException("Strategies.Init Failure:" + e.Message);
SendException(e);
}
}
public static T BuildTypeWithCollectionInside<T, TKey, TItem>(XDocument xdoc, string root)
where T : class, IHaveCollection<TKey, TItem>, IHaveUri
where TItem : class, IHaveKey<TKey>
{
T t = null;
try
{
t = DeSerialization2<T>(xdoc, root);
if (t == null)
throw new NullReferenceException("Deserialization Failure");
if (t is IHaveUri uri && t is IHaveCollection<TKey, TItem> collection)
{
var items = GetElements(xdoc, uri.XPath);
foreach (var i in items)
{
var ty = Type.GetType(i.TypeName, false, true);
if (Serialization.Do.DeSerialize(ty, i.XElement, null) is TItem s)
collection.Register(s);
}
}
}
catch (Exception e)
{
// throw new Exception("Builder DeSerialization Failure in " + root + " " + e.Message);
ConsoleSync.WriteLineT($@"{e}");
}
return t;
}
GS.Dll
XDocExtension
XML, xDoc file
Create Strings for
TypeInString = Namespace.NameOfType, AssemblyName
Type = Type.GetType(TypeInString, false, true);
//Different Types, but interface is one
public static IEnumerable<string> GetTypeNameStrListEnumerable(string uri, string nodePath, string namesp)
{
var xdoc = XDocument.Load(uri);
var node = xdoc.Element(nodePath);
var nodeNamespace = node?.Attribute("ns")?.Value ?? namesp;
if (node == null) yield break;
if (!node.HasElements) yield break;
foreach (var n in node.Elements())
{
// var ns = n.Attribute("ns")?.Value ?? namesp;
var ns = n.Attribute("ns")?.Value ?? nodeNamespace;
var str = ns + '.' + n.Name.ToString().Trim();
yield return str;
}
}
public static IEnumerable<string> GetTypeNameStrListEnumerable(string uri, string nodePath,
string namesp, string assemblyName)
{
var xdoc = XDocument.Load(uri);
var node = xdoc.Element(nodePath);
if (node == null) yield break;
if (!node.HasElements) yield break;
var nodeNamespace = node.Attribute("ns")?.Value ?? namesp;
var asmName = node.Attribute("as")?.Value ?? assemblyName;
foreach (var n in node.Elements())
{
var ns = n.Attribute("ns")?.Value ?? nodeNamespace;
var asm = n.Attribute("as")?.Value ?? asmName;
var str = ns + '.' + n.Name.ToString().Trim() + ", " + asm;
yield return str;
}
}
}
GS -
GS.Time
GS.Trade.Data -
GS.Trade -
GS.Trade.Strategies
GS.Trade.Trades
GS.Trade.TradeTerminals
WebClients -
AssemblyInfoList.xml
<?xml version="1.0" encoding="utf-8"?>
<!--<AssemblyInfoList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">-->
<AssemblyInfoList ns="GS.Assemblies" as="GS">
<Assemblies>
<AssemblyInfo>
<Name>GS</Name>
<FullName>GS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</FullName>
<Path>D:\VC\1305\gs.trade\GS\GS\bin\Debug\GS.dll</Path>
<Enabled>false</Enabled>
<Dependencies />
</AssemblyInfo>
<AssemblyInfo>
<Name>GS.Time</Name>
<FullName>GS.Time, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</FullName>
<Path>D:\VC\1305\gs.trade\GS.Time\bin\Debug\GS.Time.dll</Path>
<Enabled>false</Enabled>
<Dependencies>
<string>GS</string>
</Dependencies>
</AssemblyInfo>
<AssemblyInfo>
<Name>GS.Trade</Name>
<FullName>GS.Trade, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</FullName>
<Path>D:\VC\1305\gs.trade\GS.Trade\GS.Trade\bin\Debug\GS.Trade.dll</Path>
<Enabled>false</Enabled>
<Dependencies>
<string>GS</string>
<string>GS.Time</string>
</Dependencies>
</AssemblyInfo>
<AssemblyInfo>
<Name>GS.Trade.Trades</Name>
<FullName>GS.Trade.Trades, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</FullName>
<Path>D:\VC\1305\gs.trade\GS.Trade.Trades\bin\Debug\GS.Trade.Trades.dll</Path>
<Enabled>false</Enabled>
<Dependencies>
<string>GS</string>
<string>GS.Trade</string>
</Dependencies>
</AssemblyInfo>
<AssemblyInfo>
<Name>GS.Trade.Data</Name>
<FullName>GS.Trade.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</FullName>
<Path>D:\VC\1305\gs.trade\GS.Trade.Data\bin\Debug\GS.Trade.Data.dll</Path>
<Enabled>false</Enabled>
<Dependencies>
<string>GS</string>
<string>GS.Trade</string>
<string>WebClients</string>
</Dependencies>
</AssemblyInfo>
<AssemblyInfo>
<Name>GS.Trade.TradeTerminals</Name>
<FullName>GS.Trade.TradeTerminals, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</FullName>
<Path>D:\VC\1305\gs.trade\GS.TradeTerminal\bin\Debug\GS.Trade.TradeTerminals.dll</Path>
<Enabled>false</Enabled>
<Dependencies>
<string>GS</string>
<string>GS.Trade.Data</string>
<string>GS.Trade.Trades</string>
</Dependencies>
</AssemblyInfo>
<AssemblyInfo>
<Name>GS.Trade.Strategies</Name>
<FullName>GS.Trade.Strategies, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</FullName>
<Path>D:\VC\1305\gs.trade\GS.Trade.Strategies\bin\Debug\GS.Trade.Strategies.dll</Path>
<Enabled>true</Enabled>
<Dependencies>
<string>GS</string>
<!--<string>GS.Time</string>-->
<string>GS.Trade</string>
<!--<string>GS.Trade.Data</string>-->
<string>GS.Trade.Trades</string>
<string>GS.Trade.TradeTerminals</string>
<string>WebClients</string>
</Dependencies>
</AssemblyInfo>
<AssemblyInfo>
<Name>WebClients</Name>
<FullName>WebClients, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</FullName>
<Path>D:\VC\1305\gs.trade\GS.Web.Clients\WebClients\bin\Debug\WebClients.dll</Path>
<Enabled>false</Enabled>
<Dependencies>
<string>GS</string>
<string>GS.Time</string>
<string>GS.Trade</string>
</Dependencies>
</AssemblyInfo>
</Assemblies>
</AssemblyInfoList>
WebClients for Moex
D:\VC\1305\gs.trade\GS.Web.Clients\GS.Web.Clients.sln
D:\VC\1305\gs.trade\GS.Web.Clients\WebClients\bin\Debug\WebClients.dll
EventLog:
Win7 1270
D:\Work\TradeWork\EvlServer\191010\CApp.GS.Web.Api.Evl.Server01.exe
SqlExpress
ChartDirector, MVC, Image
D:\VC\1305\gs.trade\GS.Trade.Web\GS.Trade.Web.Charts.Mvc_01
D:\VC\1305\gs.trade\GS.Trade.Web\GS.Trade.Web.Charts.Mvc_02 + Work
Sample
dotnet add package Microsoft.AspNet.SignalR.Sample --version 2.2.2
1.
IIS App IISExpress Firefox
With Color Flashing strings
D:\VC\Web\SignalR.StockTicker
D:\VC\Web\SignalR.StockTicker\SignalR.StockTicker.sln
VS2019
NetFramework 4.5
Work well
-------------------------------------------------------------------------------------------
2.
D:\VC\Web\SignalrChat19\SignalrChat19.sln
D:\VC\Web\SignalrChat19\SignalrChat01\SignalrChat01.csproj
Console App
Work in Browser
Net 5.0
VS2019
Work well
--------------------------------------------------------------------------------------------
3.
D:\VC\Web\SignalRChat\SignalRChat.sln
CAppClient, CAppServer, WebClient
WinFormsClient, WinFormsServer
WPFClient, WPFServer
VS2019
Netframework 4.5.1
---------------------------------------------------------------------------------------------
4.
D:\VC\Web\SignalrStockTicker17\SignalrStockTicker17.sln
SgnStockTicker01
Netframework 4.7.1
To WebApp : True - Not working
----
Try to convert to WebApp
D:\VC\Web\SignalrStockTicker17W\SignalrStockTicker17.sln
SgnStockTicker01
Netframework 4.8
https://www.newtonsoft.com/json/help/html/ConvertXmlToJson.htm
https://www.newtonsoft.com/json/help/html/SerializeToBson.htm
Bas64String
https://learn.microsoft.com/ru-ru/dotnet/api/system.convert.frombase64string?view=net-7.0
D:\VC\gs.trade\GS.XmlJson.Sln\GS.XmlJson.sln
D:\VC\gs.trade\GS.XmlJson.Sln\XmlJsonLib\