Stock Script

A clean and intuitive DSL for modeling, merging, and analyzing stocks.

Get Started

What is Stock Script?

Stock Script is a domain-specific language designed to help you declare stocks, manipulate their attributes, and perform operations like splits and merges—all with a simple, human-readable syntax. It's perfect for financial modeling, educational purposes, or just experimenting with stock-like entities in a controlled environment.

Key Features

Example

stock AAPL {
    price: 150.50;
    shares: 100;
}

stock MSFT {
    price: 87.00;
    shares: 250;
}

display AAPL;
AAPL.merge(MSFT);
display AAPL;
AAPL.split(2);
display AAPL.shares;
            

In this example, we define two stocks and merge MSFT into AAPL, then perform a 2-for-1 split on AAPL. The display commands show you how the changes affect price, shares, and market cap.

Getting Started

  1. Install textX
  2. Clone the stock-script interpreter repository.
  3. Write your .stock scripts and run them with the interpreter.

For detailed instructions, visit the GitHub repository.