oanda

package module
v0.0.0-...-303b520 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2020 License: GPL-3.0 Imports: 15 Imported by: 0

README

Oanda V2 api based on it's open-api

oanda open-api

Documentation

Index

Constants

View Source
const (
	BaseURL     = ""
	TestBaseURL = "api-fxpractice.oanda.com"
)

Variables

View Source
var (
	AcceptDateTimeFormat = "RFC3339"
	DtPtr                = &AcceptDateTimeFormat
	TimeLayout           = time.RFC3339Nano
)

Functions

func GetToken

func GetToken() (name, token string)

Types

type Account

type Account = models.Account

type AccountProperties

type AccountProperties = models.AccountProperties

type AuthAccount

type AuthAccount interface {
	SetAccountID(string)
}

type AuthDatetimeFormat

type AuthDatetimeFormat interface {
	SetAcceptDatetimeFormat(*string)
}

type AuthParam

type AuthParam interface {
	SetAuthorization(string)
	SetTimeout(time.Duration)
}

type Contract

type Contract = coinex.Contract

type Instrument

type Instrument = models.Instrument

type Oanda

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

func GetClient

func GetClient() *Oanda

func GetDebugClient

func GetDebugClient() *Oanda

func NewOanda

func NewOanda(name, token string) *Oanda

NewOanda create onada with token

func NewOandaWithURL

func NewOandaWithURL(baseURL, name, token string) *Oanda

NewOandaWithURL create oanda with url and token

func NewTestOanda

func NewTestOanda(name, token string) *Oanda

NewOanda create test onada with token

func (*Oanda) Buy

func (o *Oanda) Buy(price float64, amount float64) (*Order, error)

func (*Oanda) CloseLongMarket

func (o *Oanda) CloseLongMarket(amount float64) (order *Order, err error)

func (*Oanda) CloseLongPrice

func (o *Oanda) CloseLongPrice(price, amount float64) (order *Order, err error)

func (*Oanda) CloseShortMarket

func (o *Oanda) CloseShortMarket(amount float64) (order *Order, err error)

func (*Oanda) CloseShortPrice

func (o *Oanda) CloseShortPrice(price, amount float64) (order *Order, err error)

func (*Oanda) FetchAccount

func (o *Oanda) FetchAccount() (err error)

FetchAccount fetch account id from server must call first

func (*Oanda) GetAccountInfo

func (o *Oanda) GetAccountInfo(id string) (account *Account, err error)

func (*Oanda) GetInstruments

func (o *Oanda) GetInstruments() (instruments []*Instrument, err error)

func (*Oanda) Kline

func (o *Oanda) Kline(start, end time.Time, nLimit int, binSize string) (klines []*Candle, err error)

func (*Oanda) KlineChan

func (o *Oanda) KlineChan(start, end time.Time, bSize string) (datas chan []interface{}, err chan error)

func (*Oanda) KlineSymbol

func (o *Oanda) KlineSymbol(symbol string, start, end time.Time, nLimit int, binSize string) (klines []*Candle, err error)

func (*Oanda) ListAccounts

func (o *Oanda) ListAccounts() (accounts []*Account, err error)

func (*Oanda) OpenLong

func (o *Oanda) OpenLong(price float64, amount float64) (order *Order, err error)

func (*Oanda) OpenLongMarket

func (o *Oanda) OpenLongMarket(amount float64) (order *Order, err error)

func (*Oanda) OpenShort

func (o *Oanda) OpenShort(price float64, amount float64) (order *Order, err error)

func (*Oanda) OpenShortMarket

func (o *Oanda) OpenShortMarket(amount float64) (order *Order, err error)

func (*Oanda) Sell

func (o *Oanda) Sell(price float64, amount float64) (*Order, error)

func (*Oanda) SetAccountAlias

func (o *Oanda) SetAccountAlias(alias string)

SetAccountAlias set which account to use if not set, use the first account

func (*Oanda) SetDebug

func (o *Oanda) SetDebug(debug bool)

func (*Oanda) SetProxy

func (o *Oanda) SetProxy(proxy string) (err error)

func (*Oanda) SetSymbol

func (o *Oanda) SetSymbol(symbol string)

SetSymbol set symbol

type Position

type Position = coinex.Position

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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