feat: Add core trading modules for risk management, backtesting, and execution algorithms, alongside a new ML transparency widget and related frontend dependencies.
Some checks are pending
Documentation / build-docs (push) Waiting to run
Tests / test (macos-latest, 3.11) (push) Waiting to run
Tests / test (macos-latest, 3.12) (push) Waiting to run
Tests / test (macos-latest, 3.13) (push) Waiting to run
Tests / test (macos-latest, 3.14) (push) Waiting to run
Tests / test (ubuntu-latest, 3.11) (push) Waiting to run
Tests / test (ubuntu-latest, 3.12) (push) Waiting to run
Tests / test (ubuntu-latest, 3.13) (push) Waiting to run
Tests / test (ubuntu-latest, 3.14) (push) Waiting to run

This commit is contained in:
2025-12-31 21:25:06 -05:00
parent 099432bf3f
commit 7bd6be64a4
743 changed files with 8617 additions and 5042 deletions

View File

@@ -1,11 +0,0 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
ignore:
- dependency-name: standard
versions:
- 16.0.3

View File

@@ -1,75 +0,0 @@
name: ci
on: [push, pull_request]
jobs:
legacy:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['0.10', '0.12', 4.x, 6.x, 8.x, 10.x, 12.x, 13.x, 14.x, 15.x, 16.x]
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: |
npm install --production && npm install tape
- name: Run tests
run: |
npm run legacy
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: |
npm install
- name: Run tests
run: |
npm run test
types:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install
run: |
npm install
- name: Run types tests
run: |
npm run typescript

View File

@@ -18,8 +18,6 @@ If you need zero-overhead series function call, check out
[fastseries](http://npm.im/fastseries). For zero-overhead parallel
function call, check out [fastparallel](http://npm.im/fastparallel).
[![js-standard-style](https://raw.githubusercontent.com/feross/standard/master/badge.png)](https://github.com/feross/standard)
* <a href="#install">Installation</a>
* <a href="#usage">Usage</a>
* <a href="#api">API</a>

View File

@@ -1,7 +1,5 @@
import { promise as queueAsPromised } from './queue.js'
/* eslint-disable */
const queue = queueAsPromised(worker, 1)
console.log('the result is', await queue.push(42))

View File

@@ -27,6 +27,8 @@ declare namespace fastq {
kill(): any
/** Same than `kill` but the `drain` function will be called before reset to empty. */
killAndDrain(): any
/** Removes all tasks waiting to be processed, calls each task's callback with an abort error (rejects promises for promise-based queues), and resets `drain` to an empty function. */
abort(): any
/** Set a global error handler. `handler(err, task)` will be called each time a task is completed, `err` will be not null if the task has thrown an error. */
error(handler: errorHandler<T>): void
/** Property that returns the number of concurrent tasks that could be executed in parallel. It can be altered at runtime. */

View File

@@ -1,10 +1,11 @@
{
"name": "fastq",
"version": "1.19.1",
"version": "1.20.1",
"description": "Fast, in memory work queue",
"main": "queue.js",
"type": "commonjs",
"scripts": {
"lint": "standard --verbose | snazzy",
"lint": "eslint .",
"unit": "nyc --lines 100 --branches 100 --functions 100 --check-coverage --reporter=text tape test/test.js test/promise.js",
"coverage": "nyc --reporter=html --reporter=cobertura --reporter=text tape test/test.js test/promise.js",
"test:report": "npm run lint && npm run unit:report",
@@ -34,20 +35,15 @@
"homepage": "https://github.com/mcollina/fastq#readme",
"devDependencies": {
"async": "^3.1.0",
"eslint": "^9.36.0",
"neo-async": "^2.6.1",
"neostandard": "^0.12.2",
"nyc": "^17.0.0",
"pre-commit": "^1.2.2",
"snazzy": "^9.0.0",
"standard": "^16.0.0",
"tape": "^5.0.0",
"typescript": "^5.0.4"
},
"dependencies": {
"reusify": "^1.0.4"
},
"standard": {
"ignore": [
"example.mjs"
]
}
}

37
frontend/node_modules/fastq/queue.js generated vendored
View File

@@ -53,7 +53,8 @@ function fastqueue (context, worker, _concurrency) {
empty: noop,
kill: kill,
killAndDrain: killAndDrain,
error: error
error: error,
abort: abort
}
return self
@@ -193,6 +194,40 @@ function fastqueue (context, worker, _concurrency) {
self.drain = noop
}
function abort () {
var current = queueHead
queueHead = null
queueTail = null
while (current) {
var next = current.next
var callback = current.callback
var errorHandler = current.errorHandler
var val = current.value
var context = current.context
// Reset the task state
current.value = null
current.callback = noop
current.errorHandler = null
// Call error handler if present
if (errorHandler) {
errorHandler(new Error('abort'), val)
}
// Call callback with error
callback.call(context, new Error('abort'))
// Release the task back to the pool
current.release(current)
current = next
}
self.drain = noop
}
function error (handler) {
errorHandler = handler
}

View File

@@ -289,3 +289,37 @@ test('drained should handle undefined drain function', async function (t) {
t.pass('drained resolved successfully with undefined drain')
})
test('abort rejects all pending promises', async function (t) {
const queue = buildQueue(worker, 1)
const promises = []
let rejectedCount = 0
// Pause queue to prevent tasks from starting
queue.pause()
for (let i = 0; i < 10; i++) {
promises.push(queue.push(i))
}
queue.abort()
// All promises should be rejected
for (const promise of promises) {
try {
await promise
t.fail('promise should have been rejected')
} catch (err) {
t.equal(err.message, 'abort', 'error message is abort')
rejectedCount++
}
}
t.equal(rejectedCount, 10, 'all promises were rejected')
t.equal(queue.length(), 0, 'queue is empty')
async function worker (arg) {
await sleep(500)
return arg
}
})

View File

@@ -651,3 +651,83 @@ test('paused flag', function (t) {
queue.pause()
t.equal(queue.paused, true)
})
test('abort', function (t) {
t.plan(11)
var queue = buildQueue(worker, 1)
var abortedTasks = 0
var predrain = queue.drain
queue.drain = function drain () {
t.fail('drain should never be called')
}
// Pause queue to prevent tasks from starting
queue.pause()
queue.push(1, doneAborted)
queue.push(4, doneAborted)
queue.unshift(3, doneAborted)
queue.unshift(2, doneAborted)
// Abort all queued tasks
queue.abort()
// Verify state after abort
t.equal(queue.length(), 0, 'no queued tasks after abort')
t.equal(queue.drain, predrain, 'drain is back to default')
setImmediate(function () {
t.equal(abortedTasks, 4, 'all queued tasks were aborted')
})
function doneAborted (err) {
t.ok(err, 'error is present')
t.equal(err.message, 'abort', 'error message is abort')
abortedTasks++
}
function worker (arg, cb) {
t.fail('worker should not be called')
setImmediate(function () {
cb(null, true)
})
}
})
test('abort with error handler', function (t) {
t.plan(7)
var queue = buildQueue(worker, 1)
var errorHandlerCalled = 0
queue.error(function (err, task) {
t.equal(err.message, 'abort', 'error handler receives abort error')
t.ok(task !== null, 'error handler receives task value')
errorHandlerCalled++
})
// Pause queue to prevent tasks from starting
queue.pause()
queue.push(1, doneAborted)
queue.push(2, doneAborted)
// Abort all queued tasks
queue.abort()
setImmediate(function () {
t.equal(errorHandlerCalled, 2, 'error handler called for all aborted tasks')
})
function doneAborted (err) {
t.ok(err, 'callback receives error')
}
function worker (arg, cb) {
t.fail('worker should not be called')
setImmediate(function () {
cb(null, true)
})
}
})