[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Shortening Symbol Names in TS4



PureBytes Links

Trading Reference Links

A couple of days back Rod Grisham posted the suggested Omega procedure to be
used for shortening symbol names and I would like to expand upon the reasons
for that procedure.  The space allocated for the symbol name in the various
databases is 11 characters plus a null terminator.  When a symbol is renamed
a null terminator is added after the last symbol character.  If the symbol
length is increased no problems occur but if a symbol length is decreased
more than one character at a time a special situation occurs.  For instance,
if "QWST" were renamed to "Q" in one step the resulting database change
would be "Q[null]ST" which is interpreted as "Q" for the Portfolio and Daily
databases and most other operations (Copy, Paste, Delete etc) but the Tick
database sees it as "Q[null]ST".  This occurs because the C-Tree fixed
record indexing uses the full 12 characters in the sort key and therefore
never sees "Q" (plus 11 nulls) and "Q[null]ST" (plus 8 nulls) as a match.
In the example case, any old tick data would not be visible but would
retained forever unless the tick data for "Q" was deleted.

So, the problem is that although the tick data will be retained until
intentional deletion it cannot be used by the program.  What if you renamed
for example "QWST" to "Q" a few days back and suffer from the CRS syndrome
and can't remember what the old symbol was.  No problem, just renamed "Q" to
some unused symbol like "Q-CRS123456" (11 characters max - it needs to be at
least the original length minus one character) and "presto" the old "lost"
tick data is now available.  Now, go through the "one character rename"
process to name the symbol properly.   For the example, that would be:

Q-CRS12345
Q-CRS1234
Q-CRS123
Q-CRS12
Q-CRS1
Q-CRS
Q-CR
Q-C
Q-
Q

Yeah, it's a long process and it sure seems like it would have been easy for
Omega to fix but the Omega Rename procedure should be made a habit
regardless of whether you are saving Tick data or not.

There is one potential pitfall which could render the tick database useless
and that is if you rename a symbol while the market is open you could create
two or more symbol/exchange/date/tick block chains or sort keys (60 or 120
ticks per block depending if you save tick volume).  When you next restart
the server it could fail due to having more than one sort key of the same
value.  The word is be very careful renaming symbols while the market is
open.  On Data Server start up if you get the Status Log Error "CTREE error
: RBLIFIL : (2) key value already exists" then you are in big trouble since
the Data Server won't allow you to edit the Tick Database for such errors.
I have a program which was designed to Unfragment the Tick Database and
which rejects identical sort keys but unless you use it or something similar
you have to start loading data from scratch.

Enough trivia?

Bob