55 lines
3.1 KiB
Markdown
55 lines
3.1 KiB
Markdown
# Stock Bot
|
|
|
|
Bun/TypeScript workspaces for market-data collection, processing, APIs, and a React dashboard,
|
|
with a Rust native trading engine. `apps/wcag-ada` is an independent project and is not part of
|
|
the root workspace checks.
|
|
|
|
## Build and verify
|
|
|
|
Use Bun 1.2.17, Node.js 18 or newer, and a Rust toolchain with a native linker. CI uses Rust
|
|
1.88. Building and the tooling/contract checks do not require running databases or provider
|
|
credentials.
|
|
|
|
```sh
|
|
bun install --frozen-lockfile
|
|
bun run build
|
|
bun run check
|
|
```
|
|
|
|
The root build selects every buildable leaf workspace, including all stock services and the
|
|
native engine. `bun run build --dry=json` shows the actual Turbo task plan.
|
|
|
|
| Command | Scope |
|
|
| ------------------------ | ------------------------------------------------------------------------------------------- |
|
|
| `bun run build:libs` | Build shared libraries in dependency order |
|
|
| `bun run build --clean` | Force every workspace build without cached results |
|
|
| `bun run typecheck` | Check library, stock application, and tool source directly |
|
|
| `bun run test:contracts` | Compile positive and negative service-contract assertions |
|
|
| `bun run test:tooling` | Run workspace and service-consumer regression tests without infrastructure |
|
|
| `bun run lint:check` | Lint stock applications, libraries, and tools with zero warnings allowed |
|
|
| `bun run check` | Run build, type checking, contract tests, tooling tests, and lint; report every failed gate |
|
|
|
|
`check` exits nonzero if any gate fails. Existing application type/lint errors are reported;
|
|
they are not suppressed or baselined. The larger existing `bun run test` suite is separate:
|
|
some tests need databases, Redis, browsers, or native-engine fixes.
|
|
|
|
Native builds generate `apps/stock/engine/dist/engine.node` and `dist/index.d.ts`. The public
|
|
ESM/CommonJS loaders and declaration facade use those generated artifacts. Rebuild after
|
|
changing Rust APIs. TensorFlow is an optional orchestrator peer dependency used by the ML
|
|
strategy; install it when using that strategy.
|
|
|
|
## Service contracts
|
|
|
|
`@stock-bot/types` contains independent domain, job, and handler types.
|
|
`@stock-bot/services` composes service capabilities from the public APIs exported by the
|
|
owning adapters. It uses type-only imports and does not initialize connections.
|
|
|
|
```ts
|
|
import type { IServiceContainer, ServiceTypes } from '@stock-bot/services';
|
|
import type { ExecutionContext } from '@stock-bot/types';
|
|
```
|
|
|
|
The DI and handler packages re-export `IServiceContainer` for existing consumers. Queue
|
|
managers and individual queues are separate capabilities: obtain queues through
|
|
`container.queueManager`, submit with `queue.add`, and await results with `queue.waitForJob`.
|
|
Use `getFullQueueName(service, handler)` when addressing another service's queue.
|