Help us shape the future of Go! Take the 2026 Go Developer Survey

oanda

package module
v0.0.0-...-ef3ac3c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2016 License: Apache-2.0 Imports: 14 Imported by: 3

README

OANDA for Go

Build Status Coverage 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 (
	"flag"
	"fmt"

	"github.com/santegoeds/oanda"
)

var (
	token   = flag.String("token", "", "Oanda authorization token.")
	account = flag.Int64("account", 0, "Oanda account.")
)

func main() {
	flag.Parse()

	if *token == "" {
		panic("An Oanda authorization token is required")
	}

	if *account == 0 {
		panic("An Oanda account is required")
	}

	client, err := oanda.NewFxPracticeClient(*token)
	if err != nil {
		panic(err)
	}

	client.SelectAccount(oanda.Id(*account))

	// 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.
	tradeInfo, err := client.NewTrade(oanda.Buy, 1, "eur_usd", oanda.TrailingStop(10.0))
	if err != nil {
		panic(err)
	}
	fmt.Println(tradeInfo)

	// 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()
	})

	// Close the previously opened trade.
	tradeCloseInfo, err := client.CloseTrade(tradeInfo.TradeId)
	if err != nil {
		panic(err)
	}
	fmt.Println(tradeCloseInfo)
}

License

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

Documentation

Index

Constants

View Source
const (
	Buy  TradeSide = "buy"
	Sell TradeSide = "sell"

	MarketIfTouched OrderType = "marketIfTouched"
	Limit           OrderType = "limit"
	Stop            OrderType = "stop"
)

Variables

View Source
var (
	Debug             = ""
	DefaultHttpClient = &http.Client{
		Transport: &http.Transport{
			Proxy: http.ProxyFromEnvironment,
			Dial: (&net.Dialer{
				Timeout:   30 * time.Second,
				KeepAlive: 30 * time.Second,
			}).Dial,
			TLSHandshakeTimeout: 10 * time.Second,

			MaxIdleConnsPerHost: 2,
		},
	}
)

Functions

This section is empty.

Types

type Account

type Account struct {
	AccountId       Id       `json:"accountId"`
	Name            string   `json:"accountName"`
	Balance         float64  `json:"balance"`
	UnrealizedPl    float64  `json:"unrealizedPl"`
	RealizedPl      float64  `json:"realizedPl"`
	MarginUsed      float64  `json:"marginUsed"`
	MarginAvailable float64  `json:"marginAvail"`
	OpenTrades      int      `json:"openTrades"`
	OpenOrders      int      `json:"openOrders"`
	Currency        string   `json:"accountCurrency"`
	MarginRate      float64  `json:"marginRate"`
	PropertyName    []string `json:"accountPropertyName"`
}

Account represents an Oanda account.

func (Account) String

func (a Account) String() string

String implements the fmt.Stringer interface.

type AccountCreateEvent

type AccountCreateEvent struct {
	// contains filtered or unexported fields
}

AccountCreateEvent represents an event of type CREATE.

func (*AccountCreateEvent) AccountId

func (t *AccountCreateEvent) AccountId() Id

func (*AccountCreateEvent) HomeCurrency

func (t *AccountCreateEvent) HomeCurrency() string

func (*AccountCreateEvent) Reason

func (t *AccountCreateEvent) Reason() string

func (AccountCreateEvent) String

func (t AccountCreateEvent) String() string

String implementes the fmt.Stringer interface.

func (*AccountCreateEvent) Time

func (t *AccountCreateEvent) Time() Time

func (*AccountCreateEvent) TranId

func (t *AccountCreateEvent) TranId() Id

func (*AccountCreateEvent) Type

func (t *AccountCreateEvent) Type() string

func (*AccountCreateEvent) UnmarshalJSON

func (t *AccountCreateEvent) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements the json.Unmarshaler interface.

type AlignmentTimezone

type AlignmentTimezone time.Location

Optional argument for PollMidpriceCandles and PollBidAskCandles that indicates the timezone to use when aligning candles with DailyAlignment.

See http://developer.oanda.com/docs/v1/rates/#retrieve-instrument-history for further information.

type ApiError

type ApiError struct {
	Code     int    `json:"code"`
	Message  string `json:"message"`
	MoreInfo string `json:"moreInfo"`
}

ApiError holds error details as returned by the Oanda servers.

func (*ApiError) Error

func (ae *ApiError) Error() string

type AutochartistArg

type AutochartistArg interface {
	// contains filtered or unexported methods
}

type AutochartistPattern

type AutochartistPattern struct {
	Signals  []AutochartistSignal `json:"signals"`
	Provider string               `json:"provider"`
}

func (AutochartistPattern) String

func (p AutochartistPattern) String() string

type AutochartistSignal

type AutochartistSignal struct {
	Meta       AutochartistSignalMeta `json:"meta"`
	Id         Id                     `json:"id"`
	Instrument string                 `json:"instrument"`
	Type       string                 `json:"type"`
	Data       AutochartistSignalData `json:"data"`
}

func (AutochartistSignal) String

func (s AutochartistSignal) String() string

type AutochartistSignalData

type AutochartistSignalData struct {
	PatternEndTime int64
	Points         struct {
		Resistance Point `json:"resistance"`
		Support    Point `json:"support"`
	} `json:"points"`
	Prediction Prediction `json:"prediction"`
}

func (AutochartistSignalData) String

func (d AutochartistSignalData) String() string

type AutochartistSignalMeta

type AutochartistSignalMeta struct {
	Completed int `json:"completed"`
	Scores    struct {
		Uniformity   int `json:"uniformity"`
		Quality      int `json:"quality"`
		Breakout     int `json:"breakout"`
		InitialTrend int `json:"initialtrend"`
		Clarity      int `json:"clarity"`
	}
	Probability     float64         `json:"probability"`
	Interval        int             `json:"interval"`
	Direction       int             `json:"direction"`
	Pattern         string          `json:"pattern"`
	Length          int             `json:"length"`
	HistoricalStats HistoricalStats `json:"historicalstats"`
	TrendType       string          `json:"trendtype"`
}

func (AutochartistSignalMeta) String

func (m AutochartistSignalMeta) String() string

type BidAskCandle

type BidAskCandle struct {
	Time     Time    `json:"time"`
	OpenBid  float64 `json:"openBid"`
	OpenAsk  float64 `json:"openAsk"`
	HighBid  float64 `json:"highBid"`
	HighAsk  float64 `json:"highAsk"`
	LowBid   float64 `json:"lowBid"`
	LowAsk   float64 `json:"lowAsk"`
	CloseBid float64 `json:"closeBid"`
	CloseAsk float64 `json:"closeAsk"`
	Volume   int     `json:"volume"`
	Complete bool    `json:"complete"`
}

func (BidAskCandle) String

func (c BidAskCandle) String() string

type BidAskCandles

type BidAskCandles struct {
	Instrument  string         `json:"instrument"`
	Granularity Granularity    `json:"granularity"`
	Candles     []BidAskCandle `json:"candles"`
}

BidAskCandles represents Bid and Ask instrument history with a specific granularity.

func (BidAskCandles) String

func (c BidAskCandles) String() string

type CalendarEvent

type CalendarEvent struct {
	Title     string  `json:"title"`
	Timestamp int64   `json:"timestamp"`
	Unit      string  `json:"unit"`
	Currency  string  `json:"currency"`
	Forecast  float64 `json:"forecast,string"`
	Previous  float64 `json:"previous,string"`
	Actual    float64 `json:"actual,string"`
	Market    float64 `json:"market,string"`
}

func (CalendarEvent) String

func (ce CalendarEvent) String() string

type CancelOrderResponse

type CancelOrderResponse struct {
	TransactionId Id      `json:"id"`
	Instrument    string  `json:"instrument"`
	Units         int     `json:"units"`
	Side          string  `json:"side"`
	Price         float64 `json:"price"`
	Time          Time    `json:"time"`
}

type CandlesArg

type CandlesArg interface {
	// contains filtered or unexported methods
}

CandlesArg implements optional arguments for MidpointCandles and BidAskCandles.

type Client

type Client struct {
	*http.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(environment string, token string, httpClient *http.Client) (*Client, error)

func NewFxPracticeClient

func NewFxPracticeClient(token string) (*Client, error)

NewFxPracticeClient returns a client instance that connects to Oanda's fxpractice environment. String token should be set to the generated personal access token.

See http://developer.oanda.com/docs/v1/auth/ for further information.

func NewFxTradeClient

func NewFxTradeClient(token string) (*Client, error)

NewFxTradeClient returns a client instance that connects to Oanda's fxtrade environment. String token should be set to the generated personal access token.

See http://developer.oanda.com/docs/v1/auth/ for further information.

func (*Client) Account

func (c *Client) Account(accountId Id) (*Account, error)

Account queries the Oanda servers for account information for the specified accountId and returns a new Account instance.

func (*Client) AccountId

func (c *Client) AccountId() Id

func (*Client) Accounts

func (c *Client) Accounts() ([]Account, error)

Accounts returns a list with all the know accounts.

func (*Client) AutochartistPattern

func (c *Client) AutochartistPattern(arg ...AutochartistArg) (*AutochartistPattern, error)

AutochartistPattern

func (*Client) Calendar

func (c *Client) Calendar(instrument string, period Period) ([]CalendarEvent, error)

Calendar returns and array of economic calendar events associated with an instrument. Events can include economic indicator data or they can solely be be news about important meetings.

See http://developer.oanda.com/docs/v1/forex-labs/#calendar for further information.

func (*Client) CancelOrder

func (c *Client) CancelOrder(orderId Id) (*CancelOrderResponse, error)

CancelOrder closes an open order.

func (*Client) CancelRequest

func (c *Client) CancelRequest(req *http.Request)

CancelRequest aborts an in-progress HTTP request.

func (*Client) CloseIdleConnections

func (c *Client) CloseIdleConnections()

Closes all idle connections to the Oanda server.

func (*Client) ClosePosition

func (c *Client) ClosePosition(instrument string) (*PositionCloseResponse, error)

ClosePosition closes an existing position.

func (*Client) CloseTrade

func (c *Client) CloseTrade(tradeId Id) (*CloseTradeResponse, error)

CloseTrade closes an open trade.

func (*Client) CommitmentsOfTraders

func (c *Client) CommitmentsOfTraders(instrument string) ([]CommitmentsOfTraders, error)

CommitmentsOfTraders returns up to 4 years of commitments of traders.

The commitments of traders report is released by the CFTC and provides a breakdown of each Tuesday's open interest.

func (*Client) FullEventHistory

func (c *Client) FullEventHistory() (*url.URL, error)

FullEventHistory returns a url from which a file containing the full transaction history for the account can be downloaded.

func (*Client) Instruments

func (c *Client) Instruments(instruments []string, fields []InstrumentField) (map[string]InstrumentInfo, error)

Instruments returns instrument information. Only the specified instruments are returned if instruments is not nil. If fields is not nil additional information fields is included.

See http://developer.oanda.com/docs/v1/rates/#get-an-instrument-list for further information.

func (*Client) ModifyOrder

func (c *Client) ModifyOrder(orderId Id, arg ModifyOrderArg, args ...ModifyOrderArg) (*Order, error)

ModifyOrder updates an open order. Supported arguments are Units(), Price(), Expiry(), UpperBound(), StopLoss(), TakeProfit() and TrailingStop().

func (*Client) ModifyTrade

func (c *Client) ModifyTrade(tradeId Id, arg ModifyTradeArg, args ...ModifyTradeArg) (*Trade, error)

ModifyTrade modifies an open trade. Supported optional arguments are StopLoss(), TakeProfit(), TrailingStop()

func (*Client) NewEventServer

func (c *Client) NewEventServer(accountId ...Id) (*EventServer, error)

NewEventServer returns an server instance for receiving events for the specified accountId(s). If no accountId is specified events for all accountIds are received.

See http://developer.oanda.com/docs/v1/stream/#events-streaming for further information.

func (*Client) NewOrder

func (c *Client) NewOrder(orderType OrderType, side TradeSide, units int, instrument string,
	price float64, expiry time.Time, args ...NewOrderArg) (*Order, error)

NewOrder creates and submits a new order.

func (*Client) NewPricePoller

func (c *Client) NewPricePoller(since time.Time, instrs ...string) (*PricePoller, error)

NewPricePoller returns a poller to repeatedly poll Oanda for updates of the same set of instruments.

func (*Client) NewPriceServer

func (c *Client) NewPriceServer(instrs ...string) (*PriceServer, error)

NewPriceServer returns a PriceServer instance for receiving and handling Ticks.

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body io.Reader) (*http.Request, error)

NewRequest creates a new http request.

func (*Client) NewTrade

func (c *Client) NewTrade(side TradeSide, units int, instrument string,
	args ...NewTradeArg) (*Trade, error)

NewTrade submits a MarketOrder request to the Oanda servers. Supported OptionalArgs are UpperBound(), LowerBound(), StopLoss(), TakeProfit() and TrailingStop().

func (*Client) Order

func (c *Client) Order(orderId Id) (*Order, error)

Order returns information about an existing order.

func (*Client) OrderBooks

func (c *Client) OrderBooks(instrument string, period Period) (OrderBooks, error)

Orderbook returns historic order book data.

See http://developer.oanda.com/docs/v1/forex-labs/#orderbook for further information.

func (*Client) Orders

func (c *Client) Orders(args ...OrdersArg) ([]Order, error)

Orders returns an array with all orders that match the optional arguments (if any). Supported OrdersArg are MaxId, Count and Instrument.

func (*Client) PollBidAskCandles

func (c *Client) PollBidAskCandles(instrument string, granularity Granularity,
	args ...CandlesArg) (*BidAskCandles, error)

PollBidAskCandles returns historical bid- and ask prices for an instrument.

func (*Client) PollEvent

func (c *Client) PollEvent(tranId Id) (Event, error)

PollEvent returns data for a single event.

func (*Client) PollEvents

func (c *Client) PollEvents(args ...EventsArg) ([]Event, error)

PollEvents returns an array of events. Optional arguments are MaxId, MinId, Count, Instrument and Ids.

See http://developer.oanda.com/docs/v1/transactions/#get-transaction-history for further information.

func (*Client) PollMidpointCandles

func (c *Client) PollMidpointCandles(instrument string, granularity Granularity,
	args ...CandlesArg) (*MidpointCandles, error)

PollMidpointCandles returns historical midpoint prices for an instrument.

func (*Client) PollPrices

func (c *Client) PollPrices(instruments ...string) (Prices, error)

PollPrices returns the latest PriceTick for the specified instruments.

func (*Client) PollPricesSince

func (c *Client) PollPricesSince(since time.Time, instrs ...string) (Prices, error)

PollPricesSince returns the PriceTicks for instruments. If since is not the zero time instruments whose prices were not updated since the requested time.Time are excluded from the result.

func (*Client) Position

func (c *Client) Position(instrument string) (*Position, error)

Position returns the position for the selected account and instrument.

func (*Client) PositionRatios

func (c *Client) PositionRatios(instrument string, period Period) (*PositionRatios, error)

PositionRatios returns daily position ratios for an instrument. A position ratio is the percentage of Oanda clients that have a Long/Short position.

See http://developer.oanda.com/docs/v1/forex-labs/#historical-position-ratios for further information.

func (*Client) Positions

func (c *Client) Positions() (Positions, error)

Positions returns all positions for the selected account.

func (*Client) SelectAccount

func (c *Client) SelectAccount(accountId Id)

SelectAccount configures an Oanda account. All trades and orders will be booked under the selected account. Use AccountId 0 to disable account selection.

func (*Client) Spreads

func (c *Client) Spreads(instrument string, period Period, unique bool) (*Spreads, error)

Spreads returns historical spread data for a specific period in 15 min intervals. If unique is true then adjacent duplicate spreads are omitted.

See http://developer.oanda.com/docs/v1/forex-labs/#spreads for further information.

func (*Client) Trade

func (c *Client) Trade(tradeId Id) (*Trade, error)

Trade returns an open trade.

func (*Client) Trades

func (c *Client) Trades(args ...TradesArg) (Trades, error)

Trades returns a list of open trades that match the optional arguments. Supported optional arguments are MaxId(), Count(), Instrument() and Ids().

type CloseTradeResponse

type CloseTradeResponse struct {
	TransactionId Id      `json:"id"`
	Price         float64 `json:"price"`
	Instrument    string  `json:"instrument"`
	Profit        float64 `json:"profit"`
	Side          string  `json:"side"`
	Time          Time    `json:"time"`
}

type CommitmentsOfTraders

type CommitmentsOfTraders struct {
	Date               int64   `json:"date"`
	Price              float64 `json:"price,string"`
	OverallInterest    int     `json:"oi,string"`
	NonCommercialLong  int     `json:"ncl,string"`
	NonCommercialShort int     `json:"ncs,string"`
	Unit               string  `json:"unit"`
}

func (CommitmentsOfTraders) String

func (c CommitmentsOfTraders) String() string

type ContentType

type ContentType string

A ContentType adds a Content-Type entry to the request header.

type Count

type Count int

Count is an optional argument for Client methods Events(), Orders(), /MidpriceCandles(), BidAskCandles() and Trades().

type DailyAlignment

type DailyAlignment int

Optional argument for PollMidpriceCandles and PollBidAskCandles to indicate the hour at which candles hould be aligned. Only relevant for hourly or greater granularities.

See http://developer.oanda.com/docs/v1/rates/#retrieve-instrument-history for further information.

type DailyInterestEvent

type DailyInterestEvent struct {
	// contains filtered or unexported fields
}

DailyInterestEvent represents an event of type DAILY_INTEREST.

func (*DailyInterestEvent) AccountId

func (t *DailyInterestEvent) AccountId() Id

func (*DailyInterestEvent) Interest

func (t *DailyInterestEvent) Interest() float64

func (DailyInterestEvent) String

func (t DailyInterestEvent) String() string

String implementes the fmt.Stringer interface.

func (*DailyInterestEvent) Time

func (t *DailyInterestEvent) Time() Time

func (*DailyInterestEvent) TranId

func (t *DailyInterestEvent) TranId() Id

func (*DailyInterestEvent) Type

func (t *DailyInterestEvent) Type() string

func (*DailyInterestEvent) UnmarshalJSON

func (t *DailyInterestEvent) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements the json.Unmarshaler interface.

type DateFormat

type DateFormat string

A DateFormat add the desired DateTime format to a request header.

type Direction

type Direction string
const (
	Bullish Direction = "bullish"
	Bearish Direction = "bearish"
)

type EndTime

type EndTime time.Time

Optional argument for PollMidpriceCandles and PollBidAskCandles to specify the end time of until which instrument history should be included.

See http://developer.oanda.com/docs/v1/rates/#retrieve-instrument-history for further information.

type Environment

type Environment string

type Event

type Event interface {
	TranId() Id
	AccountId() Id
	Time() Time
	Type() string
}

func EventFromJSON

func EventFromJSON(data []byte) (Event, error)

EventFromJSON returns an OANDA Event object given JSON input.

type EventHandlerFunc

type EventHandlerFunc func(Id, Event)

type EventServer

type EventServer struct {
	// If HeartbeatFunc is not nil it is invoked once for every heartbeat message that the
	// EventServer receives.
	HeartbeatFunc HeartbeatHandlerFunc
	// contains filtered or unexported fields
}

An EventServer receives events (aka transactions) for one or more accountId(s).

func (*EventServer) ConnectAndHandle

func (es *EventServer) ConnectAndHandle(handleFn EventHandlerFunc) (err error)

ConnectAndDispatch starts the event server and blocks until Stop() is called. Function handleFn is called for each event that is received.

See http://developer.oanda.com/docs/v1/stream/ and http://developer.oanda.com/docs/v1/transactions/ for further information.

func (*EventServer) Stop

func (es *EventServer) Stop()

Stop terminates the events server and causes ConnectAndHandle() to return.

type EventsArg

type EventsArg interface {
	// contains filtered or unexported methods
}

EventsArg is an optional argument for method PollEvents.

type Expiry

type Expiry time.Time

Expiry is an optional argument for Client method ModifyOrder().

type FeeEvent

type FeeEvent struct {
	// contains filtered or unexported fields
}

FeeEvent represents an event of type FEE

func (*FeeEvent) AccountBalance

func (t *FeeEvent) AccountBalance() float64

func (*FeeEvent) AccountId

func (t *FeeEvent) AccountId() Id

func (*FeeEvent) Amount

func (t *FeeEvent) Amount() float64

func (*FeeEvent) Reason

func (t *FeeEvent) Reason() string

func (FeeEvent) String

func (t FeeEvent) String() string

String implementes the fmt.Stringer interface.

func (*FeeEvent) Time

func (t *FeeEvent) Time() Time

func (*FeeEvent) TranId

func (t *FeeEvent) TranId() Id

func (*FeeEvent) Type

func (t *FeeEvent) Type() string

func (*FeeEvent) UnmarshalJSON

func (t *FeeEvent) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements the json.Unmarshaler interface.

type Granularity

type Granularity string

Granularity determines the interval at which historic instrument prices are converted into candles.

const (
	S5  Granularity = "S5"
	S10 Granularity = "S10"
	S15 Granularity = "S15"
	S30 Granularity = "S30"
	M1  Granularity = "M1"
	M2  Granularity = "M2"
	M3  Granularity = "M3"
	M5  Granularity = "M5"
	M10 Granularity = "M10"
	M15 Granularity = "M15"
	M30 Granularity = "M30"
	H1  Granularity = "H1"
	H2  Granularity = "H2"
	H3  Granularity = "H3"
	H4  Granularity = "H4"
	H6  Granularity = "H6"
	H8  Granularity = "H8"
	H12 Granularity = "H12"
	D   Granularity = "D"
	W   Granularity = "W"
	M   Granularity = "M"
)

type HeartbeatHandlerFunc

type HeartbeatHandlerFunc func(Time)

type HistoricalStats

type HistoricalStats struct {
	HourOfDay Stats `json:"hourofday"`
	Pattern   Stats `json:"pattern"`
	Symbol    Stats `json:"symbol"`
}

func (HistoricalStats) String

func (s HistoricalStats) String() string

type Id

type Id uint64

type Ids

type Ids []Id

type IncludeFirst

type IncludeFirst bool

Optional argument for PollMidpriceCandles and PollBidAskCandles to indicate whether the candle that starts at StartTime should be included.

See http://developer.oanda.com/docs/v1/rates/#retrieve-instrument-history for further information.

type Instrument

type Instrument string

Instrument is an optional argument for Client methods Events(), Orders() and Trades().

type InstrumentField

type InstrumentField string
const (
	DisplayNameField     InstrumentField = "displayName"
	PipField             InstrumentField = "pip"
	MaxTradeUnitsField   InstrumentField = "maxTradeUnits"
	PrecisionField       InstrumentField = "precision"
	MaxTrailingStopField InstrumentField = "maxTrailingStop"
	MinTrailingStopField InstrumentField = "minTrailingStop"
	MarginRateField      InstrumentField = "marginRate"
	HaltedField          InstrumentField = "halted"
	InterestRateField    InstrumentField = "interestRate"
)

type InstrumentInfo

type InstrumentInfo struct {
	DisplayName     string                  `json:"displayName"`
	Pip             float64                 `json:"pip,string"`
	MaxTradeUnits   int                     `json:"maxTradeUnits"`
	Precision       float64                 `json:"precision,string"`
	MaxTrailingStop float64                 `json:"maxTrailingStop"`
	MinTrailingStop float64                 `json:"minTrailingStop"`
	MarginRate      float64                 `json:"marginRate"`
	Halted          bool                    `json:"halted"`
	InterestRate    map[string]InterestRate `json:"interestRate"`
}

func (InstrumentInfo) String

func (ii InstrumentInfo) String() string

type InterestRate

type InterestRate struct {
	Bid float64 `json:"bid"`
	Ask float64 `json:"ask"`
}

func (InterestRate) String

func (ir InterestRate) String() string

type LowerBound

type LowerBound float64

LowerBound is an optional argument for Client methods NewOrder(), ModifyOrder() and NewTrade().

type MaxId

type MaxId Id

MaxId is an optional argument for Client methods Events(), Orders() and Trades().

type MidpointCandle

type MidpointCandle struct {
	Time     Time    `json:"time"`
	OpenMid  float64 `json:"openMid"`
	HighMid  float64 `json:"highMid"`
	LowMid   float64 `json:"lowMid"`
	CloseMid float64 `json:"closeMid"`
	Volume   int     `json:"volume"`
	Complete bool    `json:"complete"`
}

func (MidpointCandle) String

func (c MidpointCandle) String() string

type MidpointCandles

type MidpointCandles struct {
	Instrument  string           `json:"instrument"`
	Granularity Granularity      `json:"granularity"`
	Candles     []MidpointCandle `json:"candles"`
}

MidpointCandles represents instrument history with a specific granularity.

func (MidpointCandles) String

func (c MidpointCandles) String() string

type MigrateTradeOpenEvent

type MigrateTradeOpenEvent struct {
	// contains filtered or unexported fields
}

MigrateTradeOpenEvent represents an event of type MIGRATE_TRADE_OPEN

func (*MigrateTradeOpenEvent) AccountId

func (t *MigrateTradeOpenEvent) AccountId() Id

func (*MigrateTradeOpenEvent) Instrument

func (t *MigrateTradeOpenEvent) Instrument() string

func (*MigrateTradeOpenEvent) Price

func (t *MigrateTradeOpenEvent) Price() float64

func (*MigrateTradeOpenEvent) Side

func (t *MigrateTradeOpenEvent) Side() string

func (*MigrateTradeOpenEvent) StopLossPrice

func (t *MigrateTradeOpenEvent) StopLossPrice() float64

func (MigrateTradeOpenEvent) String

func (t MigrateTradeOpenEvent) String() string

String implementes the fmt.Stringer interface.

func (*MigrateTradeOpenEvent) TakeProfitPrice

func (t *MigrateTradeOpenEvent) TakeProfitPrice() float64

func (*MigrateTradeOpenEvent) Time

func (t *MigrateTradeOpenEvent) Time() Time

func (*MigrateTradeOpenEvent) TradeOpened

func (t *MigrateTradeOpenEvent) TradeOpened() *evtTradeDetail

func (*MigrateTradeOpenEvent) TrailingStopLossDistance

func (t *MigrateTradeOpenEvent) TrailingStopLossDistance() float64

func (*MigrateTradeOpenEvent) TranId

func (t *MigrateTradeOpenEvent) TranId() Id

func (*MigrateTradeOpenEvent) Type

func (t *MigrateTradeOpenEvent) Type() string

func (*MigrateTradeOpenEvent) Units

func (t *MigrateTradeOpenEvent) Units() int

func (*MigrateTradeOpenEvent) UnmarshalJSON

func (t *MigrateTradeOpenEvent) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements the json.Unmarshaler interface.

type MinId

type MinId Id

type ModifyOrderArg

type ModifyOrderArg interface {
	// contains filtered or unexported methods
}

ModifyOrderArg represents an opional argument for method ModifyOrder. Types that implement the interface are Units, Price, Expiry, LowerBound, UpperBound, StopLoss, TakeProfit and TrailingStop.

type ModifyTradeArg

type ModifyTradeArg interface {
	// contains filtered or unexported methods
}

type NewOrderArg

type NewOrderArg interface {
	// contains filtered or unexported methods
}

NewOrderArg represents an optional argument for method NewOrder. Types that implement the interface are LowerBound, UpperBound, StopLoss, TakeProfit and TrailingStop.

type NewTradeArg

type NewTradeArg interface {
	// contains filtered or unexported methods
}

type Order

type Order struct {
	OrderId        Id      `json:"id"`
	Units          int     `json:"units"`
	Instrument     string  `json:"instrument"`
	Side           string  `json:"side"`
	Price          float64 `json:"price"`
	Time           Time    `json:"time"`
	StopLoss       float64 `json:"stopLoss"`
	TakeProfit     float64 `json:"takeProfit"`
	TrailingStop   float64 `json:"trailingStop"`
	TrailingAmount float64 `json:"trailingAmount"`
	OrderType      string  `json:"type"`
	Expiry         Time    `json:"expiry"`
	UpperBound     float64 `json:"upperBound"`
	LowerBound     float64 `json:"lowerBound"`
}

func (Order) String

func (o Order) String() string

String implements the fmt.Stringer interface.

type OrderBook

type OrderBook struct {
	Timestamp   Time
	MarketPrice float64
	PricePoints []PricePoint
}

OrderBook represents the order book at a specific time.

func (*OrderBook) Sort

func (ob *OrderBook) Sort()

func (OrderBook) String

func (ob OrderBook) String() string

func (*OrderBook) UnmarshalJSON

func (ob *OrderBook) UnmarshalJSON(data []byte) error

type OrderBooks

type OrderBooks []OrderBook

func (*OrderBooks) Sort

func (obs *OrderBooks) Sort()

func (*OrderBooks) UnmarshalJSON

func (obs *OrderBooks) UnmarshalJSON(data []byte) error

type OrderCancelEvent

type OrderCancelEvent struct {
	// contains filtered or unexported fields
}

OrderCancelEvent represents and event of type ORDER_CANCEL.

func (*OrderCancelEvent) AccountId

func (t *OrderCancelEvent) AccountId() Id

func (*OrderCancelEvent) OrderId

func (t *OrderCancelEvent) OrderId() Id

func (*OrderCancelEvent) Reason

func (t *OrderCancelEvent) Reason() string

func (OrderCancelEvent) String

func (t OrderCancelEvent) String() string

String implementes the fmt.Stringer interface.

func (*OrderCancelEvent) Time

func (t *OrderCancelEvent) Time() Time

func (*OrderCancelEvent) TranId

func (t *OrderCancelEvent) TranId() Id

func (*OrderCancelEvent) Type

func (t *OrderCancelEvent) Type() string

func (*OrderCancelEvent) UnmarshalJSON

func (t *OrderCancelEvent) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements the json.Unmarshaler interface.

type OrderCreateEvent

type OrderCreateEvent struct {
	// contains filtered or unexported fields
}

OrderCreateEvent represents an event of type LIMIT_ORDER_CREATE, STOP_ORDER_CREATE or MARKET_IF_TOUCHED_CREATE

func (*OrderCreateEvent) AccountId

func (t *OrderCreateEvent) AccountId() Id

func (*OrderCreateEvent) Expiry

func (t *OrderCreateEvent) Expiry() Time

func (*OrderCreateEvent) Instrument

func (t *OrderCreateEvent) Instrument() string

func (*OrderCreateEvent) LowerBound

func (t *OrderCreateEvent) LowerBound() float64

func (*OrderCreateEvent) Price

func (t *OrderCreateEvent) Price() float64

func (*OrderCreateEvent) Reason

func (t *OrderCreateEvent) Reason() string

func (*OrderCreateEvent) Side

func (t *OrderCreateEvent) Side() string

func (*OrderCreateEvent) StopLossPrice

func (t *OrderCreateEvent) StopLossPrice() float64

func (OrderCreateEvent) String

func (t OrderCreateEvent) String() string

String implementes the fmt.Stringer interface.

func (*OrderCreateEvent) TakeProfitPrice

func (t *OrderCreateEvent) TakeProfitPrice() float64

func (*OrderCreateEvent) Time

func (t *OrderCreateEvent) Time() Time

func (*OrderCreateEvent) TrailingStopLossDistance

func (t *OrderCreateEvent) TrailingStopLossDistance() float64

func (*OrderCreateEvent) TranId

func (t *OrderCreateEvent) TranId() Id

func (*OrderCreateEvent) Type

func (t *OrderCreateEvent) Type() string

func (*OrderCreateEvent) Units

func (t *OrderCreateEvent) Units() int

func (*OrderCreateEvent) UnmarshalJSON

func (t *OrderCreateEvent) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements the json.Unmarshaler interface.

func (*OrderCreateEvent) UpperBound

func (t *OrderCreateEvent) UpperBound() float64

type OrderFilledEvent

type OrderFilledEvent struct {
	// contains filtered or unexported fields
}

OrderFilledEvent represents an event of type ORDER_FILLED.

func (*OrderFilledEvent) AccountId

func (t *OrderFilledEvent) AccountId() Id

func (*OrderFilledEvent) OrderId

func (t *OrderFilledEvent) OrderId() Id

func (OrderFilledEvent) String

func (t OrderFilledEvent) String() string

String implementes the fmt.Stringer interface.

func (*OrderFilledEvent) Time

func (t *OrderFilledEvent) Time() Time

func (*OrderFilledEvent) TranId

func (t *OrderFilledEvent) TranId() Id

func (*OrderFilledEvent) Type

func (t *OrderFilledEvent) Type() string

func (*OrderFilledEvent) UnmarshalJSON

func (t *OrderFilledEvent) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements the json.Unmarshaler interface.

type OrderType

type OrderType string

type OrderUpdateEvent

type OrderUpdateEvent struct {
	// contains filtered or unexported fields
}

OrderUpdateEvent represents an event of type ORDER_UPDATE

func (*OrderUpdateEvent) AccountId

func (t *OrderUpdateEvent) AccountId() Id

func (*OrderUpdateEvent) Instrument

func (t *OrderUpdateEvent) Instrument() string

func (*OrderUpdateEvent) LowerBound

func (t *OrderUpdateEvent) LowerBound() float64

func (*OrderUpdateEvent) Reason

func (t *OrderUpdateEvent) Reason() string

func (*OrderUpdateEvent) Side

func (t *OrderUpdateEvent) Side() string

func (*OrderUpdateEvent) StopLossPrice

func (t *OrderUpdateEvent) StopLossPrice() float64

func (OrderUpdateEvent) String

func (t OrderUpdateEvent) String() string

String implementes the fmt.Stringer interface.

func (*OrderUpdateEvent) TakeProfitPrice

func (t *OrderUpdateEvent) TakeProfitPrice() float64

func (*OrderUpdateEvent) Time

func (t *OrderUpdateEvent) Time() Time

func (*OrderUpdateEvent) TrailingStopLossDistance

func (t *OrderUpdateEvent) TrailingStopLossDistance() float64

func (*OrderUpdateEvent) TranId

func (t *OrderUpdateEvent) TranId() Id

func (*OrderUpdateEvent) Type

func (t *OrderUpdateEvent) Type() string

func (*OrderUpdateEvent) Units

func (t *OrderUpdateEvent) Units() int

func (*OrderUpdateEvent) UnmarshalJSON

func (t *OrderUpdateEvent) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements the json.Unmarshaler interface.

func (*OrderUpdateEvent) UpperBound

func (t *OrderUpdateEvent) UpperBound() float64

type OrdersArg

type OrdersArg interface {
	// contains filtered or unexported methods
}

OrderArgs represents an optional argument for method Orders. Types that implement the interface are MaxId, Count and Instrument.

type Period

type Period int64
const (
	Hour  Period = Period(time.Hour)
	Day   Period = 24 * Hour
	Week  Period = 7 * Day
	Month Period = 2592000
	Year  Period = 31536000
)

type Point

type Point struct {
	X0 int64   `json:"x0"`
	X1 int64   `json:"x1"`
	Y0 float64 `json:"y0"`
	Y1 float64 `json:"y1"`
}

func (Point) String

func (p Point) String() string

type PollRequest

type PollRequest struct {
	// contains filtered or unexported fields
}

PollRequest represents an http request that can be executed repeatedly.

func (*PollRequest) Poll

func (pr *PollRequest) Poll() (*http.Response, error)

Poll repeats the http request with which PollRequest was created.

type Position

type Position struct {
	Side       string  `json:"side"`
	Instrument string  `json:"instrument"`
	Units      int     `json:"units"`
	AvgPrice   float64 `json:"avgPrice"`
}

func (Position) String

func (p Position) String() string

String implements the fmt.Stringer interface.

type PositionCloseResponse

type PositionCloseResponse struct {
	// Ids are the transaction ids that are created as a result of closing the position.
	TranIds    Ids    `json:"ids"`
	Instrument string `json:"instrument"`
	TotalUnits int    `json:"totalUnits"`
}

type PositionRatio

type PositionRatio struct {
	Timestamp    Time
	LongRatio    float64
	ExchangeRate float64
}

type PositionRatios

type PositionRatios struct {
	Instrument  string
	DisplayName string
	Ratios      []PositionRatio
}

func (PositionRatios) String

func (pr PositionRatios) String() string

func (*PositionRatios) UnmarshalJSON

func (pr *PositionRatios) UnmarshalJSON(data []byte) error

type Positions

type Positions []Position

type Prediction

type Prediction struct {
	TimeTo    int64   `json:"timeto"`
	TimeFrom  int64   `json:"timefrom"`
	PriceHigh float64 `json:"pricehigh"`
	PriceLow  float64 `json:"pricelow"`
}

func (Prediction) String

func (p Prediction) String() string

type Price

type Price float64

Price is an optional argument for Client method ModifyOrder().

type PricePoint

type PricePoint struct {
	Price          float64
	OrdersShort    float64 `json:"os"`
	OrdersLong     float64 `json:"ol"`
	PositionsShort float64 `json:"ps"`
	PositionsLong  float64 `json:"pl"`
}

Pricepoint defines the number of orders and positions at a certain price.

func (PricePoint) String

func (pp PricePoint) String() string

type PricePoller

type PricePoller struct {
	// contains filtered or unexported fields
}

func (*PricePoller) Poll

func (pp *PricePoller) Poll() (Prices, error)

Poll returns the most recent set of prices for the instruments with which the PricePoller was configured.

type PriceServer

type PriceServer struct {
	// If HeartbeatFunc is not nil it is invoked once for every heartbeat message that the
	// PriceServer receives.
	HeartbeatFunc HeartbeatHandlerFunc
	// contains filtered or unexported fields
}

A PriceServer receives PriceTicks for one or more instrument(s).

func (*PriceServer) ConnectAndHandle

func (ps *PriceServer) ConnectAndHandle(handleFn TickHandlerFunc) error

ConnectAndHandle connects to the Oanda server and invokes handleFn for every Tick received.

func (*PriceServer) Stop

func (ps *PriceServer) Stop()

Stop terminates the Price server.

type PriceTick

type PriceTick struct {
	Time   Time    `json:"time"`
	Bid    float64 `json:"bid"`
	Ask    float64 `json:"ask"`
	Status string  `json:"status"`
}

PriceTick holds the Bid price, Ask price and status for an instrument at a given point in time

func (*PriceTick) Spread

func (p *PriceTick) Spread() float64

Spread returns the difference between Ask and Bid prices.

func (PriceTick) String

func (p PriceTick) String() string

type Prices

type Prices map[string]PriceTick

type Quality

type Quality int

type SetMarginRateEvent

type SetMarginRateEvent struct {
	// contains filtered or unexported fields
}

SetMarginRateEvent represent and event of type SET_MARGIN_RATE.

func (*SetMarginRateEvent) AccountId

func (t *SetMarginRateEvent) AccountId() Id

func (*SetMarginRateEvent) MarginRate

func (t *SetMarginRateEvent) MarginRate() float64

func (SetMarginRateEvent) String

func (t SetMarginRateEvent) String() string

String implementes the fmt.Stringer interface.

func (*SetMarginRateEvent) Time

func (t *SetMarginRateEvent) Time() Time

func (*SetMarginRateEvent) TranId

func (t *SetMarginRateEvent) TranId() Id

func (*SetMarginRateEvent) Type

func (t *SetMarginRateEvent) Type() string

func (*SetMarginRateEvent) UnmarshalJSON

func (t *SetMarginRateEvent) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements the json.Unmarshaler interface.

type Spread

type Spread struct {
	Timestamp Time
	Spread    float64
}

func (Spread) String

func (s Spread) String() string

func (*Spread) UnmarshalJSON

func (s *Spread) UnmarshalJSON(data []byte) error

type Spreads

type Spreads struct {
	Max []Spread `json:"max"`
	Avg []Spread `json:"avg"`
	Min []Spread `json:"min"`
}

func (Spreads) String

func (s Spreads) String() string

type StartTime

type StartTime time.Time

Optional argument for PollMidpriceCandles and PollBidAskCandles to specify the start time from which instrument history should be included.

See http://developer.oanda.com/docs/v1/rates/#retrieve-instrument-history for further information.

type Stats

type Stats struct {
	Total   int     `json:"total"`
	Percent float64 `json:"percent"`
	Correct int     `json:"correct"`
}

func (Stats) String

func (s Stats) String() string

type StopLoss

type StopLoss float64

StopLoss is an optional argument for Client methods NewOrder(), ModifyOrder(), NewTrade() and ModifyTrade().

type StreamHandler

type StreamHandler interface {
	HandleHeartbeats(<-chan Time)
	HandleMessages(<-chan StreamMessage)
}

type StreamMessage

type StreamMessage struct {
	Type       string
	RawMessage json.RawMessage
}

func (StreamMessage) String

func (msg StreamMessage) String() string

func (*StreamMessage) UnmarshalJSON

func (msg *StreamMessage) UnmarshalJSON(data []byte) error

type StreamServer

type StreamServer struct {
	// contains filtered or unexported fields
}

func (StreamServer) HandleHeartbeats

func (ss StreamServer) HandleHeartbeats(hbC <-chan Time)

func (StreamServer) HandleMessages

func (ss StreamServer) HandleMessages(msgC <-chan StreamMessage)

type TakeProfit

type TakeProfit float64

TakeProfit is an optional argument for Client methods NewOrder(), ModifyOrder(), NewTrade(), and ModifyTrade().

type TickHandlerFunc

type TickHandlerFunc func(instr string, pp PriceTick)

type Time

type Time string

func (Time) IsZero

func (t Time) IsZero() bool

func (Time) String

func (t Time) String() string

func (Time) Time

func (t Time) Time() time.Time

Time return the time as time.Time instance.

func (Time) UnixMicro

func (t Time) UnixMicro() int64

func (Time) UnixNano

func (t Time) UnixNano() int64

type TimedReader

type TimedReader struct {
	Timeout time.Duration
	// contains filtered or unexported fields
}

func NewTimedReader

func NewTimedReader(rc io.ReadCloser, timeout time.Duration) *TimedReader

NewTimedReader returns an instance of TimedReader where Read operations time out.

func (*TimedReader) Close

func (r *TimedReader) Close() error

func (*TimedReader) Read

func (r *TimedReader) Read(p []byte) (int, error)

type TokenAuthenticator

type TokenAuthenticator string

A TokenAuthenticator adds a Bearer authentication to a request header.

type Trade

type Trade struct {
	TradeId        Id      `json:"id"`
	Units          int     `json:"units"`
	Instrument     string  `json:"instrument"`
	Side           string  `json:"side"`
	Price          float64 `json:"price"`
	Time           Time    `json:"time"`
	StopLoss       float64 `json:"stopLoss"`
	TakeProfit     float64 `json:"takeProfit"`
	TrailingStop   float64 `json:"trailingStop"`
	TrailingAmount float64 `json:"trailingAmount"`
}

Trade represents an open Oanda trade.

func (*Trade) String

func (t *Trade) String() string

String implements the Stringer interface.

type TradeCloseEvent

type TradeCloseEvent struct {
	// contains filtered or unexported fields
}

TradeCloseEvent represents an event of type TRADE_CLOSE, MIGRATE_TRADE_CLOSE, TAKE_PROFIT_FILLED, STOP_LOSS_FILLED, TRAILING_STOP_FILLED or MARGIN_CLOSEOUT.

func (*TradeCloseEvent) AccountBalance

func (t *TradeCloseEvent) AccountBalance() float64

func (*TradeCloseEvent) AccountId

func (t *TradeCloseEvent) AccountId() Id

func (*TradeCloseEvent) Instrument

func (t *TradeCloseEvent) Instrument() string

func (*TradeCloseEvent) Interest

func (t *TradeCloseEvent) Interest() float64

func (*TradeCloseEvent) Pl

func (t *TradeCloseEvent) Pl() float64

func (*TradeCloseEvent) Price

func (t *TradeCloseEvent) Price() float64

func (*TradeCloseEvent) Side

func (t *TradeCloseEvent) Side() string

func (TradeCloseEvent) String

func (t TradeCloseEvent) String() string

String implementes the fmt.Stringer interface.

func (*TradeCloseEvent) Time

func (t *TradeCloseEvent) Time() Time

func (*TradeCloseEvent) TradeId

func (t *TradeCloseEvent) TradeId() Id

func (*TradeCloseEvent) TranId

func (t *TradeCloseEvent) TranId() Id

func (*TradeCloseEvent) Type

func (t *TradeCloseEvent) Type() string

func (*TradeCloseEvent) Units

func (t *TradeCloseEvent) Units() int

func (*TradeCloseEvent) UnmarshalJSON

func (t *TradeCloseEvent) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements the json.Unmarshaler interface.

type TradeCreateEvent

type TradeCreateEvent struct {
	// contains filtered or unexported fields
}

TradeCreateEvent represents an event of type MARKET_ORDER_CREATE

func (*TradeCreateEvent) AccountBalance

func (t *TradeCreateEvent) AccountBalance() float64

func (*TradeCreateEvent) AccountId

func (t *TradeCreateEvent) AccountId() Id

func (*TradeCreateEvent) Instrument

func (t *TradeCreateEvent) Instrument() string

func (*TradeCreateEvent) Interest

func (t *TradeCreateEvent) Interest() float64

func (*TradeCreateEvent) LowerBound

func (t *TradeCreateEvent) LowerBound() float64

func (*TradeCreateEvent) Pl

func (t *TradeCreateEvent) Pl() float64

func (*TradeCreateEvent) Price

func (t *TradeCreateEvent) Price() float64

func (*TradeCreateEvent) Side

func (t *TradeCreateEvent) Side() string

func (*TradeCreateEvent) StopLossPrice

func (t *TradeCreateEvent) StopLossPrice() float64

func (TradeCreateEvent) String

func (t TradeCreateEvent) String() string

String implementes the fmt.Stringer interface.

func (*TradeCreateEvent) TakeProfitPrice

func (t *TradeCreateEvent) TakeProfitPrice() float64

func (*TradeCreateEvent) Time

func (t *TradeCreateEvent) Time() Time

func (*TradeCreateEvent) TradeOpened

func (t *TradeCreateEvent) TradeOpened() *evtTradeDetail

func (*TradeCreateEvent) TradeReduced

func (t *TradeCreateEvent) TradeReduced() *evtTradeDetail

func (*TradeCreateEvent) TrailingStopLossDistance

func (t *TradeCreateEvent) TrailingStopLossDistance() float64

func (*TradeCreateEvent) TranId

func (t *TradeCreateEvent) TranId() Id

func (*TradeCreateEvent) Type

func (t *TradeCreateEvent) Type() string

func (*TradeCreateEvent) Units

func (t *TradeCreateEvent) Units() int

func (*TradeCreateEvent) UnmarshalJSON

func (t *TradeCreateEvent) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements the json.Unmarshaler interface.

func (*TradeCreateEvent) UpperBound

func (t *TradeCreateEvent) UpperBound() float64

type TradeSide

type TradeSide string

type TradeUpdateEvent

type TradeUpdateEvent struct {
	// contains filtered or unexported fields
}

TradeUpdateEvent represents an event of type TRADE_UPDATE

func (*TradeUpdateEvent) AccountId

func (t *TradeUpdateEvent) AccountId() Id

func (*TradeUpdateEvent) Instrument

func (t *TradeUpdateEvent) Instrument() string

func (*TradeUpdateEvent) Side

func (t *TradeUpdateEvent) Side() string

func (*TradeUpdateEvent) StopLossPrice

func (t *TradeUpdateEvent) StopLossPrice() float64

func (TradeUpdateEvent) String

func (t TradeUpdateEvent) String() string

String implementes the fmt.Stringer interface.

func (*TradeUpdateEvent) TailingStopLossDistance

func (t *TradeUpdateEvent) TailingStopLossDistance() float64

func (*TradeUpdateEvent) TakeProfitPrice

func (t *TradeUpdateEvent) TakeProfitPrice() float64

func (*TradeUpdateEvent) Time

func (t *TradeUpdateEvent) Time() Time

func (*TradeUpdateEvent) TradeId

func (t *TradeUpdateEvent) TradeId() Id

func (*TradeUpdateEvent) TranId

func (t *TradeUpdateEvent) TranId() Id

func (*TradeUpdateEvent) Type

func (t *TradeUpdateEvent) Type() string

func (*TradeUpdateEvent) Units

func (t *TradeUpdateEvent) Units() int

func (*TradeUpdateEvent) UnmarshalJSON

func (t *TradeUpdateEvent) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements the json.Unmarshaler interface.

type Trades

type Trades []Trade

type TradesArg

type TradesArg interface {
	// contains filtered or unexported methods
}

type TrailingStop

type TrailingStop float64

TrailingStop is an optional argument for Client methods NewOrder(), ModifyOrder(), NewTrade() and ModifyTrade().

type TransferFundsEvent

type TransferFundsEvent struct {
	// contains filtered or unexported fields
}

TransferFundsEvent represents an event of type TRANSFER_FUNDS.

func (*TransferFundsEvent) AccountId

func (t *TransferFundsEvent) AccountId() Id

func (*TransferFundsEvent) Amount

func (t *TransferFundsEvent) Amount() float64

func (TransferFundsEvent) String

func (t TransferFundsEvent) String() string

String implementes the fmt.Stringer interface.

func (*TransferFundsEvent) Time

func (t *TransferFundsEvent) Time() Time

func (*TransferFundsEvent) TranId

func (t *TransferFundsEvent) TranId() Id

func (*TransferFundsEvent) Type

func (t *TransferFundsEvent) Type() string

func (*TransferFundsEvent) UnmarshalJSON

func (t *TransferFundsEvent) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements the json.Unmarshaler interface.

type Units

type Units int

Units is an optional argument for Client method ModifyOrder().

type UpperBound

type UpperBound float64

UpperBound is an optional argument for Client methods NewOrder(), ModifyOrder() and NewTrade().

type WeeklyAlignment

type WeeklyAlignment time.Weekday

Optional argument for PollMidpriceCandles and PollBidAskCandles to indicate the weekday at which candles should be aligned. Only relevant for weekly granularity.

See http://developer.oanda.com/docs/v1/rates/#retrieve-instrument-history for further information.

Directories

Path Synopsis
cmd
example command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL