Thanks to visit codestin.com
Credit goes to github.com

Skip to content

This repository contains the implementation of automated bot which trades on Oanda API according to Open Breakout Stragtegy(ORB).

Notifications You must be signed in to change notification settings

P1YU5H-50N1/ORBitrage

Repository files navigation

ORBitrage

Overview

This repository contains an automated trading bot that connects to the OANDA v20 API. It implements an Opening Range Breakout (ORB) strategy. The bot streams real-time pricing data for specified currency pairs, generates trading signals based on a breakout strategy, and executes market orders accordingly. By default, it trades the following instruments: EUR/DKK, XAU/CHF, and XPD/USD. The application is designed to be configurable and extensible for different trading strategies and instruments.

Tech Stack

  • Language: Python 3.8
  • API: OANDA v20 API
  • Core Libraries:
    • v20: The official Python wrapper for the OANDA v20 REST API.
    • pandas: Used for data manipulation and analysis, particularly for handling time-series data.
    • numpy: For numerical operations.
    • pyyaml: For parsing the configuration file.
    • iso8601 & rfc3339: For handling date and time formats.

Features

  • Real-time price data streaming from the OANDA API.
  • Dynamic candle generation from streaming price data.
  • Opening Range Breakout (ORB) trading strategy implementation.
  • Automated order execution (market orders).
  • Position management with stop-loss and take-profit levels.
  • Concurrent processing using multithreading for handling multiple currency pairs simultaneously.
  • Data logging for prices, candles, and trade orders.

Project Structure

.
├── .gitignore
├── Pipfile
├── Pipfile.lock
├── README.md
├── configure.py
├── main.py
├── signal_detector.py
├── DataDump.py
├── exit_control.py
├── logger.py
└── v20.conf

Required Directories

The following directories must be created in the root of the project for data logging:

  • candles/: Stores the generated candle data in CSV format.
  • logs/: Contains logs of trade orders.
  • prices/: Stores the raw price data streamed from the API in CSV format.

Getting Started

Prerequisites

  • Python 3.8
  • pipenv

Installation

  1. Clone the repository:
    git clone <repository-url>
    cd ORBitrage
  2. Create required directories:
    mkdir candles logs prices
  3. Install dependencies:
    pipenv install
  4. Configure API Credentials: Create a v20.conf file in the root directory with your OANDA API credentials. You can use the following template:
    hostname: "api-fxpractice.oanda.com"
    streaming_hostname: "stream-fxpractice.oanda.com"
    port: 443
    ssl: true
    token: "YOUR_API_TOKEN"
    username: "YOUR_USERNAME"
    accounts:
    - "YOUR_ACCOUNT_ID"
    active_account: "YOUR_ACCOUNT_ID"
    datetime_format: "RFC3339"

Running the Bot

To start the trading bot, run the following command:

pipenv run python main.py

The bot will start streaming data, processing it, and executing trades based on the implemented strategy. To stop the bot, press Ctrl+C.

Additional Info

This bot is designed for demonstration and educational purposes. Trading with real money involves significant risk. Please test thoroughly in a demo environment before deploying with a live account.

About

This repository contains the implementation of automated bot which trades on Oanda API according to Open Breakout Stragtegy(ORB).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages