Use this file to discover Exa products, pricing, evaluations, comparisons, use cases, agent interfaces, and technical documentation before exploring further.
JavaScript dataframe libraries load tabular data into tables of named columns for filtering, grouping, and joining. Each transform returns a new table for the next step to read. These libraries prepare the data behind charts, dashboards, and reports in JavaScript apps and Node.js services.
Popularity
nodejs-polars has the most monthly downloads in this comparison, at 1.1M.
export function walkForwardOptimize<InputBarT extends IBar, IndicatorBarT extends InputBarT, ParameterT, IndexT>(
strategy: IStrategy<InputBarT, IndicatorBarT, ParameterT, IndexT>,
parameters: IParameterDef[],
objectiveFn: ObjectiveFn,
inputSeries: IDataFrame<IndexT, InputBarT>,
inSampleSize: number,
outSampleSize: number,
options?: IOptimizationOptions
): IOptimizationResult {
if (!isObject(strategy)) {
throw new Error("Expected 'strategy' argument to 'walkForwardOptimize' to be an object that defines the trading strategy for to do the walk-forward optimization.");
}
if (!isArray(parameters) || parameters.length <= 0) {
throw new Error("Expected 'parameters' argument to 'walkForwardOptimize' to be an array that specifies the strategy parameters that are to be optimized.");
}
if (!isFunction(objectiveFn)) {
throw new Error("Expected 'objectiveFn' argument to 'walkForwardOptimize' to be a function that computes an objective function for a set of trades.");
}
if (!isObject(inputSeries) && inputSeries.count() > 0) {
throw new Error("Expected 'inputSeries' argument to 'walkForwardOptimize' to be a Data-Forge DataFrame object that provides the input data for optimization.");
}
if (!isNumber(inSampleSize) || inSampleSize <= 0) {
throw new Error("Expected 'inSampleSize' argument to 'walkForwardOptimize' to be a positive number that specifies the amount of data to use for the in-sample data set (the training data).");
}
if (!isNumber(outSampleSize) || outSampleSize <= 0) {
throw new Error("Expected 'outSampleSize' argument to 'walkForwardOptimize' to be a positive number that specifies the amount of data to use for the out-of-sample data set (the testing data).");
}
if (!options) {
options = {};
}
else {
options = Object.assign({}, options); // Copy so we can change.
}
if (options.searchDirection === undefined) {
options.searchDirection = "max";
}
const random = new Random(options.randomSeed || 0);
let workingDataOffset = 0;
let trades: ITrade[] = []
while (true) {
const inSampleSeries = inputSeries.skip(workingDataOffset).take(inSampleSize).bake();
const outSampleSeries = inputSeries.skip(workingDataOffset+inSampleSize).take(outSampleSize).bake();
if (outSampleSeries.count() < outSampleSize) {
break; // No more data.
}
// // Choose a random seed for this iteration of optimziation. // options.randomSeed = random.getReal();
// // Optimize using in sample data. // const optimizeResult = optimize(strategy, parameters, objectiveFn, inSampleSeries, options);
// // Construct a strategy using the optimal parameter values. // const strategyClone = Object.assign({}, strategy);
strategyClone.parameters = Object.assign({}, strategy.parameters, optimizeResult.bestParameterValues);
// // Backtest optimized strategy on out of sample data. // const outSampleTrades = backtest(strategyClone, outSampleSeries);
// // Accumulate trades from out of sample data. // trades = trades.concat(outSampleTrades);
// // Move forward to the next out of sample section and repeat. // workingDataOffset += outSampleSize;
}
return {
trades: trades,
};
}
DataFrame-js
Provides an immutable, functional dataframe structure.
Downloads / mo
52.9K
Stars
459
Last release
1.4.4
License
MIT
Strengths
Works on rows and columns.Filter, join, and group rows through a SQL-inspired functional API.
Limitations
File features need Node.js.File system features are missing from the browser build.
import * as dfd from "danfojs";
const df = new dfd.DataFrame({ name: ["A", "B"], score: [1, 3] });
df.print();
FAQ
Arquero is a JavaScript library for query processing and transformation of array-backed data tables. Its verbs follow relational algebra, with filter, aggregation, window, join, and reshaping operations.
Danfo.js explicitly follows Pandas and provides a similar API.
Data-Forge queues iterator-based operations and evaluates them when results are required.Node Polars represents lazy computation graphs that can be collected into dataframes.