Operations¶
This tab is about running UBI day after day on one machine. Everything runs as systemd user services, every job has a fixed time in India Standard Time (IST), every script lives in bin/, and a set of offline test suites tells you whether a change broke something before it reaches a live account.
-
Services
The systemd user units in
services/, how the templates turn one file into many services, the restart rules, and the exact commands that install each group. -
Daily schedule
What happens at which time of day, from the 06:00 order count reset to the 23:30 MCX close, drawn as a timeline.
-
Scripts
Every executable in
bin/: the tools you type by hand, the broker scripts systemd runs, and the unified scripts that combine them, with their options and exit codes. -
Offline tests
The nineteen test suites in
test_runs/that need no network, no broker and no database, how their recordings work, and the lint baseline.
A day in the life¶
A normal trading day follows the same steps every time, and no person has to start any of them. The numbered list below walks through one day in the order things happen.
- At 06:00 IST the daily order counters in Redis expire, so every capped broker starts the day with its full allowance.
- At 07:00 IST the ten broker login timers fire, each after its own random delay of up to 30 minutes, so the ten logins do not all happen in the same second. At the same hour, the REST API's own access token from yesterday stops being reused, and the next
connectissues a new one. - At 07:45 IST the instrument job downloads every broker's instrument list and maps them all onto one shared list of instruments. The unit's own comment puts this at about three quarters of an hour.
- At 08:30 IST, from Monday to Saturday, the unified price history job loads the brokers' candles into one table and refreshes the adjustment factors.
- From 09:00 IST the equity pre-open begins, and the unified quote layer starts accepting ticks, because its acceptance window opens at 09:00. NSE and BSE equity trades from 09:15 to 15:30.
- Through the day, the pollers and websocket scripts keep Redis up to date, the persisters copy every stream into TimescaleDB, and the unified scripts combine every broker into one view that the REST API serves.
- Commodity trading on MCX carries on into the evening and closes at 23:30 IST (23:55 while the United States is on standard time).
The diagram below shows the same day as three groups of work: the morning jobs that run once, the long-running services that run all day, and the stores and API they feed.
flowchart LR
subgraph Morning["Once a day"]
L["07:00<br/>broker logins"] --> M["07:45<br/>instrument mapping"]
M --> P["08:30<br/>unified price history"]
end
subgraph AllDay["All day, restarted if they stop"]
B["bin/<broker>/*<br/>feeds and pollers"] --> R[("Redis")]
R --> S["store_*_to_db<br/>persisters"] --> T[("TimescaleDB")]
R --> U["bin/unified/*<br/>combiners"] --> R
end
M --> R
R --> A["REST API<br/>unified-rest-api.service"]
Checking that everything is up
bin/check-services walks every unit in services/, reports what is down, and starts the long-running services that should be running. Add --check-only to report without starting anything. See Services.