Feature eodtime#108
Conversation
…dep, init confirmation message, feedback alignment
…ct init, required log dep, kx.log normalisation
…ing, updated docs and tests
|
The review calls have proved very productive in providing consistency and holding each other accountable, which has now led to my confident submission for this module. A few design decisions were made within the team, most of which are laid out in the design decisions section of the PR, but I also wanted to point out a few that we came up with and some reasoning behind them, as arguments can be made for multiple approaches to each of these situations, but importantly we have consolidated our approaches together in the interest of consistency. We welcome any feedback on these decisions if better alternatives exist, as they will apply to all modules going forward. Single deps dict for config and dependencies |
- Log functions updated to dyadic {[ctx;msg]} contract; kx.log instances
normalised via normlog to wrap monadic functions into the required form
- init validates log at minimum an `info key; warn/error not required
- modulesetup.q renamed to integrationtest.q with dynamic port via -p flag
- test.html subscription fixed to call sub via evaluate (wssub removed);
snapshot now rendered into table panel on subscribe
- Docs updated to reflect log contract, normlog behaviour, and sub dispatch
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
On the note of the di.tz dependency, there is potential here to combine the di.tz and di.eodtime into one module to remove hard dependencies in these (standalone) modules and for the sake of "neatness". |
EOD time management module, di.eodtime
Extracts
code/common/eodtime.qfrom TorQ and packages it as a standalone kdb-x module. Manages end-of-day timing for tickerplant processes, resolves the current trading date in a configurable timezone, calculates when the next EOD roll is due in UTC, and provides a UTC offset used to timestamp incoming market data.Trello ticket - https://trello.com/c/rMbaJnZU/87-kdb-x-eod-module
Files created
di/eodtime/init.qdi.tzdependency, loadseodtime.q, defines export of 9 functionsdi/eodtime/eodtime.qdi/eodtime/eodtime.mddi/eodtime/test.csvHow to test
Coverage includes: all 9 exported functions, GMT/UTC shortcut behaviour, timezones in both winter and summer (DST transitions), offset behaviour, dep validation (all four failure modes),
info-only log dict,kx.loginstance acceptance vianormlog, and capturing logger assertion.Design decisions
1.
di.tzas hard dependency - Rather than duplicating timezone conversion logic,di.tzis loaded viatz:use\di.tzininit.q`.2. Setter and getter functions - In TorQ, processes update
.eodtime.*variables directly (e.g.stplog.qdoes.eodtime.d+:1after each EOD roll). Since direct assignment inside a module is not possible, setter functions (setd,setnextroll,setdailyadj) were introduced so values can be updated at runtime.3. UTC-equivalent timezone shortcuts -
"GMT","UTC"and"Etc/GMT"are not in the timezone database used bydi.tzand cause anotValidTimezoneerror if passed through. Since"GMT"is TorQ's default timezone, these are short-circuited to return0Ddirectly, ensuring the module works out of the box with existing TorQ deployments. Note:"Etc/UTC"is valid indi.tzand passes through normally.4. Graceful DST handling - Non-GMT timezones are handled at runtime rather than caching a static offset, so DST transitions are picked up automatically. Verified in the test suite with
Europe/Londonin both winter (UTC+0) and summer (UTC+1).5. Required log dependency with
normlog- Thelogdep is required;initerrors immediately if absent or malformed. Onlyinfois required since the module never callswarnorerror. Thenormloginternal function detects akx.loginstance by the presence ofgetlvl,sinks,fmtskeys and wraps its monadic functions into the binary{[c;m]}contract automatically, so callers can pass akx.loginstance directly without manual wrapping.6. Single
depsdict - Config values (rolltimezone,datatimezone,rolltimeoffset) and the log dependency are passed together in a singledepsdict toinit, consistent with the project dependency injection guidelines. All config keys are optional with sensible defaults; onlylogis required.Checklist
consistency.mdandstyle.mdeodtime.mddocuments all exported functions, config, usage examples and notesdi.tzrename PR Renaming of timezone to tz #91 mergedDocumentation
See
eodtime.mdfor full reference including dependency table, configuration options, exported function documentation with examples, usage example, and notes.