Jupyter Setup Guide
· 2 min read
This guide explains how to use Jupyter notebooks within the TON Arcana monorepo, specifically for the Mercury TA service.
Directory Structure
apps/mercury-ta/
├── notebooks/ # Jupyter notebooks directory
│ ├── examples/ # Example notebooks
│ ├── research/ # Research and analysis notebooks
│ └── production/ # Production-ready notebooks
├── src/ # Main source code
└── tests/ # Tests
Setup
- Install Python dependencies:
cd apps/mercury-ta
pnpm install
pip install jupyter ipykernel notebook pandas numpy matplotlib seaborn
python -m ipykernel install --user --name mercury-ta
- Configure VS Code:
- Install required extensions:
- Jupyter (ms-toolsai.jupyter)
- Python (ms-python.python)
- Jupyter Keymap (ms-toolsai.jupyter-keymap)
- Jupyter Renderers (ms-toolsai.jupyter-renderers)
- Start working:
cd apps/mercury-ta
code notebooks/examples/getting_started.ipynb
Best Practices
-
Directory Organization
- Keep notebooks in appropriate subdirectories:
examples/: Tutorial and example notebooksresearch/: Analysis and research notebooksproduction/: Production-ready notebooks
- Keep notebooks in appropriate subdirectories:
-
Code Structure
- Use relative imports from the project
- Import project modules using:
import sys
from pathlib import Path
sys.path.append(str(Path.cwd().parent))
from src.your_module import your_function
-
Environment
- Always use the project's virtual environment
- Document dependencies in
requirements.txt - Keep notebooks clean by clearing outputs before committing
-
Version Control
- Clear cell outputs before committing
- Use
.gitignorefor.ipynb_checkpoints/ - Add meaningful commit messages
-
Documentation
- Start notebooks with a markdown cell describing purpose
- Document data sources and preprocessing steps
- Include example outputs and visualizations
Keyboard Shortcuts
Shift+Enter: Run cell and move to nextCtrl+Enter: Run cell and stayAlt+Enter: Run cell and insert belowCtrl+Shift+P: Command palette- "Jupyter: Create New Blank Notebook"
- "Jupyter: Change Kernel"
Integration with Mercury TA
Notebooks can access all Mercury TA functionality:
from src.services.technical_analysis import TechnicalAnalysisService
from src.services.market_data import MarketDataService
# Initialize services
ta_service = TechnicalAnalysisService()
market_data = MarketDataService()
# Use in analysis
data = market_data.get_historical_data('BTCUSDT', '1d')
analysis = ta_service.analyze(data)
Example Notebooks
examples/getting_started.ipynb: Basic setup and usageexamples/technical_analysis.ipynb: TA indicators and strategiesresearch/market_analysis.ipynb: Market research templates
