10 Commits
Author SHA1 Message Date
mika@stocksharp.com ff4939af6a Handle FIX logout confirmations and rejected orders
Treat a successful reply to a local logout as a disconnect so the
session can finish while the connection is still open.

Preserve the instrument, account and supported side in rejected
execution reports. Leave the side unset when it is absent, undisclosed
or unsupported so the rejection still reaches the client.

Cover both scenarios in the FIX dialect tests.
2026-11-19 19:56:38 +03:00
mika@stocksharp.com c0435b60da Carry the order type on a FIX replace record
A replace states its order type the way a registration does: the record
holds an OrdType the converter fills from the order type and the condition,
and reads back into the order type, so the replace of a stop reads back as
the replace of a conditional order of the same flavour. A replace that
leaves the type unsaid has none on the record either.
2026-10-17 21:46:36 +03:00
mika@stocksharp.com f15eb1cd76 Carry the order's own id on its registration
An order a broker places goes by the id the broker recorded it under, but
the registration had no place for it: whatever worked the order could know
it only by the transaction of the connection that brought it, a number the
next connection does not share.

- OrderRegisterMessage.OrderId: the order's own id, copied with the message.
  A replace is a registration, so it carries the id too and keeps it.
- FixNewOrderSingle.OrderId (a broker extension, no standard tag) and the
  converter carry it both ways.
2026-10-17 01:22:31 +03:00
mika@stocksharp.com 61cc0f1697 Name the client an order status request is asked for
A gate asks for an account's orders on a session of its own, on behalf of
the client behind it, and names that client in the request's client code.
The request for positions carried it across in the Parties block; the two
order status requests had no such block, so the code was dropped on the
way and the server answered for the gate's own login.

Both records now hold the parties of the request, and the converter writes
the client code into them and reads it back, as it does for the request
for positions and for every order command.
2026-10-11 02:50:08 +03:00
mika@stocksharp.com 8d8fd38332 Harden FIX parsing and dialect behavior
A NUMBER THAT CANNOT BE NEGATED. The writer took the absolute value of a negative number before
writing its digits, and the most negative long has no positive counterpart - negating it overflows.
It builds the magnitude without negating now, and a test writes long.MinValue and reads it back.

The Long test beside it still says in a comment that the text format cannot round-trip that value
exactly, and works around it with MinValue + 1. If the new test goes red, that comment was right and
this is incomplete; it is left standing rather than quietly corrected, because which of the two is
true is a question for a run.

A TAG THAT IS NOT A TAG. A tag is a positive number followed by an equals sign, and anything else was
read on regardless: a zero, a negative number or a tag with no value would each have named a field
nobody sent and carried whatever bytes followed into it. Such a frame is refused. A stream that ends
between messages still reads as the empty tag, which is how a session that closed cleanly ends, and
the reader no longer throws on it.

A SCALED NUMBER THAT LOST ITS DIGITS. Its decimal value went through a double, which cannot hold every
decimal a price can be; it is built from the mantissa and exponent directly. Adding a scaled zero to a
number now leaves that number rather than moving its exponent.

AN EMPTY BOOK THAT EMPTIED EVERY BOOK. Told that one instrument has no quotes left, the dialect
cleared the quotes it held for all of them. It clears the one it was told about, and the empty book
it hands on names the subscription that asked - a book a subscriber cannot attribute is a book it
cannot apply.

TEXT THAT WAS NOT LATIN. The conversion to Latin ran over the whole string through a helper that
returned it unchanged when there was nothing to convert, and built a new string every time regardless;
it now walks the characters once and leaves an empty value alone.
2026-09-13 18:03:22 +03:00
mika@stocksharp.com 8647de91af Remove the dead FixExtendedMessages.AvailableDataRequest constant
The "ADR" message type had no writer and, after the FIX server stopped
accepting it, no reader either - nothing in the core or in the applications
referenced the constant, and the message it named (AvailableDataRequestMessage)
is long gone. Keeping it only guaranteed that every use site would need a
CS0612 pragma.

AvailableDataInfo ("ADI") stays for now: DefaultFixDialect still maps it onto
DataTypeInfo when reading, so it is not dead in the same sense.
MessageTypes.AvailableDataRequest also stays - it is an enum member, and
removing it would renumber every value declared after it.
2026-08-31 04:21:46 +03:00
mika@stocksharp.com 460f012f37 Name the subscription-list request on the wire
The FIX message type existed but had no record of its own, so the SBE side had
nothing to declare when it gained the same request.
2026-08-16 00:43:48 +03:00
mika@stocksharp.com c26fa0d2a1 Let the FIX reader report the sequence number of the message it is reading
A session-level Reject names the message it refuses through RefSeqNum, but by
the time one is written the tag carrying that number has long been consumed:
the reader hands tag 34 to the dialect and keeps nothing. TextFixReader now
remembers the value as it reads it, and forgets it at the version tag that
starts the next message, so a rejection can never name the previous one.
2026-08-15 21:14:22 +03:00
mika@stocksharp.com 7800b2680c FIX: one statement of the TimeInForce wire rule, and one class of its codes
Native/Enums.cs declared FixTimeInForce and TimeInForce - two static classes,
byte-identical, ten members each. The aliases in the dialects and in the server
that consumes them spelled `FixTimeInForce` while pointing at the second one, so
code that looked like it used the same type as everything else did not, and a
change to either class would have silently reached only half the callers. The
duplicate is gone and every alias points at FixTimeInForce, which is the name
worth keeping: the short one collides with Messages.TimeInForce, which is why
those aliases exist at all.

Not converted to an enum, though the rule about magic values would otherwise ask
for it: these are FIX tag-59 wire characters ('0', '1', '6', ...) and a C# enum
cannot have char as its underlying type.

The rule that chooses among those codes was written out three times. TimeInForce
alone cannot say how long an order lives - GoodTillCancel, Day and GoodTillDate
are all PutInQueue, and the expiry is what tells them apart - so the pair has to
be read together, once for order entry, once in a server-side converter, and a
third time, wrongly, where an ExecutionReport was built. That third copy reported
every Day and every GoodTillDate order back to its owner as GoodTillCancel. The
rule now lives once, as TimeInForce.ToFix(tillDate), and the callers defer to it.

The round trip is not an identity, and the decode side now says so where it
applies. An ABSENT tag 59 is defined to mean Day, while an order carrying neither
TimeInForce nor TillDate means GoodTillCancel here - so order entry always writes
59 and the decode returns the explicit form. Normalising the message before the
write was considered and rejected: nothing downstream reads the field back, the
value never reaches the Order object, and the dialects that deliberately state a
different policy on the wire would start disagreeing with themselves.

The consumers outside this repository are corrected in the same change.
2026-07-31 18:35:55 +03:00
mika@stocksharp.com f1f267d7f3 Take in the FIX protocol library and its dialect framework
Fix.Core and Fix.Dialects arrive from the closed apps repository. They were only
there because Fix.Core referenced the closed Licensing project for a single
licence check; that check is gone, and with it the reason to keep the FIX
protocol out of the open source tree.

They are the framework, not a venue - the FIX connector itself goes to the
Connectors repository and references these two from here, the same way every
connector already references Messages and Media.Names.

The obfuscation stub include that both carried is dropped: it names a file at the
root of the apps repository, and open sources are not obfuscated.

Both build.
2026-07-30 20:22:03 +03:00