суббота, 12 декабря 2020 г.

StockChart, DataCollection Bug fixed

Xu  

for (int j = 0; j < stockdata.Length; j++)

                        {

                            // stockdata[j] = Convert.ToSingle(ds.DataString[j + 1, i]);

                            var item = ds.DataString[j + 1, i];

                            var fl = float.Parse(item.Trim().Replace(" ", "").Replace(",", "."),

                                CultureInfo.InvariantCulture);

                            stockdata[j] = fl;

                        }

среда, 7 октября 2020 г.

Python, Socket

 https://github.com/tashik/QUIKSharp/blob/master/quiksharp_qlua_python_socket_client.py

https://smart-lab.ru/profile/_sg_/favourites/comments/

https://smart-lab.ru/vopros/650507.php

# -*- coding: utf-8 -*-
import socket
import json
CRLF = "\r\n\r\n"
host = '127.0.0.1'
port_requests = 34130
port_callbacks = 34131
sok_requests = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sok_callbacks = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sok_callbacks.connect((host , port_callbacks))
sok_requests.connect((host , port_requests))
request = {"data":"Ping","id":"1","cmd":"ping","t":"0"}
raw_data = json.dumps(request)
sok_requests.sendall((raw_data+CRLF).encode())
while(True):
response = sok_requests.recv(2048)
print(response)
# Пример Получение стакана котировок по классу и коду бумаги getQuoteLevel2 - Python socket client
# Функция getQuoteLevel2() принимает 2 параметра: Код класса и Код бумаги, а возвращает таблицу, которая имеет следующие поля:
# bid_count -- Количество котировок покупки (STRING)
# offer_count -- Количество котировок продажи (STRING)
# bid -- Котировки спроса (покупки) (TABLE)
# offer -- Котировки предложений (продажи) (TABLE)
# -- Таблицы «bid» и «offer» имеют следующую структуру:
# price -- Цена покупки / продажи (STRING)
# quantity -- Количество в лотах (STRING)
CRLF = "\r\n\r\n"
host = '127.0.0.1'
port_requests = 34130
port_callbacks = 34131
sok_requests = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sok_callbacks = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sok_callbacks.connect((host , port_callbacks))
sok_requests.connect((host , port_requests))
request = {"data":"SPBFUT|SiH0","id":"1","cmd":"getQuoteLevel2","t":""}
raw_data = json.dumps(request)
sok_requests.sendall((raw_data+CRLF).encode())
data = b""
bufsize = 1024
while(True):
packet = sok_requests.recv(bufsize)
data += packet
if len(packet) < bufsize:
break
data = json.loads(data.decode('cp1251'))

print(data)

пятница, 7 августа 2020 г.

GS.Trade.Strategies

 Ti23

 if (Position.Quantity < Contracts)

                    {

                          Mode = IsPosPositive2 ? 2 : 3;

                    }

                    else if (Position.Quantity >= Contracts)

                    {

                        MaxContractsReached = true;


                        Mode = IsPosPositive2 ? 8 : 4;

                    }

Exit with Profit in Mode: 2,8 wth Signal 3

Exit with Loss in Mode: 4,3 wth Signal 2

Entry, Increase Position Signal 1 

Example Msg(Signal1,Signal2,Signal3)  -> (188,164,260)

----------------------

Ti22

 if (Position.Quantity < Contracts)

                    {

                        Mode = IsPosPositive2 ? 2 : 3;

                    }

                    else if (Position.Quantity >= Contracts)

                    {

                        Mode = IsPosPositive2 ? 8 : 4;

                    }

Exit with Profit in Mode: 2,8 wth Signal 1

Exit with Loss in Mode: 4,3  AND  Increase in Profit  in Mode: 2 with Signal 2

Entry, Increase Position in Losss: Signal 1 

Example Msg(Signal1,Signal2)  -> (260,188)


понедельник, 6 июля 2020 г.

GS.EventLog Update

OWIN version
GS.EventLog Update

Set EvlContextName for different DataBase
Dvlp14.EventLog1 = ConnectionStringName

EvlContext  = <DataBaseName>Dvlp14.EventLog1</DataBaseName>
EvlContext  = <DataBaseName>Expr14.EventLog1</DataBaseName>

<add name="Expr14.EventLog1" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=EventLog1;Integrated Security=True" providerName="System.Data.SqlClient" />

    <add name="Dvlp14.EventLog1" connectionString="Data Source=.\SQLDVLP14;Initial Catalog=EventLog1;Integrated Security=True" providerName="System.Data.SqlClient" />

 <DbEventLog1 enabled = "false">
      <Code>GS.Web.Api.EventLog.Server</Code>
      <Name>GS.Web.Api.EventLog.Server</Name>
      <EventLogKey>GS.Web.Api.EventLog.Server</EventLogKey>
      <Description>GS.Trade.EventLog in DataBase.EventLog</Description>
      <DataBaseName>EventLog1</DataBaseName>
      <TimeOut>300</TimeOut>
      <IsEnabled>true</IsEnabled>
      <IsQueueEnabled>false</IsQueueEnabled>
      <IsPrimary>false</IsPrimary>
      <IsAsync>false</IsAsync>
      <IsSaveEnabled>true</IsSaveEnabled>
      <IsUIEnabled>false</IsUIEnabled>
    </DbEventLog1>
    <DbEventLog2 enabled = "false">
      <Code>GS.Web.Api.EventLog.Server</Code>
      <Name>GS.Web.Api.EventLog.Server</Name>
      <EventLogKey>GS.Web.Api.EventLog.Server</EventLogKey>
      <Description>GS.Trade.EventLog in DataBase.EventLog</Description>
      <!--<DataBaseName>EventLog1</DataBaseName>-->
      <!--<DataBaseName>Expr14.EventLog1</DataBaseName>-->
      <DataBaseName>Dvlp14.EventLog1</DataBaseName>
      <TimeOut>300</TimeOut>
      <IsEnabled>true</IsEnabled>
      <IsQueueEnabled>true</IsQueueEnabled>
      <IsPrimary>false</IsPrimary>
      <IsAsync>false</IsAsync>
      <IsSaveEnabled>true</IsSaveEnabled>
      <IsUIEnabled>false</IsUIEnabled>
      <ErrorRecoveryTimeOut>60</ErrorRecoveryTimeOut>
      <ErrorCntToStop>10</ErrorCntToStop>
    </DbEventLog2>

воскресенье, 5 июля 2020 г.

Updates

1. GS.Trade.Web.Api.TimeSeries01, GS.Trade.Web.Mvc.TimeSeries01
1.1 web.config
<compilation>
      <assemblies>
        <remove assembly="Microsoft.VisualStudio.Web.PageInspector.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      </assemblies>
    </compilation>
    <httpRuntime targetFramework="4.5" />

 ****** after delete VS2013 *********
1.2 new ConnectionString

2. new Database
2.1. SQLDVLP14
2.2. Add User NeworkService
2.3.

Tickers:
public IEnumerable<IBarSimple> GetSeries(long seriesId, DateTime dt)
        {
            var m = MethodBase.GetCurrentMethod() + "()";
            // return _barWebClient.GetSeries(seriesId, dt);
            var r = _barWebClient.GetSeries(seriesId, dt);
            if (r == null)
                Evlm2(EvlResult.FATAL, EvlSubject.TECHNOLOGY, ParentTypeName, TypeName,
                    m, $"Failure in Get SeriesId:{seriesId}, DT:{dt.Date.ToString("d")}", ToString());
            return r;
        }

вторник, 9 июня 2020 г.

GS.Trade.TradeWindows

PositionTotals_Windows4

Update Totals with PositionNpc2 via Strategy?.DailyMaxProfit

Strategy.Positions2:
pp.Strategy.PositionTotal.Update(p); // 07.01.2014
CreateStat();                            FireTotalPositionUpdateEvent(pp.Strategy.PositionTotal);

public void FireTotalPositionUpdateEvent(IPosition2 p)
        {
            if (p == null) return;
            // var pcl = p.Clone();
            Strategy.OnChangedEvent(new Events.EventArgs
            {
                Category = "UI.Positions",
                Entity = "Total",
                Operation = "Update",
                Object = p,
                Sender = this
            });

        }

public PositionNpc2(IPosition2 ip)
        {
            Strategy = ip.Strategy;

            FirstTradeDT = ip.FirstTradeDT;
            FirstTradeNumber = ip.FirstTradeNumber;

            LastTradeDT = ip.LastTradeDT;
            LastTradeNumber = ip.LastTradeNumber;

            Operation = ip.PosOperation;
            Status = ip.PosStatus;

            Quantity = ip.Quantity;

            Price1 = ip.Price1;
            Price2 = ip.Price2;

            DailyPnLFixed = ip.DailyPnLFixed;
            PosPnLFixed = ip.PosPnLFixed;

            DailyProfitLimit = ip.DailyProfitLimit;

            LastPrice = ip.LastPrice;

            //PnL1 = ip.PnL;
            // 17.04.11
            //PnL2 = ip.PnL2;
            PnL2 = ip.PnL;
            PnL3 = ip.PnL3;

            StrategyKeyEx = ip.StrategyKeyEx;
            TickerCodeEx = ip.TickerCodeEx;
            AccountCodeEx = ip.AccountCodeEx;

            Delta = ip.Delta;

            //TotalDailyMaxProfit = ip.TotalDailyMaxProfit;
            //TotalDailyMaxLoss = ip.TotalDailyMaxLoss;
            //TotalDailyMaxProfitDT = ip.TotalDailyMaxProfitDT;
            //TotalDailyMaxLossDT = ip.TotalDailyMaxLossDT;

            TotalDailyMaxProfit = ip.Strategy?.DailyMaxProfit ?? 0;
            TotalDailyMaxLoss = ip.Strategy?.DailyMaxLoss ?? 0;
            TotalDailyMaxProfitDT = ip.Strategy?.DailyMaxProfitDT ?? DateTime.Now;
            TotalDailyMaxLossDT = ip.Strategy?.DailyMaxLossDT ?? DateTime.Now;

            Comment = ip.Comment;

        }

public void Update(IPosition2 ip)
        {
            if (Quantity == 0)
            {
                FirstTradeDT = ip.FirstTradeDT;
                FirstTradeNumber = ip.FirstTradeNumber;
            }

            LastTradeDT = ip.LastTradeDT;
            LastTradeNumber = ip.LastTradeNumber;

            Operation = ip.PosOperation;
            Status = ip.PosStatus;

            Quantity = ip.Quantity;

            Price1 = ip.Price1;
            Price2 = ip.Price2;

            LastPrice = ip.LastPrice;

            //PnL1 = ip.PnL;
            // 17.04.11
            //PnL2 = ip.PnL2;
            PnL2 = ip.PnL;
            PnL3 = ip.PnL3;

            DailyPnLFixed = ip.DailyPnLFixed;
            PosPnLFixed = ip.PosPnLFixed;

            DailyProfitLimit = ip.DailyProfitLimit;

            StrategyKeyEx = ip.StrategyKeyEx;
            AccountCodeEx = ip.AccountCodeEx;
            TickerCodeEx = ip.TickerCodeEx;

            Delta = ip.Delta;

            TotalDailyMaxProfit = ip.Strategy?.DailyMaxProfit ?? 0;
            TotalDailyMaxLoss = ip.Strategy?.DailyMaxLoss ?? 0;
            TotalDailyMaxProfitDT = ip.Strategy?.DailyMaxProfitDT ?? DateTime.Now;
            TotalDailyMaxLossDT = ip.Strategy?.DailyMaxLossDT ?? DateTime.Now;

            // TotalDailyMaxProfit = ip.TotalDailyMaxProfit;
            // TotalDailyMaxLoss = ip.TotalDailyMaxLoss;
            // TotalDailyMaxProfitDT = ip.TotalDailyMaxProfitDT;
            // TotalDailyMaxLossDT = ip.TotalDailyMaxLossDT;

            Comment = ip.Comment;

        }

Update Totals Strategies, Tickers, TimeInt

private void CreateTotalTickersReport(object sender, RoutedEventArgs routedEventArgs)
        {
            var method = MethodBase.GetCurrentMethod().Name + "()";

            TotalTickersList.Clear();
            if (PositionCollection == null || !PositionCollection.Any()) return;
            try
            {
                var v = (from t in PositionCollection
                    group t by t.Ticker.Code
                    into g
                    select new TotalStat01()
                    {
                        Strategy = "All",
                        Ticker = g.Key,
                        TimeInt = 0,
                        Quantity = g.Sum(t=>t.Quantity),
                        Count = g.Count(),
                        ProfitLoss = g.Sum(t => t.PnL2),
                        ProfitAvg = g.Average(t => t.PnL2),
                        ProfitMax = g.Max(t=>t.PnL2),
                        ProfitMin = g.Min(t => t.PnL2),
                        ProfitStd = GSMath.Math.StandardDeviation(g.Select(t => t.PnL2)),
                        DailyMaxProfit = g.Max(t => t.Strategy.DailyMaxProfit),
                        DailyMaxLoss = g.Min(t => t.Strategy.DailyMaxLoss),
                        FirstTradeDT = g.Min(t => t.FirstTradeDT),
                        LastTradeDT = g.Max(t => t.LastTradeDT)
                    }).OrderBy(t => t.Ticker); // .ToList();

                foreach (var i in v) TotalTickersList.Add(i);
                _isNeedRefreshStat = false;
            }
            catch (Exception e)
            {
                _evl?.Evlm2(EvlResult.FATAL, EvlSubject.PROGRAMMING, GetType().FullName, e.GetType().Name,
                    method, e.Message, ToString());
            }

        }

воскресенье, 7 июня 2020 г.

GS.Trade.TradeWindows

PositionTotals_Windows4 Standard Deviation Added

var v = (from t in PositionCollection
                    group t by t.Ticker.Code
                    into g
                    select new TotalStat01()
                    {
                        Strategy = "All",
                        Ticker = g.Key,
                        TimeInt = 0,
                        Quantity = g.Sum(t=>t.Quantity),
                        Count = g.Count(),
                        ProfitLoss = g.Sum(t => t.PnL2),
                        ProfitAvg = g.Average(t => t.PnL2),
                        ProfitMax = g.Max(t=>t.PnL2),
                        ProfitMin = g.Min(t => t.PnL2),

                        ProfitStd = GSMath.Math.CalculateStandardDeviation(g.Select(t => t.PnL2)),

                        DailyMaxProfit = g.Max(t => t.Strategy.DailyMaxProfit),
                        DailyMinProfit = g.Min(t => t.Strategy.DailyMinProfit),
                        FirstTradeDT = g.Min(t => t.FirstTradeDT),
                        LastTradeDT = g.Max(t => t.LastTradeDT)
                    }).OrderBy(t => t.Ticker); // .ToList();

                foreach (var i in v) TotalTickersList.Add(i);
                _isNeedRefreshStat = false;

TimeSeries DataBase

TimeSeries01 DataBase.
Bars.Count 39 700 342 bars

Delete BarSeries URANUS, MARS BarSeriesId = 6,7,8,9

Last BackUp with URANUS, MARS TimeSeries01_200608

After Delete
Bars.Count 32 554 851 bars


пятница, 5 июня 2020 г.

736Z1 Ma2KAtr

736Z1 
NewPositionEvaneHandler() =>

 if (Ma1KAtr2.IsEquals(0.0f)) return;
            if (Ma1KAtr2.IsGreaterThan(Ma1KAtr))
            {
                var pos = Position.Quantity;
                var k = Ma1KAtr + (Ma1KAtr2 - Ma1KAtr)*pos/Contracts;
                XTrend.SetKAtr(k);
            }
            else if (Ma1KAtr2.IsLessThan(Ma1KAtr))
            {
                //var pos = Position.Quantity;
                //var zn = Math.Ceiling(Contracts/2f);
                //if (!(pos >= zn)) return;
                //var diff = zn - (Contracts - pos);
                //var k = Ma1KAtr - (Ma1KAtr2 - Ma1KAtr)*diff/zn;
                //XTrend.SetKAtr((float) k);
                var pos = Position.Quantity;
                // var posdiff = Contracts - pos;
                var k = Ma1KAtr - (Ma1KAtr - Ma1KAtr2) * pos / Contracts;
                XTrend.SetKAtr(k);

            }

if (Ma1KAtr2.IsEquals(0.0f)) return;
            if (Ma1KAtr2.IsGreaterThan(Ma1KAtr))
            {
                var pos = Position.Quantity;
                var k = Ma1KAtr + (Ma1KAtr2 - Ma1KAtr)*pos/Contracts;
                XTrend.SetKAtr(k);
            }
            else if (Ma1KAtr2.IsLessThan(Ma1KAtr))
            {
                //var pos = Position.Quantity;
                //var zn = Math.Ceiling(Contracts/2f);
                //if (!(pos >= zn)) return;
                //var diff = zn - (Contracts - pos);
                //var k = Ma1KAtr - (Ma1KAtr2 - Ma1KAtr)*diff/zn;
                //XTrend.SetKAtr((float) k);
                var pos = Position.Quantity;
                // var posdiff = Contracts - pos;
                var k = Ma1KAtr - (Ma1KAtr - Ma1KAtr2) * pos / Contracts;
                XTrend.SetKAtr(k);
            }


736T
<Z00736T>
    <Name>Z00736.100</Name>
    <Code>Z00736T.5.5.188.068.224.19</Code>
    <TradeAccountKey>Quik.Simulate</TradeAccountKey>
    <TradeTerminalType>Simulator</TradeTerminalType>
    <TradeTerminalKey>MyTerminal</TradeTerminalKey>
    <TimePlanKey>Forts.Standard</TimePlanKey>
    <TickerKey>SiM0</TickerKey>
    <TimeInt>5</TimeInt>

    <Ma1Length>300</Ma1Length>
    <Ma1AtrLength>100</Ma1AtrLength>
    <Ma1KAtr>1.4</Ma1KAtr>
    <Ma1Mode>1</Ma1Mode>

    <TimeInt2>68</TimeInt2>

    <Ma2KAtr>2.24</Ma2KAtr>

Z007 Init()
 if (TimeInt2 > 0 && TimeInt2 != TimeInt)
                {
                    if (Ma2KAtrMltp.IsGreaterThan(0f))
                        PrimTrend = TradeContext.RegisterTimeSeries(
                            new Xma018("Xma18_2", Ticker, (int) TimeInt2, Ma1Length, MaAtrLength1, MaAtrLength2,  Ma1KAtr*Ma2KAtrMltp,
                                Ma1Mode)) as Xma018;
                    else if (Ma2KAtr.IsGreaterThan(0f))
                        PrimTrend = TradeContext.RegisterTimeSeries(
                            new Xma018("Xma18_2", Ticker, (int) TimeInt2, Ma1Length, MaAtrLength1, MaAtrLength2, Ma2KAtr,
                                Ma1Mode)) as Xma018;
                    //else if (Ma2KAtr > 0f)
                    //    PrimTrend = TradeContext.RegisterTimeSeries(
                    //        new Xma018("Xma18_2", Ticker, (int) TimeInt, Ma1Length, MaAtrLength1, MaAtrLength2, Ma2KAtr,
                    //            Ma1Mode)) as Xma018;
                }
                else
                {
                    if (Ma2KAtrMltp.IsGreaterThan(0f))
                        PrimTrend = TradeContext.RegisterTimeSeries(
                            new Xma018("Xma18_2", Ticker, (int)TimeInt, Ma1Length, MaAtrLength1, MaAtrLength2, Ma1KAtr * Ma2KAtrMltp,
                                Ma1Mode)) as Xma018;
                    else if (Ma2KAtr.IsGreaterThan(0f))
                        PrimTrend = TradeContext.RegisterTimeSeries(
                            new Xma018("Xma18_2", Ticker, (int)TimeInt, Ma1Length, MaAtrLength1, MaAtrLength2, Ma2KAtr,
                                Ma1Mode)) as Xma018;
                }


понедельник, 18 мая 2020 г.

GS.EventHubs

GS.EventHubs.EventHub1.EventHub<TContent> ... where TContent : IHaveContent<TContent>

TypesName: List<string>,  string[]
Test Name: DeSerializeEventHub_LstStr_Test
Test Outcome: Passed
Result StandardOutput:

GS.EventHubs.EventHub1.EventHub<List<string>>
EventHubTypeName: EventHub`1
EventHubTypeFullName: GS.EventHubs.EventHubT1.EventHub`1[[System.Collections.Generic.List`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
ToString(): GS.EventHubs.EventHubT1.EventHub`1[System.Collections.Generic.List`1[System.String]]

GS.EventHubs.EventHub1.EventHub<string[]>
EventHubTypeName: EventHub`1
EventHubTypeFullName: 
GS.EventHubs.EventHubT1.EventHub`1[[System.String[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
ToString():
GS.EventHubs.EventHubT1.EventHub`1[System.String[]]

Xml
List<string>
<?xml version="1.0" encoding="utf-8"?>
<EventHubOfListOfString>
  <IsEnabled>false</IsEnabled>
  <IsEvlEnabled>false</IsEvlEnabled>
  <Capasity>0</Capasity>
  <CapasityLimit>0</CapasityLimit>
  <IsReversed>false</IsReversed>
  <IsQueueEnabled>false</IsQueueEnabled>
  <IsProcessTaskInUse>false</IsProcessTaskInUse>
  <EventHubItems>
    <EventHubItemOfListOfString>
      <Code>QuikDdeServer.Quotes</Code>
    </EventHubItemOfListOfString>
    <EventHubItemOfListOfString>
      <Code>QuikDdeServer.TickerInfo</Code>
    </EventHubItemOfListOfString>
    <EventHubItemOfListOfString>
      <Code>QuikDdeServer.OptionDesk</Code>
    </EventHubItemOfListOfString>
  </EventHubItems>/>

</EventHubOfListOfString>

string[] <?xml version="1.0" encoding="utf-8"?>
<EventHubOfArrayOfString>
  <IsEnabled>false</IsEnabled>
  <IsEvlEnabled>false</IsEvlEnabled>
  <Capasity>0</Capasity>
  <CapasityLimit>0</CapasityLimit>
  <IsReversed>false</IsReversed>
  <IsQueueEnabled>false</IsQueueEnabled>
  <IsProcessTaskInUse>false</IsProcessTaskInUse>
  <EventHubItems>
    <EventHubItemOfArrayOfString>
      <Code>QuikDdeServer.Quotes</Code>
    </EventHubItemOfArrayOfString>
    <EventHubItemOfArrayOfString>
      <Code>QuikDdeServer.TickerInfo</Code>
    </EventHubItemOfArrayOfString>
    <EventHubItemOfArrayOfString>
      <Code>QuikDdeServer.OptionDesk</Code>
    </EventHubItemOfArrayOfString>
  </EventHubItems>/>
</EventHubOfArrayOfString>

Test Name: EventHub_LstStr_Build_Test
Test Outcome: Passed
Result StandardOutput:

List<string>
GS.EventHubs.EventHubT1.EventHubItem`1[System.Collections.Generic.List`1[System.String]] Code: QuikDdeServer.Quotes Key: QUIKDDESERVER.QUOTES

GS.EventHubs.EventHubT1.EventHubItem`1[System.Collections.Generic.List`1[System.String]] Code: QuikDdeServer.TickerInfo Key: QUIKDDESERVER.TICKERINFO

GS.EventHubs.EventHubT1.EventHubItem`1[System.Collections.Generic.List`1[System.String]] Code: QuikDdeServer.OptionDesk Key: QUIKDDESERVER.OPTIONDESK

string[]
GS.EventHubs.EventHubT1.EventHubItem`1[System.String[]] Code: QuikDdeServer.Quotes Key: QUIKDDESERVER.QUOTES

GS.EventHubs.EventHubT1.EventHubItem`1[System.String[]] Code: QuikDdeServer.TickerInfo Key: QUIKDDESERVER.TICKERINFO

GS.EventHubs.EventHubT1.EventHubItem`1[System.String[]] Code: QuikDdeServer.OptionDesk Key: QUIKDDESERVER.OPTIONDESK

четверг, 14 мая 2020 г.

TcpDdeServer, TcpServer04, DdeServer

TcpServer04

Subscribe for Topics Support:
EventHub = GS.EventHubs.EventHub

TcpDdeServer:
DdeServer
TcpServer04
ProcessTask for DdeServer and TcpServer04 interaction

DdeServer -> ProcessTask -> TcpServer04 with Subscribing  for Topic Available for the TcpClients

Dde Message to TcpServer04 via ProcessTask 
but in case of the same message format ProcessTask Is Not Used.

TcpDdeServer:
DdeServer.TableChangedAction -> IList<string> -> MsgFormatter -> TcpServer04.SendMessage -> Create EventArgs(IList) -> EventHub.Enqueue 
-> TcpClients(Subscribers).SendMessage(TMessage)
f

вторник, 28 апреля 2020 г.

TCP/IP Server Client

Json/String/StringArray
Cmd/Data
Cmprs/AsIs

json/DATA/CMPRS/position/operation/Type/data
XML/DATA/CMPRS/STRATEGY/operation/TYPE/StrategyData

STR/CMD/PING/DateTime
STR/CMD/PONG/DateTime
STR/CMD/CLOSE

STR/DATA/ASIS/Quotes/QuotesData

Data/RouteKey/Entity/Operation/EntityData/Fmt/Doc/Cmprs/Typeof/
Cmd/Ping/DateTeme

Fmt: json,xml,str
Doc/Class/Txt

Data/Tickers/Quotes/New/BidAsk/Str
Data/Tickers/Quotes/New/BidAsk/xml/class/Asis/Tickers.Quote
Data/Tickers/Quotes/New/BidAsk/json/class/Asis/Tickers.Quote

суббота, 18 апреля 2020 г.

Element32

public abstract class Element32<TKey, TEventArgs, TList, TItem> 
                                : Element3<TKey, TEventArgs> , IElement2<TKey, TItem>, IHaveUri
        where TItem : class, IElement1<TKey>, IHaveKey<TKey> //, IHaveInit
        // where TItem : class, IHaveKey<TKey> // , IHaveInit
        where TList : IContainer<TKey, TItem>
        where TEventArgs : IEventArgs
        //where TList : ICollection<TItem>
    {
        [XmlIgnore]
        public TList Collection;

        public IEnumerable<TItem> Items => Collection.Items;

        public string Uri { get; set; }
        public string XPath { get; set; }
        public string UriXPath => Uri + "@" + XPath;


        public override void Init(IEventLog evl)

----------------------------------------------------------------
public class EventHub3 : Element32<string,  IEventArgs, DictionaryContainer<string, EventHubItem3>, EventHubItem3>
    {
        //public bool IsQueueEnabled { get; set; }
        public List<EventHubItem3> EventHubItems { get; set; }

        // protected EventArgsQueue Queue;
        private readonly object _locker;

        public EventHub3()
        {
            EventHubItems = new List<EventHubItem3>();
            Collection = new DictionaryContainer<string, EventHubItem3>();
            //Queue = new EventArgsQueue();
            _locker = new object();
        }
------------------------------------------------------------
public class TaskProcess02 : Element32<string,  IEventArgs1,
        DictionaryContainer<string, UnitOfWork>, UnitOfWork>
    {
        //public bool IsQueueEnabled { get; set; }
        public List<EventHubItem3> EventHubItems { get; set; }

        // protected EventArgsQueue Queue;
        private readonly object _locker;

        protected ProcessTask02 Task { get; set; }

        public TaskProcess02()
        {
            EventHubItems = new List<EventHubItem3>();
            Collection = new DictionaryContainer<string, UnitOfWork>();
            Task = new ProcessTask02 { Parent = this, TimeInterval = 5000 };
            //Queue = new EventArgsQueue();
            _locker = new object();

        }