Git Product home page Git Product logo

oanda's Introduction

OANDA for Go

Build Status

OANDA for Go is a library to access the OANDA REST API from open source programming language Go.

OANDA is a technology company that provides internet based forex trading and currency information. OANDA provide access to their services via a free REST API. OANDA is not affiliated and does not endorse or recommend OANDA for Go.

Please note that this is an alpha release and the code is likely to contain bugs.

Usage

package main

import (
    "fmt"

    "github.com/santegoeds/oanda"
)

func main() {
    client, err := oanda.NewSandboxClient()
    if err != nil {
        panic(err)
    }

    // List available instruments
    instruments, err := client.Instruments(nil, nil)
    if err != nil {
        panic(err)
    }
    fmt.Println(instruments)

    // Buy one unit of EUR/USD with a trailing stop of 10 pips.
    tr, err := client.NewTrade(oanda.Buy, 1, "eur_usd", oanda.TrailingStop(10.0))
    if err != nil {
        panic(err)
    }
    fmt.Println(tr)

    // Create and run a price server.
    priceServer, err := client.NewPriceServer("eur_usd")
    if err != nil {
        panic(err)
    }
    priceServer.ConnectAndHandle(func(instrument string, tick oanda.PriceTick) {
        fmt.Println("Received tick:", instrument, tick)
        priceServer.Stop()
    })
}

License

Oanda for Go is released under the Apache License, Version 2.0

oanda's People

Contributors

lukasreschke avatar santegoeds avatar

Watchers

 avatar  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.