Git Product home page Git Product logo

oandapyv20-examples's Introduction

oandapyV20 - examples

This repo contains a number of examples to demonstrate how to use OANDA's REST-V20 API with the oandapyV20 Python API-wrapper.

Setup

Install

Clone the repository:

$ git clone https://github.com/hootnot/oandapyV20-examples

Install oandapyV20 and other pypi-packages the examples depend on. Maybe you want to do this from a virtual environment.

$ pip install -r requirements.txt

Token

Access to the OANDA V20 REST-API requires a token. If you do not have a token you can obtain one. Check developer.oanda.com for details. Edit the file token.txt and put the token in it.

AccountID

If you have a token, you have an account. Edit the file account.txt and put the accountID in it. Verify that it is your V20 accountID!

Warning

Make sure you have made the setup based on a practice account ! Leveraged trading is high risk. Losses can exceed investment!

Examples

All examples can be run from the cloned repo directory as:

$ python src/<example.py>
Source Description
Streams  
src/streaming_prices.py Simple streaming prices
src/streaming_trans.py Simple streaming transactions
src/concurrent_streaming.py Demonstrate concurrent streaming of prices and events along with the polling of account changes based on gevent greenlets
Data  
src/candle-data.py Retrieve candle data
Orders  
src/market_order.py Placing market orders / logging
src/market_order_request.py Placing market orders using contrib.requests / logging
src/contrib_mo_tp_sl.py Placing market order with takeprofit on-fill and stoploss on-fill
Console  
src/oanda_console.py Console application showing realtime tickdata (Linux/Unix only) CONSOLE_APP
Auto Trading  
src/simplebot.py Simple trading bot based on a moving-average crossover. The bot gets initialized by retrieving the longest MA period of candles. After that new records are fabricated from the stream. When there is a state change an order is placed with a takeprofit and a stoploss order with it. The positions can be traced with the src/oanda_console application.

About this software

The oanda-api-v20 / oandapyV20 software is a personal project. I have no prior or existing relationship with OANDA.

If you have any questions regarding this software, please take a look at the documentation first:

If you still have questions/issues you can open an issue on Gitub: https://github.com/hootnot/oanda-api-v20

oandapyv20-examples's People

Contributors

hootnot avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.