The notebooks/ tree is not currently shipped in this repository. Use the
Python scripts under examples/
for runnable v4.0 samples.
The links below are historical placeholders and may 404 until notebooks are republished.
# Install Jupyter and dependencies
pip install jupyter notebook ipywidgets plotly pandas
# Install the SDK
pip install project-x-py[all]
Create a .env file in the notebooks directory:
PROJECT_X_API_KEY=your-api-key
PROJECT_X_USERNAME=your-username
# Clone the repository
git clone https://github.com/TexasCoding/project-x-py.git
cd project-x-py/notebooks
# Start Jupyter
jupyter notebook
# Always use paper trading for testing
suite = await TradingSuite.create(
["MNQ"],
mode="paper" # Paper trading mode
)
# Clean up resources in notebooks
try:
# Your trading code here
pass
finally:
await suite.disconnect()
# Use nest_asyncio for async support
import nest_asyncio
nest_asyncio.apply()
# Now you can use await directly
suite = await TradingSuite.create(["MNQ"])
We welcome notebook contributions! Please ensure:
# Cell 1: Setup
import asyncio
import nest_asyncio
from project_x_py import TradingSuite
import plotly.graph_objects as go
import pandas as pd
nest_asyncio.apply()
# Cell 2: Connect
suite = await TradingSuite.create(
["MNQ"],
timeframes=["1min", "5min"],
features=["orderbook"]
)
# Cell 3: Analysis
# Your strategy or analysis code
# Cell 4: Visualization
fig = go.Figure(data=[
go.Candlestick(
x=df['timestamp'],
open=df['open'],
high=df['high'],
low=df['low'],
close=df['close']
)
])
fig.show()
# Cell 5: Cleanup
await suite.disconnect()
All notebooks are provided under the MIT License. Use at your own risk for educational purposes only.