Add Strike ticker poller, Docker .env config, and Frankfurter retry logic
- Poll Strike API every 10s, store all rates as JSONB in strike_price table - Move Docker env vars to .env file, use shared network for cross-project communication - Add startup retry (5x 5s) for Frankfurter poller to handle container race condition Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1 @@
|
||||
DROP TABLE strike_price;
|
||||
@@ -0,0 +1,5 @@
|
||||
CREATE TABLE strike_price (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
rates JSONB NOT NULL,
|
||||
recorded_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
@@ -42,3 +42,11 @@ SET open = EXCLUDED.open,
|
||||
-- :name get-latest-kraken-day :? :1
|
||||
-- :doc Get the most recent Kraken daily candle by timestamp
|
||||
SELECT ts FROM kraken_day ORDER BY ts DESC LIMIT 1
|
||||
|
||||
-- :name insert-strike-price! :! :n
|
||||
-- :doc Insert a Strike ticker snapshot
|
||||
INSERT INTO strike_price (rates) VALUES (:rates)
|
||||
|
||||
-- :name get-latest-strike-price :? :1
|
||||
-- :doc Get the most recent Strike ticker snapshot
|
||||
SELECT rates, recorded_at FROM strike_price ORDER BY id DESC LIMIT 1
|
||||
|
||||
@@ -60,4 +60,8 @@
|
||||
{:query-fn #ig/ref :db.sql/query-fn}
|
||||
|
||||
:frankfurter/rates
|
||||
{:url #or [#env FRANKFURTER_URL "http://localhost:8080"]}}
|
||||
{:url #or [#env FRANKFURTER_URL "http://localhost:8080"]}
|
||||
|
||||
:strike/ticker
|
||||
{:query-fn #ig/ref :db.sql/query-fn
|
||||
:api-key #env STRIKE_API_KEY}}
|
||||
|
||||
Reference in New Issue
Block a user