Metadata-Version: 2.4
Name: ip4-submitter
Version: 1.0.1
Summary: A CLI submitter for the IMC Prosperity 4 competition
Project-URL: Homepage, https://github.com/monoclonalAb/ip4-submitter
Author-email: Eric Zheng <eric.zheng@outlook.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.13
Requires-Dist: jsonpickle>=4.1.1
Requires-Dist: keyring>=25.7.0
Requires-Dist: pandas>=3.0.2
Requires-Dist: pyperclip>=1.11.0
Requires-Dist: requests-toolbelt>=1.0.0
Requires-Dist: requests>=2.32.0
Requires-Dist: typer>=0.24.1
Description-Content-Type: text/markdown

# ip4-submitter

A CLI tool for submitting and evaluating trading algorithms in the [IMC Prosperity 4](https://prosperity.imc.com) competition. Submit your algorithm, monitor its progress, and download results — all from the terminal.

## Installation

```bash
pip install ip4-submitter
```

## Quick Start

```bash
# 1. Copy your token to clipboard (see Authentication below), then:
ip4submitter auth

# 2. Submit your algorithm and wait for results
ip4submitter submit algo.py
```

That's it. The tool uploads your file, waits for the backtest to finish, and saves the result log to `submissions/<id>.log`.

## Commands

| Command | Description |
|---------|-------------|
| `ip4submitter auth` | Save your session token from clipboard |
| `ip4submitter submit <file>` | Submit an algorithm and download results |
| `ip4submitter history` | List all submissions for the current round |
| `ip4submitter download` | Download logs for a past submission |
| `ip4submitter guide` | Show a detailed usage guide in the terminal |

## Usage

### Submit an algorithm

```bash
ip4submitter submit my_algo.py

# Save logs to a custom directory
ip4submitter submit my_algo.py --output results/
```

### View submission history

```bash
ip4submitter history
```

### Download logs

```bash
# Download the most recent submission
ip4submitter download

# Download a specific submission by ID
ip4submitter download --id 46284

# Download to a custom directory
ip4submitter download --filepath results/
```

## Development

If you want to modify the tool locally:

```bash
# Clone the repo
git clone https://github.com/monoclonalAb/ip4-submitter.git
cd ip4-submitter

# Install dependencies with uv
uv sync

# Run the CLI locally
uv run ip4submitter --help

# Build the package
uv build
```

## Authentication

Your token is stored securely in your system's credential store (macOS Keychain, Windows Credential Manager, or Linux secret store).

### Option A — Bookmarklet (recommended)

1. Create a new browser bookmark and set its URL to:

```
javascript:void function(){if("prosperity.imc.com"!==window.location.hostname)alert("This bookmarklet should only be used on prosperity.imc.com");else{const c=document.cookie.split(";").map(c=>c.trim()).find(c=>/\.idToken=/.test(c));c===undefined?alert("ID token not found, are you sure you are logged in?"):(navigator.clipboard.writeText(c.split("=").slice(1).join("=")),alert("Successfully copied ID token to clipboard!"))}}();
```

2. Navigate to [prosperity.imc.com](https://prosperity.imc.com) while logged in
3. Click the bookmark — your token is copied to your clipboard
4. Run `ip4submitter auth`

### Option B — Manual extraction

1. Go to [prosperity.imc.com](https://prosperity.imc.com) and log in
2. Press **F12** to open developer tools
3. Open the **Application** tab (Chrome) or **Storage** tab (Firefox)
4. Select **Local Storage** → the Prosperity site
5. Copy the value for the key matching `CognitoIdentityServiceProvider.<id>.<email>.idToken`
6. Run `ip4submitter auth`
