diff --git a/docs/classes/DateAlignmentError.html b/docs/classes/DateAlignmentError.html index ff46220..8a4a4ba 100644 --- a/docs/classes/DateAlignmentError.html +++ b/docs/classes/DateAlignmentError.html @@ -1,11 +1,11 @@ -
OptionalstackStaticstackThe Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
@@ -29,4 +29,4 @@
OptionalconstructorOpt: FunctionStaticprepareOptionalstackStaticstackThe Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
@@ -29,4 +29,4 @@
OptionalconstructorOpt: FunctionStaticprepareOptionalstackStaticstackThe Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
@@ -29,4 +29,4 @@
OptionalconstructorOpt: FunctionStaticprepareOptionalstackStaticstackThe Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
@@ -29,4 +29,4 @@
OptionalconstructorOpt: FunctionStaticprepareOptionalstackStaticstackThe Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
@@ -29,4 +29,4 @@
OptionalconstructorOpt: FunctionStaticprepareCollection of aligned timeseries with portfolio and correlation methods.
-Collection of aligned timeseries with portfolio and correlation methods.
+Optionaloptions: { countries?: string | string[] }Country code(s) for business calendar (holidays, resampling). Used when adapting data to business days.
-CAGR-based capture ratio vs benchmark column. +
Optionaloptions: { countries?: string | string[] }Country code(s) for business calendar (holidays, resampling). Used when adapting data to business days.
+CAGR-based capture ratio vs benchmark column. Matches Python openseries capture_ratio_func behavior: uses frame data as-is (no resample) with dynamic time_factor = observations / (span_days/365.25).
"up" | "down" | "both" (up/down or both = up/down)
Benchmark column index (-1 = last)
Optionalopts: { freq?: ResampleFreq }Optionalfreq?: ResampleFreqIf set, resample to period-end before computing (e.g. "ME" for monthly). When omitted, uses frame data as-is to match Python default.
-Filters tsdf to retain only business days. Mutates in place.
-OptionalweightStrat: LiteralPortfolioWeightingsMax drawdown per column (price series). Returns array of max drawdowns.
-Date when max drawdown bottom occurs per column. +
Filters tsdf to retain only business days. Mutates in place.
+OptionalweightStrat: LiteralPortfolioWeightingsMax drawdown per column (price series). Returns array of max drawdowns.
+Date when max drawdown bottom occurs per column. Returns array of date strings (or undefined when no drawdown).
-Ordinary Least Squares fit of y on x. +
Ordinary Least Squares fit of y on x. Regresses tsdf column yColumn (dependent) on xColumn (explanatory). Matches Python openseries ord_least_squares_fit.
Column index of dependent variable y
Column index of exogenous variable x
Optionalopts: { fittedSeries?: boolean }OptionalfittedSeries?: booleanIf true, add fitted values as new column (default true)
Object with coefficient (slope), intercept, and rsquared
-Resamples all constituents to business period-end frequency, then re-merges. +
Resamples all constituents to business period-end frequency, then re-merges. Throws if any constituent is a return series.
-Returns return columns (first element 0). Throws if mixed PRICE/RTRN.
-Converts each column to drawdown series (value / running peak - 1). +
Returns return columns (first element 0). Throws if mixed PRICE/RTRN.
+Converts each column to drawdown series (value / running peak - 1). Operates on the frame's aligned tsdf. Call after mergeSeries and truncate so drawdown is computed on the truncated date range.
-Optional_opts: { fromDate?: string; toDate?: string }Optional_opts: { fromDate?: string; toDate?: string }Truncates frame and constituents to a common date range.
Truncation options
OptionalendCut?: stringNew last date (default: earliest last date if where includes 'after')
OptionalstartCut?: stringNew first date (default: latest first date of all constituents if where includes 'before')
Optionalwhere?: "before" | "after" | "both"Which end(s) to truncate when cuts not provided
-Timeseries of dates and values with methods for risk metrics.
-Timeseries of dates and values with methods for risk metrics.
+Country code(s) for business calendar (holidays, resampling). Default "SE".
-ReadonlydatesReadonlyinstrumentReadonlynameReadonlytimeseriesReadonlyvaluesFilters tsdf to retain only business days. Mutates in place.
-Returns the date when the max drawdown bottom occurs (the date of the lowest point +
Country code(s) for business calendar (holidays, resampling). Default "SE".
+ReadonlydatesReadonlyinstrumentReadonlynameReadonlytimeseriesReadonlyvaluesFilters tsdf to retain only business days. Mutates in place.
+Returns the date when the max drawdown bottom occurs (the date of the lowest point relative to the preceding peak). Returns undefined if no drawdown occurs.
-Resamples to business period-end frequency (week, month, quarter, year). +
Resamples to business period-end frequency (week, month, quarter, year). Mutates tsdf. Throws on return series (use price series).
-OptionallvlZero: stringOptionallvlOne: ValueTypeWorst single calendar month return (business-month-end based). +
OptionallvlZero: stringOptionallvlOne: ValueTypeWorst single calendar month return (business-month-end based). Uses filterToBusinessDays + resampleToPeriodEnd(ME) + min of monthly returns.
-StaticfromCreates an OpenTimeSeries from a name, dates array, and values array.
-Optionaloptions: {StaticfromCreates an OpenTimeSeries from simulation dateColumns by column index.
-Optionaloptions: { columnIndex?: number; countries?: string | string[]; valuetype?: ValueType }StaticfromCreates an OpenTimeSeries from a record or array of {date, value}.
-StaticfromCreates an OpenTimeSeries from a name, dates array, and values array.
+Optionaloptions: {StaticfromCreates an OpenTimeSeries from simulation dateColumns by column index.
+Optionaloptions: { columnIndex?: number; countries?: string | string[]; valuetype?: ValueType }StaticfromCreates an OpenTimeSeries from a record or array of {date, value}.
+OptionalstackStaticstackThe Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
@@ -29,4 +29,4 @@
OptionalconstructorOpt: FunctionStaticprepareMonte Carlo return simulation with optional seed for reproducibility.
-Monte Carlo return simulation with optional seed for reproducibility.
+ReadonlydframeReadonlyjumpsReadonlyjumpsReadonlyjumpsReadonlymeanReadonlymeanReadonlynumberOptional ReadonlyseedReadonlytradingReadonlytradingOptionaloptions: { asReturns?: boolean; end?: string; start?: string }StaticfromOptionalseed: numberStaticfromOptionalseed: numberStaticfromOptionalseed: numberStaticfromOptionalseed: numberReadonlydframeReadonlyjumpsReadonlyjumpsReadonlyjumpsReadonlymeanReadonlymeanReadonlynumberOptional ReadonlyseedReadonlytradingReadonlytradingOptionaloptions: { asReturns?: boolean; end?: string; start?: string }StaticfromOptionalseed: numberStaticfromOptionalseed: numberStaticfromOptionalseed: numberStaticfromOptionalseed: numberComputes the mean-variance efficient frontier using analytic QP.
-Computes the mean-variance efficient frontier using analytic QP.
+Fetches a single timeseries from the Captor Open API.
+Fetches a single timeseries from the Captor Open API.
The timeseries ID (e.g. "638f681e0c2f4c8d28a13392")
The timeseries data with dates and values arrays
-Fetches multiple timeseries from the Captor Open API.
+Fetches multiple timeseries from the Captor Open API.
Array of timeseries IDs
Array of timeseries data
-Filters an array of date strings to keep only business days. +
Filters an array of date strings to keep only business days. Business day = not weekend (Sat/Sun) and not a holiday in any of the specified countries.
Array of date strings (YYYY-MM-DD)
Country code(s) for holiday calendar, e.g. "SE", "US", ["SE", "NO"]
Array of business-day date strings (subsequence of input, preserving order)
-Filters (dates, columns) to retain only rows where the date is a business day. +
Filters (dates, columns) to retain only rows where the date is a business day. Preserves alignment across all columns.
-Returns the most recent business day strictly before today. +
Returns the most recent business day strictly before today. Uses the given country code(s) for holiday calendar (e.g. "SE" for XSTO/Stockholm).
-Generate full-page series plot HTML, write to file, and optionally open in browser. +
Generate full-page series plot HTML, write to file, and optionally open in browser. Analogous to Python plot_series with auto_open.
OpenTimeSeries or OpenFrame (use mergeSeries("inner") for frame)
Title, filename, autoOpen
Path to the written HTML file
-Generate full-page HTML with a line chart of the series (or multiple series). +
Generate full-page HTML with a line chart of the series (or multiple series). Plots cumulative returns (base 1). Percent display is formatting only. Works with OpenTimeSeries or OpenFrame. For OpenFrame, use mergeSeries("inner") first.
OpenTimeSeries or OpenFrame
Optional title
HTML string
-Prepares labeled points for the efficient-frontier chart: individual assets, +
Prepares labeled points for the efficient-frontier chart: individual assets, current (e.g. eq-weight) portfolio, and the max-Sharpe optimum.
-Generate HTML report from an OpenFrame. +
Generate HTML report from an OpenFrame. Analogous to Python openseries report_html(data: OpenFrame, ...). The frame should have mergeSeries("inner") already applied.
Requires at least 2 constituents: the first N-1 are compared against the last @@ -8,4 +8,4 @@
Report options (title, logo). Countries come from frame.countries.
HTML string
Resamples dates and columns to end-of-business period frequency. +
Resamples dates and columns to end-of-business period frequency. Each period takes the last observation that falls on a business day within that period.
Sorted array of date strings
Value columns (same length as dates)
WE (week-end), ME (month-end), QE (quarter-end), YE (year-end)
Country code(s) for holiday filtering
-Writes efficient-frontier HTML to file and optionally opens in browser.
-Writes efficient-frontier HTML to file and optionally opens in browser.
+Generates full-page HTML with efficient frontier scatter plot. +
Generates full-page HTML with efficient frontier scatter plot. Simulated portfolios colored by Sharpe ratio, frontier as line, labeled points.
-Simulates random long-only portfolios from frame returns and covariance.
-Simulates random long-only portfolios from frame returns and covariance.
+Chains two timeseries at their overlap. Scales back by front's level at the overlap date.
-Chains two timeseries at their overlap. Scales back by front's level at the overlap date.
+Tools for analyzing financial timeseries of a single asset or a group of assets. Designed for daily or less frequent data. TypeScript port of the @@ -133,6 +133,10 @@
npm run docs
docs/ (TypeDoc)npm publishnpm run compare-metrics
npm run compare-metrics -- --decimals=6
-Result of Ordinary Least Squares regression (ord_least_squares_fit).
-Result of Ordinary Least Squares regression (ord_least_squares_fit).
+OptionaladdIf true, show logo in upper left. Default: true.
-OptionalasIf true, data is drawdown series (0 to negative decimals). Plot raw values * 100 as %, skip cumulative conversion.
-OptionalautoIf true, open the HTML file in the default browser. Default: true.
-OptionalfilenameOutput file path. Default: ~/Documents/plot.html (or ~/ if Documents missing).
-OptionallogoLogo URL (e.g. company logo). Shown in upper left when addLogo is true.
-OptionaltitleOptional title above the chart.
-OptionalasIf true, data is drawdown series (0 to negative decimals). Plot raw values * 100 as %, skip cumulative conversion.
+OptionalautoIf true, open the HTML file in the default browser. Default: true.
+OptionalfilenameOutput file path. Default: ~/Documents/plot.html (or ~/ if Documents missing).
+OptionallogoLogo URL (e.g. company logo). Shown in upper left when addLogo is true.
+OptionaltitleOptional title above the chart.
+Point on the efficient-frontier plot (stdev and ret in decimal form).
-Options to slice a series by date range.
-Options to slice a series by date range.
+
The
Error.stackTraceLimitproperty specifies the number of stack frames +