Model Submission Docs

Learn how to structure and submit your TradingModel code with customizable run parameters.

Docs

Our Pipeline, Step-by-Step

Here's how your submitted model flows through our system:

Model Upload

You submit your model.py along with metadata. The file is safely stored in S3, while metadata is recorded for indexing and future reference.

Structure Validation

We dynamically load and inspect your TradingModel. We confirm that run() is defined correctly and that the output matches our required structure.

Parameterized Test Runs

We call run() multiple times with different parameters—like varying symbols, actions, or quantities—to ensure your model can handle a range of scenarios.

Optional Backtesting

If enabled, we fetch historical data (e.g., via yfinance) and simulate trades over a historical timeframe. This lets us calculate profit/loss, win rates, and other performance metrics to understand how your model might perform in real markets.

Results & Visualization

The performance results and validation findings are stored and can be displayed on the website. You and your users can see charts, graphs, or tables representing how the model behaves under various conditions.

Updated Requirements

Your model file (e.g., model.py) must define a class named TradingModel that includes a run() method. Unlike the previous specification, run() now takes in arguments corresponding to the fields in the returned JSON.

For example:

1def run(
2    self,
3    instrument_type: str,
4    symbol: str,
5    action: str,
6    quantity: int,
7    price: float = None,
8    option_type: str = None,
9    strike_price: float = None,
10    expiration_date: str = None
11) -> dict:

When the system calls run(), it will provide these parameters. Your method should use them as "suggestions" to form the final return dictionary.

Return Structure

The run() method should return a dictionary with this format:

1{
2  "instrument_type": "stock" | "option" | "crypto",
3  "symbol": "AAPL" | "BTCUSD" | "...",
4  "action": "buy" | "sell",
5  "quantity": 10,
6  "price": 175.00,          # Optional if market order
7  "option_type": "call" | "put",   # Required if instrument_type=option
8  "strike_price": 180.00,          # Required if instrument_type=option
9  "expiration_date": "YYYY-MM-DD"  # Required if instrument_type=option
10}

Your model can modify these values based on ML logic, heuristics, or external configuration before returning them. The parameters passed into run() are not fixed and can change depending on the scenario.

Example TradingModel Class

1class TradingModel:
2    def run(
3        self,
4        instrument_type: str,
5        symbol: str,
6        action: str,
7        quantity: int,
8        price: float = None,
9        option_type: str = None,
10        strike_price: float = None,
11        expiration_date: str = None
12    ) -> dict:
13        # Validate or adjust inputs here
14        # For demonstration, return them as is:
15        result = {
16            "instrument_type": instrument_type,
17            "symbol": symbol,
18            "action": action,
19            "quantity": quantity
20        }
21        if price is not None:
22            result["price"] = price
23        if instrument_type == "option":
24            if not option_type or not strike_price or not expiration_date:
25                raise ValueError("Option trades require option_type, strike_price, and expiration_date.")
26            result["option_type"] = option_type
27            result["strike_price"] = strike_price
28            result["expiration_date"] = expiration_date
29
30        return result
31

Uploading Your Model

Navigate to the Submit Model page and provide your model file along with required metadata: model name, description, category, version, and keywords.

After submission:

  • Your file is uploaded to S3.
  • Metadata is recorded for indexing.
  • The system loads and runs your model with a given set of parameters.
  • It inspects the returned dictionary to confirm the structure and validity.

Tech Stack

Our platform leverages a modern, scalable tech stack:

  • Frontend: Next.js & TypeScript
  • Backend: FastAPI in Python
  • Storage: Amazon S3
  • Sandboxing: Docker or micro-VMs
  • CI/CD: GitHub Actions or similar tools