Giter Club home page Giter Club logo

goanda's Introduction

goanda

A Golang wrapper for the OANDA v20 API. Currently OANDA has wrappers for Python, Javascript and Java. Goanda exists to extend upon those languages because of the increasing popularity of Go and for a side prject I'm working on.

Features

Goanda can perform the following actions on your OANDA brokerage accounts:

  • Get candlesticks of all instruments
  • Create and update orders
  • Get data on current and past trades on OANDA
  • Close/scale out of trades you have open
  • Close positions (not just trades)
  • Get data on your account
    • NAV
    • Current % of used margin
    • Balance
    • And more!
  • Get data on all your transactions
  • Get all pricing data (bid/ask spread) on specific instruments

Requirements

  • Go v1.9+

Note: This package was created by a third party, and was not created by anyone affiliated with OANDA

Usage

To use this package run go get github.com/awoldes/goanda then import it into your program and set it up following the snippets below.

Basic Example

I suggest creating a .env file for your project to keep your secrets safe! Make sure you add a .gitignore file.

~/project/.env

OANDA_API_KEY=
OANDA_ACCOUNT=

~/project/main.go

package main

import (
	"log"
	"os"

	"github.com/awoldes/goanda"
	"github.com/davecgh/go-spew/spew"
	"github.com/joho/godotenv"
)

func main() {
	err := godotenv.Load()
	if err != nil {
		log.Fatal("Error loading .env file")
	}
	key := os.Getenv("OANDA_API_KEY")
	accountID := os.Getenv("OANDA_ACCOUNT_ID")
	oanda := goanda.NewConnection(accountID, key, false)
	history := oanda.GetCandles("EUR_USD", "10", "S5")
	spew.Dump(history)
}

Look at the /examples directory for more!

Contributing

For now if you'd like to contribute create an Issue and/or submit a PR!

TODO

API (in order of priority)

  • Instrument endpoints (to get prices and the order book)
  • Order endpoints (to create, get or update orders for an account)
  • Trade enpoints (to get information on current trades)
  • Position endpoints (to get information on current positions)
  • Account endpoints (to get information on the account)
  • Transaction endpoints (to get information on account transactions)
  • Pricing endpoints (to get pricing of instruments)
  • Streaming endpoints for Pricing & Transactions

Docs

  • Write docs on how to use goanda
  • Write example programs for goanda
  • Write tests for goanda

Supporting Projects

Thank you to the following projects, they really helped me while I was developing this API

License

This project was created under the MIT license

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.