Making data react faster with Redis (optional)
External data your strategy reads arrives by **polling** by default. Adding Redis lets the agent wake the moment a new value lands and read it again right away. The values themselves always come from a database query — Redis only carries the "something new arrived" signal.
1. Which setup is yours
The publisher (your collector) and the subscriber (your agent) must be able to reach the same Redis. Any arrangement that satisfies that works.
Everything on one machine — self-hosted (simplest, free)
If the collector and the agent live on the same server, installing Redis there is the whole job. Nothing crosses the network, so it is the fastest option and the address never leaves the machine. The default config already listens on 127.0.0.1 only, so it is not exposed even without a password.
sudo apt install -y redis-server sudo systemctl enable --now redis-server redis-cli ping # PONG
redis://127.0.0.1:6379Several machines of your own — one host, private network
If collector and agent are on different servers, run Redis on one of them and let the others connect. Within the same cloud and region, connecting over the private IP is the safest choice. ★ Binding to 0.0.0.0 with no password gets found by internet scanners quickly. If you must go over the public network, use all three: a long password, a firewall rule, and TLS (rediss://).
# /etc/redis/redis.conf bind 10.0.0.5 127.0.0.1 # ★ 0.0.0.0 금지 requirepass <긴-무작위-비밀번호> # 방화벽: 내 서버 IP 만 6379 허용
redis://:비밀번호@10.0.0.5:6379The networks are separate — a managed free tier
When collector and agent sit somewhere that cannot reach each other (different clouds, home, office), put a managed Redis in between. Wake-ups store almost nothing, so free limits usually go a long way.
rediss://…Someone else publishes — teams and institutions sending directly
You do not have to use our collector. Any program can publish as long as it matches the channel name and payload shape. The channel is sori:data:v1: followed by the table name (schema stripped). The payload is only a cursor hint — even if you put values in it, they are not used; the woken side re-runs its own query.
PUBLISH sori:data:v1:fear_greed '{"v":1,"last":1757462400000,"n":1}'2. Turning it on — three places must line up
If any one of them is missing it falls back to polling **without an error**. The values stay correct and only latency grows, which makes it easy to miss that it never turned on.
Publisher — tell the collector the address
The collector publishes after it inserts new rows. With no address it skips publishing and says so in the run result.
# ~/soritrading-fetchers/.env SORI_WAKE_REDIS_URL=redis://127.0.0.1:6379
Subscriber — save the slot on the agent
Enter an alias and the address on the web, then press [Test connection] and that machine answers whether it actually connects. The address is stored only in that machine's keystore — it never reaches our servers and never appears in logs.
Declaration — which table listens on which slot
Lower on the same screen, under [Dataset declarations], switch the mode to redis and fill in the slot name and the table name. The table name is required because the channel name is derived from it.
mode: redis · redisAlias: main · tableName: fear_greed
- Redis is only a wake-up. Missing a message (an agent restart, say) does not corrupt anything — the next poll catches up.
- You cannot subscribe over a serverless provider's REST endpoint. Use the TCP address that starts with redis:// or rediss://.
- If a free tier drops idle connections you can quietly end up polling only. The agent detects the drop and reconnects, but frequent drops mean that tier is a poor fit for this.
- Slot names and database aliases are separate namespaces. Both being 'main' still means two different servers.
- The connection string is stored on the agent machine only. Our servers are not on this path and never receive the address, on save or on read.
- Deleting a slot does not cut an open subscription immediately; it ends at the next reconnect. Until then the values are the same, just faster.
All documentation — Eragileari buruzko informazioa