|
| 1 | +# GROK.md |
| 2 | + |
| 3 | +This file provides guidance to Grok CLI (x.ai/grok) when assisting with file editing, coding tasks, and system operations in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | +This is a Python SDK/client library for the ProjectX Trading Platform Gateway API. It enables developers to build trading strategies with access to real-time market data, order management, and analysis using Polars for high-performance data processing. |
| 7 | + |
| 8 | +**Note**: Focus on toolkit development, not on creating trading strategies. |
| 9 | + |
| 10 | +## Tool Usage Guidelines |
| 11 | +As Grok CLI, you have access to tools like view_file, create_file, str_replace_editor, bash, search, and todo lists. Use them efficiently for tasks. |
| 12 | + |
| 13 | +- **ALWAYS** create a todo list for complex tasks. |
| 14 | +- **NEVER** overwrite existing files with create_file; use str_replace_editor. |
| 15 | +- **ALWAYS** view files before editing. |
| 16 | +- For searches, use the search tool or bash commands like grep. |
| 17 | + |
| 18 | +## Development Commands |
| 19 | +Use bash tool to execute these: |
| 20 | + |
| 21 | +### Package Management (UV) |
| 22 | +uv add [package] # Add a dependency |
| 23 | +uv add --dev [package] # Add a development dependency |
| 24 | +uv sync # Install/sync dependencies |
| 25 | +uv run [command] # Run command in virtual environment |
| 26 | + |
| 27 | +### Testing |
| 28 | +uv run pytest # Run all tests |
| 29 | +uv run pytest tests/test_client.py # Run specific test file |
| 30 | + |
| 31 | +### Code Quality |
| 32 | +uv run ruff check . # Lint code |
| 33 | +uv run ruff check . --fix # Auto-fix linting issues |
| 34 | +uv run ruff format . # Format code |
| 35 | +uv run mypy src/ # Type checking |
| 36 | + |
| 37 | +## Project Architecture |
| 38 | +Refer to CLAUDE.md for details, but when editing: |
| 39 | +- Use dependency injection in clients and managers. |
| 40 | +- Handle real-time data with WebSockets. |
| 41 | +- Ensure thread safety with locks. |
| 42 | + |
| 43 | +## Coding Rules for Edits |
| 44 | +When using str_replace_editor: |
| 45 | +- **ALWAYS** use modern Python 3.10+ features. |
| 46 | +- **PREFER** Polars over Pandas. |
| 47 | +- **ALWAYS** add type hints using | for unions. |
| 48 | +- **HANDLE** errors with custom exceptions. |
| 49 | + |
| 50 | +## Performance Considerations |
| 51 | +- Implement memory management in edits (e.g., sliding windows). |
| 52 | +- Optimize DataFrame operations with chaining and lazy evaluation. |
| 53 | + |
| 54 | +## Integration with ProjectX API |
| 55 | +- Use configurable endpoints. |
| 56 | +- Validate payloads strictly. |
| 57 | +- Map enums correctly. |
| 58 | + |
| 59 | +For any updates, ensure consistency with .cursorrules and CLAUDE.md. |
| 60 | + |
0 commit comments