Documentation ¶
Overview ¶
Package oanda provides a client for the OANDA API. For information on the OANDA API, please refer to the OANDA development guide: http://developer.oanda.com/rest-live-v20/development-guide/
Index ¶
- type AccountIdentifier
- type Client
- func (c *Client) Accounts(ctx context.Context) ([]AccountIdentifier, error)
- func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) error
- func (c *Client) NewRequest(method, path string, body interface{}) (*http.Request, error)
- func (c *Client) Pricing(ctx context.Context, actID string, instruments []string) ([]Price, error)
- type Price
- type PriceLiquidity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountIdentifier ¶
type AccountIdentifier struct { ID string `json:"id"` Tags []interface{} `json:"tags"` }
AccountIdentifier contains an Account ID and associated tags.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client holds configuration and state for the OANDA API client.
func NewClient ¶
NewClient returns a new OANDA client. If a nil httpClient is provided, http.DefaultClient will be used. To use API methods which require authentication, provide an http.Client that will perform the authentication. For example: golang.org/x/oauth2
func (*Client) Accounts ¶
func (c *Client) Accounts(ctx context.Context) ([]AccountIdentifier, error)
Accounts returns a list of all Accounts.
func (*Client) Do ¶
Do sends a request and returns the response. An error is returned if the request cannot be sent or if the API returns an error. If a response is received, the body response body is decoded and stored in the value pointed to by v. Inspiration: https://github.com/google/go-github/blob/master/github/github.go
func (*Client) NewRequest ¶
NewRequest creates an HTTP Request. The client baseURL is checked to confirm that it has a trailing slash. A relative URL should be provided without the leading slash. If a non-nil body is provided it will be JSON encoded and included in the request. Inspiration: https://github.com/google/go-github/blob/master/github/github.go
type Price ¶
type Price struct { Type string `json:"type"` Time time.Time `json:"time"` Bids []PriceLiquidity `json:"bids"` Asks []PriceLiquidity `json:"asks"` CloseoutBid string `json:"closeoutBid"` CloseoutAsk string `json:"closeoutAsk"` Tradeable bool `json:"tradeable"` Instrument string `json:"instrument"` }
Price is an Account-specific Price.
type PriceLiquidity ¶
PriceLiquidity is a list of prices and liquidity available on an Instrument. It is possible for this list to be empty if there is liquidity currently available for the Instrument in the Account.