Skip to content

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

docs/examples/scripts/

Complete, runnable Python scripts demonstrating specific functionality:

Jupyter Notebooks

docs/examples/notebooks/

Interactive Jupyter notebooks for learning and experimentation:

Getting Started

Prerequisites

Before running any examples, make sure you have:

  1. FiveTwenty installed: uv add fivetwenty
  2. OANDA API credentials: Get your API token
  3. Environment configured: Set your FIVETWENTY_OANDA_TOKEN and account details

Running Python Scripts

  1. Install FiveTwenty (if not already installed):

    uv add fivetwenty
    

  2. Locate examples directory:

    # Examples are included in your FiveTwenty installation
    # Find your site-packages directory:
    python -c "import fivetwenty; print(fivetwenty.__file__.replace('__init__.py', '../examples'))"
    

  3. Set up your environment:

    export FIVETWENTY_OANDA_TOKEN="your-practice-token"
    export FIVETWENTY_OANDA_ACCOUNT="your-account-id"
    export FIVETWENTY_OANDA_ENVIRONMENT="practice"
    

  4. Run any script:

    python path/to/examples/scripts/basic_usage.py
    

Running Jupyter Notebooks

  1. Install Jupyter:

    uv add jupyter
    

  2. Navigate to notebooks directory:

    # Find and navigate to the notebooks directory
    cd path/to/docs/examples/notebooks/
    

  3. Start Jupyter:

    jupyter notebook
    

  4. Open any notebook and follow the interactive instructions

Documentation Integration

Examples complement our structured documentation:

Contributing Examples

Found a bug or want to add an example?

  1. Report issues: See Contributing Guide for reporting guidelines
  2. Contribute examples: Contributing Guide
  3. Suggest improvements: Contributing Guide

Example Categories

By Skill Level

By Use Case


Remember: All examples use the practice environment by default for safe learning and testing!