Examples & Code Samples¶
This page provides access to comprehensive examples and code samples for FiveTwenty. All examples are included with your FiveTwenty installation in the docs/examples/ directory and are maintained to stay up-to-date with the latest SDK features.
Browse Examples Locally¶
All examples are organized into two categories in your FiveTwenty installation:
Python Scripts¶
Complete, runnable Python scripts demonstrating specific functionality:
basic_usage.py- Getting started with FiveTwentyaccount_management.py- Account operations and configurationconfiguration_patterns.py- Different ways to configure the clientsync_usage.py- Using the synchronous client wrapperpricing_and_candles.py- Market data and candlestick analysisadvanced_order_management.py- Complex order types and managementposition_management.py- Position tracking and managementtrade_management.py- Trade lifecycle managementtransaction_analysis.py- Transaction history and analysisenhanced_error_handling.py- Robust error handling patternsadvanced_features_demo.py- Advanced SDK features showcase
Jupyter Notebooks¶
Interactive Jupyter notebooks for learning and experimentation:
quick-start.ipynb- Quick start guide and basic operationstrading-strategies.ipynb- Strategy development and implementationstreaming-data.ipynb- Real-time data processing and streamingrisk-management.ipynb- Risk management techniques and toolsdata-analysis.ipynb- Market data analysis and visualizationbacktesting.ipynb- Strategy backtesting framework
Getting Started¶
Prerequisites¶
Before running any examples, make sure you have:
- FiveTwenty installed:
uv add fivetwenty - OANDA API credentials: Get your API token
- Environment configured: Set your
FIVETWENTY_OANDA_TOKENand account details
Running Python Scripts¶
-
Install FiveTwenty (if not already installed):
-
Locate examples directory:
-
Set up your environment:
-
Run any script:
Running Jupyter Notebooks¶
-
Install Jupyter:
-
Navigate to notebooks directory:
-
Start Jupyter:
-
Open any notebook and follow the interactive instructions
Documentation Integration¶
Examples complement our structured documentation:
- Tutorials - Step-by-step learning paths
- Guides - Comprehensive guidance and solutions
- API Reference - Complete API documentation
Contributing Examples¶
Found a bug or want to add an example?
- Report issues: See Contributing Guide for reporting guidelines
- Contribute examples: Contributing Guide
- Suggest improvements: Contributing Guide
Example Categories¶
By Skill Level¶
- Beginner:
basic_usage.py,quick-start.ipynb - Intermediate:
account_management.py,pricing_and_candles.py,trading-strategies.ipynb - Advanced:
advanced_features_demo.py,enhanced_error_handling.py,backtesting.ipynb
By Use Case¶
- Account Management:
account_management.py,configuration_patterns.py - Market Data:
pricing_and_candles.py,data-analysis.ipynb,streaming-data.ipynb - Trading:
advanced_order_management.py,position_management.py,trade_management.py - Analysis:
transaction_analysis.py,backtesting.ipynb,risk-management.ipynb - Integration:
sync_usage.py,enhanced_error_handling.py
Remember: All examples use the practice environment by default for safe learning and testing!