JSON parsing and data transformation utilities.
JSON parsing and data transformation utilities.
(->epoch x)Convert Instant or long to epoch seconds. Returns nil for nil input.
Convert Instant or long to epoch seconds. Returns nil for nil input.
(build-query m)Build URL query string from a map, removing nil values and encoding keys/values.
Build URL query string from a map, removing nil values and encoding keys/values.
(camel->kebab k)Convert camelCase key to kebab-case. Handles special cases via key-exceptions map.
Convert camelCase key to kebab-case. Handles special cases via key-exceptions map.
(chart->rows {:keys [timestamp indicators]} {:keys [auto-adjust]})Build OHLCV row maps from a chart result's :timestamp and :indicators. Pure function for testing.
When auto-adjust is true, :open/:high/:low/:close are scaled by the
adjclose/close ratio of each row, so the whole OHLC series is adjusted for
dividends as well as splits (python-yfinance's auto_adjust=True). Rows whose
adjclose is missing, or whose close is not positive, are left unadjusted.
:adj-close is included whenever the row has an adjclose value (so under
auto-adjust it equals :close).
Build OHLCV row maps from a chart result's :timestamp and :indicators. Pure function for testing. When `auto-adjust` is true, :open/:high/:low/:close are scaled by the adjclose/close ratio of each row, so the whole OHLC series is adjusted for dividends as well as splits (python-yfinance's auto_adjust=True). Rows whose adjclose is missing, or whose close is not positive, are left unadjusted. :adj-close is included whenever the row has an adjclose value (so under auto-adjust it equals :close).
(chart-events chart-result)Dividend and split events of a chart result (requested with events=div|split), as {:dividends {...} :splits {...}}: Yahoo's maps keyed by keywordized epoch strings, empty when there are none. Pure function for testing.
Dividend and split events of a chart result (requested with
events=div|split), as {:dividends {...} :splits {...}}: Yahoo's maps keyed by
keywordized epoch strings, empty when there are none. Pure function for
testing.(chart-meta chart-result)Identity and exchange fields of a chart result's :meta, kebab-cased (:exchange-timezone-name, :gmt-offset, :first-trade-date, ...). Fields Yahoo leaves out are absent. Pure function for testing.
Identity and exchange fields of a chart result's :meta, kebab-cased (:exchange-timezone-name, :gmt-offset, :first-trade-date, ...). Fields Yahoo leaves out are absent. Pure function for testing.
(encode-path-segment s)URL-encode a path segment (e.g., ticker symbol).
URL-encode a path segment (e.g., ticker symbol).
(kebabize-keys m)Convert all keys in map from camelCase to kebab-case.
Convert all keys in map from camelCase to kebab-case.
(parse-chart-body json-string)Parse JSON response body into chart data or error. Pure function for testing.
Parse JSON response body into chart data or error. Pure function for testing.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |