An open API service indexing awesome lists of open source software.

https://github.com/jozefrudy/trading-rule-parser

Trading DSL with real-time TypeScript validation and AST parsing
https://github.com/jozefrudy/trading-rule-parser

angular ast-parser codemirror6 f-sharp fparsec strategy-validation trading-dsl trading-strategies typescript

Last synced: 3 months ago
JSON representation

Trading DSL with real-time TypeScript validation and AST parsing

Awesome Lists containing this project

README

        

Code parser example used by [cryptoquant](https://cryptoquant.dev) in v1.

It consists of `angular` frontend app with `codemirror6` code editor with live `typescript` intellisense served on frontend.
Trading DSL is a subset of typescript. Only valid typescript after validating on frontend is sent to backend.

Backend contains AST and AST parser in `f#` that validates strategy received from frontend.
There is an indication below code editor on frontend showing if strategy is valid (it is valid only if it's valid typescript and was validated by backend as well).

To run this, you need both `pnpm` and `dotnet 9`. Ports are pre-configured in both services `3000` for frontend and `3001` for backend.

```bash frontend
cd frontent-angular
pnpm start
```

```bash backend
cd backend-parser/api
dotnet run
```

![output](https://github.com/user-attachments/assets/f59fa372-2483-48ce-b166-659f23c4922d)

Editor expects these variables to be defined: `entry`, `exit`, `universe`, `name`, `start`, `mode`.

For development I recommend opening both projects in the same editor, jetbrains rider works well for this.