tradier

package
v0.0.0-...-54ce5d6 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2017 License: MIT Imports: 13 Imported by: 2

Documentation

Overview

Package tradier provides a client for interacting with the Tradier API.

Usage:

import "github.com/google/go-github/github"

Getting started

The quickest way to get started is to request a non-expiring access token (or more formally, a refresh token) from Tradier. Initantiate a new *tradier.Client and provide an http.Client that can properly handle access token, such as one returned from the oauth2 library. Afterwards, you can use the different services to call specific endpoints.

import "golang.org/x/oauth2"

func main() {
  ts := oauth2.StaticTokenSource(
    &oauth2.Token{AccessToken: "... your access token ..."},
  )
  tc := oauth2.NewClient(oauth2.NoContext, ts)

  client := tradier.NewClient(tc)

  // Returns the profile of the user
  profile, _, err := client.User.Profile()
}

If the application is frontend-facing, then the authorization grant flow (https://tools.ietf.org/html/rfc6749#section-1.3.1) should be used to request an access token from the resource owner (the user). Detailed information regarding this process can be found on https://developer.tradier.com/documentation/oauth/getting-started.

Resources and structs

All resources from Tradier are mapped to its corresponding structs. These structs use pointer values in their fields except in the case of slices, which is referenced directly and hold a collection of pointer values. This is to ensure that there is a difference between a nil and zero value when marshalling a resource into its JSON representation.

In most cases (except for the /profile endpoint), the Tradier API returns a collection of objects differently, depending on whether the response is an array of objects, a single object, or an empty collection. For example:

// Array of objects
{
  orders: {
    order: [
      ...
    ]
  }
}

// Single object
{
  orders: {
    order: {
      ...
    }
  }
}

// Empty collection
{
  orders: "null"
}

There are structs, such as Orders, Watchlists, and Accounts, that represent these collections. In cases where a service method returns these structs, the underlying object can be accessed via indexing or length-checking. For example, if orders is an instance of Orders, acessing each of the orders can be done like so:

  • If order is an array of objects, it can be accessed though indexing on orders[i].
  • If order is a single object, it can be accessed on the zeroth element (i.e. orders[0]).
  • If order is "null", orders length will be zero, len(orders) == 0.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.

func Float64

func Float64(v float64) *float64

Float64 is a helper routine that allocates a new float64 value to store v and returns a pointer to it.

func Int

func Int(v int) *int

Int is a helper routine that allocates a new int value to store v and returns a pointer to it.

func Int64

func Int64(v int64) *int64

Int64 is a helper routine that allocates a new int64 value to store v and returns a pointer to it.

func String

func String(v string) *string

String is a helper routine that allocates a new string value to store v and returns a pointer to it.

Types

type Account

type Account struct {
	AccountNumber *string `json:"account_number,omitempty"`

	// Specific to orders
	Orders *AccountOrders `json:"orders,omitempty"`

	// Specific to profile
	Classification *string    `json:"classification,omitempty"`
	DateCreated    *time.Time `json:"date_created,omitempty"`
	DayTrader      *bool      `json:"day_trader,omitempty"`
	OptionLevel    *int       `json:"option_level,omitempty"`
	Status         *string    `json:"status,omitempty"`
	Type           *string    `json:"type,omitempty"`
	LastUpateDate  *time.Time `json:"last_update_date,omitempty"`

	// Specific to positions
	Positions *Positions `json:"positions,omitempty"`

	// Specific to gainloss
	GainLoss *GainLoss `json:"gainloss,omitempty"`

	// Specific to history
	History *History `json:"history,omitempty"`

	// Specific to balances
	Balances *Balances `json:"balances,omitempty"`
	// contains filtered or unexported fields
}

Account represents the account object.

func (*Account) MarshalJSON

func (a *Account) MarshalJSON() ([]byte, error)

MarshalJSON marshals Account into JSON

func (*Account) UnmarshalJSON

func (a *Account) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals account into Account object.

type AccountOrders

type AccountOrders Orders

AccountOrders is used to hold user orders

func (*AccountOrders) MarshalJSON

func (o *AccountOrders) MarshalJSON() ([]byte, error)

MarshalJSON marshals Orders into JSON.

func (*AccountOrders) UnmarshalJSON

func (o *AccountOrders) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON unmarshals orders into Orders object.

type AccountService

type AccountService service

AccountService handles routes related to account inquiry from the Tradier API.

func (*AccountService) Balances

func (s *AccountService) Balances(accountID string) (*Balances, *Response, error)

Balances returns the account's balance for clientID.

func (*AccountService) GainLoss

func (s *AccountService) GainLoss(accountID string) (*GainLoss, *Response, error)

GainLoss returns the account's cost basis for accountID.

func (*AccountService) History

func (s *AccountService) History(accountID string) (*History, *Response, error)

History returns the account's trading history for accountID.

func (*AccountService) OrderStatus

func (s *AccountService) OrderStatus(accountID, orderID string) (*Order, *Response, error)

OrderStatus returns the account's order status of orderID for accountID.

func (*AccountService) Orders

func (s *AccountService) Orders(accountID string) (*Orders, *Response, error)

Orders returns the account's orders for accountID.

func (*AccountService) Positions

func (s *AccountService) Positions(accountID string) (*Positions, *Response, error)

Positions returns the account's positions for accountID.

type Accounts

type Accounts []*Account

Accounts holds a slice of *Account.

func (*Accounts) MarshalJSON

func (a *Accounts) MarshalJSON() ([]byte, error)

MarshalJSON marshals Accounts into JSON.

func (*Accounts) UnmarshalJSON

func (a *Accounts) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON unmarshals accounts into Accounts object.

type Balances

type Balances struct {
	AccountNumber *string `json:"account_number,omitempty"`
	AccountType   *string `json:"account_type,omitempty"`
	Cash          *struct {
		CashAvailable  *float64 `json:"cash_available,omitempty"`
		Sweep          *float64 `json:"sweep,omitempty"`
		UnsettledFunds *float64 `json:"unsettled_funds,omitempty"`
	} `json:"cash,omitempty"`
	ClosePL            *float64 `json:"close_pl,omitempty"`
	CurrentRequirement *float64 `json:"current_requirement,omitempty"`
	DividendBalance    *float64 `json:"dividend_balance,omitempty"`
	Equity             *float64 `json:"equity,omitempty"`
	LongLiquidValue    *float64 `json:"long_liquid_value,omitempty"`
	LongLiquidMarket   *float64 `json:"long_market_value,omitempty"`
	Margin             *struct {
		FedCall           *float64 `json:"fed_call,omitempty"`
		MaintenanceCall   *float64 `json:"maintenance_call,omitempty"`
		OptionBuyingPower *float64 `json:"option_buying_power,omitempty"`
		StockBuyingPower  *float64 `json:"stock_buying_power,omitempty"`
		StockShortValue   *float64 `json:"stock_short_value,omitempty"`
		Sweep             *float64 `json:"sweep,omitempty"`
	} `json:"margin,omitempty"`
	MarketValue       *float64 `json:"market_value,omitempty"`
	NetValue          *float64 `json:"net_value,omitempty"`
	OpenPL            *float64 `json:"open_pl,omitempty"`
	OptionLongValue   *float64 `json:"option_long_value,omitempty"`
	OptionRequirement *float64 `json:"option_requirement,omitempty"`
	OptionShortValue  *float64 `json:"option_short_value,omitempty"`
	PDT               *struct {
		DayTradeBuyingPower *float64 `json:"day_trade_buying_power,omitempty"`
		FedCall             *float64 `json:"fed_call,omitempty"`
		MaintenanceCall     *float64 `json:"maintenance_call,omitempty"`
		OptionBuyingPower   *float64 `json:"option_buying_power,omitempty"`
		StockBuyingPower    *float64 `json:"stock_buying_power,omitempty"`
		StockShortValue     *float64 `json:"stock_short_value,omitempty"`
	} `json:"pdt,omitempty"`
	PendingCase        *float64 `json:"pending_cash,omitempty"`
	PendingOrdersCount *int     `json:"pending_orders_count,omitempty"`
	ShortLiquidValue   *float64 `json:"short_liquid_value,omitempty"`
	ShortMarketValue   *float64 `json:"short_market_value,omitempty"`
	StockLongValue     *float64 `json:"stock_long_value,omitempty"`
	UnclearedFunds     *float64 `json:"uncleared_funds,omitempty"`
	TotalCash          *float64 `json:"total_cash,omitempty"`
	TotalEquity        *float64 `json:"total_equity,omitempty"`
}

Balances represents the balances object.

func (*Balances) MarshalJSON

func (bal *Balances) MarshalJSON() ([]byte, error)

MarshalJSON marshals *Balances into its JSON representation

func (*Balances) UnmarshalJSON

func (bal *Balances) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals balances into *Balances object.

type Client

type Client struct {
	BaseURL *url.URL

	UserAgent string

	User       *UserService
	Account    *AccountService
	Order      *OrderService
	Watchlists *WatchlistsService
	Markets    *MarketsService
	// contains filtered or unexported fields
}

Client takes care of managing communication to the Tradier API.

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient creates a new Tradier API client. To use API methods that require authentication, an http.Client that performs proper authentication must be provided, such as one created with the golang.org/x/oauth2 library.

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*Response, error)

Do sends an API request and returns the response. It accepts an empty interface{} used to unmarshal the response into that object instance.

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

NewRequest creates an API request.

type ClosedPosition

type ClosedPosition struct {
	ClosedDate      *time.Time `json:"close_date,omitempty"`
	Cost            *float64   `json:"cost,omitempty"`
	GainLoss        *float64   `json:"gain_loss,omitempty"`
	GainLossPercent *float64   `json:"gain_loss_percent,omitempty"`
	OpenDate        *time.Time `json:"open_date,omitempty"`
	Proceeds        *float64   `json:"proceeds,omitempty"`
	Quantity        *int       `json:"quantity,omitempty"`
	Symbol          *string    `json:"symbol,omitempty"`
	Term            *int       `json:"term,omitempty"`
}

ClosedPosition represents the closed_position object.

type Data

type Data struct {
	Price     *float64 `json:"price,omitempty"`
	Time      *Time    `json:"time,omitempty"`
	Timestamp *int     `json:"timestamp,omitempty"`
	Volume    *int     `json:"volume,omitempty"`
}

Data represents the data JSON object from /markets/timesales.

type Event

type Event struct {
	Amount   *float64   `json:"amount,omitempty"`
	Date     *time.Time `json:"date,omitempty"`
	Interest *struct {
		Description *string `json:"description,omitempty"`
		Quantity    *int    `json:"quantity,omitempty"`
	} `json:"interest,omitempty"`
	Journal *struct {
		Quantity *int `json:"quantity,omitempty"`
	} `json:"journal,omitempty"`
	Option *struct {
		Description *string `json:"description,omitempty"`
		OptionType  *string `json:"option_type,omitempty"`
		Quantity    *int    `json:"quantity,omitempty"`
	} `json:"option,omitempty"`
	Type  *string `json:"type,omitempty"`
	Trade *struct {
		Commission  *float64 `json:"commission,omitempty"`
		Description *string  `json:"description,omitempty"`
		Price       *float64 `json:"price,omitempty"`
		Quantity    *int     `json:"quantity,omitempty"`
		Symbol      *string  `json:"symbol,omitempty"`
		TradeType   *string  `json:"trade_type,omitempty"`
	} `json:"trade,omitempty"`
}

Event represents the event object.

type GainLoss

type GainLoss struct {
	ClosedPosition []*ClosedPosition `json:"closed_position,omitempty"`
}

GainLoss represents the gainloss object.

func (*GainLoss) MarshalJSON

func (g *GainLoss) MarshalJSON() ([]byte, error)

MarshalJSON marshals GrainLoss into its JSON representation.

func (*GainLoss) UnmarshalJSON

func (g *GainLoss) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON unmarshals gain_loss into GainLoss object.

type History

type History struct {
	Event []*Event `json:"event,omitempty"`
}

History represents the history object.

func (*History) MarshalJSON

func (h *History) MarshalJSON() ([]byte, error)

MarshalJSON marshals History into its JSON representation.

func (*History) UnmarshalJSON

func (h *History) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON unmarshals history into History object.

type Items

type Items struct {
	Item []*WatchlistItem `json:"item,omitempty"`
}

Items represents the items JSON object.

func (*Items) MarshalJSON

func (i *Items) MarshalJSON() ([]byte, error)

MarshalJSON marshals Items into its JSON representation.

func (*Items) UnmarshalJSON

func (i *Items) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals items into Items object.

type MarketsService

type MarketsService service

MarketsService handles routes related to orders from the Tradier API.

func (*MarketsService) Quotes

func (s *MarketsService) Quotes(symbols []string) (*Quotes, *Response, error)

Quotes returns the quotes for a set of symbols.

func (*MarketsService) TimeSales

func (s *MarketsService) TimeSales(params *TimeSalesParams) (*Series, *Response, error)

TimeSales returns the time and sales for a given symbol.

type Order

type Order struct {
	AvgFillPrice      *float64   `json:"avg_fill_price,omitempty"`
	Class             *string    `json:"class,omitempty"`
	CreateDate        *time.Time `json:"create_date,omitempty"`
	Duration          *string    `json:"duration,omitempty"`
	ExecQuantity      *float64   `json:"exec_quantity,omitempty"`
	ID                *int       `json:"id,omitempty"`
	LastFillPrice     *float64   `json:"last_fill_price,omitempty"`
	LastFillQuantity  *float64   `json:"last_fill_quantity,omitempty"`
	Quantity          *float64   `json:"quantity,omitempty"`
	RemainingQuantity *float64   `json:"remaining_quantity,omitempty"`
	Side              *string    `json:"side,omitempty"`
	Status            *string    `json:"status,omitempty"`
	Symbol            *string    `json:"symbol,omitempty"`
	TransactionDate   *time.Time `json:"transaction_date,omitempty"`
	Type              *string    `json:"type,omitempty"`

	// Specific to order creation
	PartnerID *string `json:"partner_id,omitempty"`

	// Specific to order preview
	Commission    *float64 `json:"commission,omitempty"`
	Cost          *float64 `json:"cost,omitempty"`
	ExtendedHours *bool    `json:"extended_hours,omitempty"`
	Fees          *float64 `json:"fees,omitempty"`
	MarginChange  *float64 `json:"margin_change,omitempty"`
	OrderCost     *float64 `json:"order_cost,omitempty"`
	Result        *bool    `json:"result,omitempty"`   // Not present in documentation
	Strategy      *string  `json:"strategy,omitempty"` // Not present in documentation, specific to multileg
	// contains filtered or unexported fields
}

Order represents the `order` JSON object.

func (*Order) MarshalJSON

func (o *Order) MarshalJSON() ([]byte, error)

MarshalJSON marshals Order into its JSON representation.

func (*Order) UnmarshalJSON

func (o *Order) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals order into Order object.

type OrderParams

type OrderParams struct {
	Class        string  `url:"class"`
	Symbol       string  `url:"symbol"`
	Duration     string  `url:"duration"`
	Side         string  `url:"side,omitempty"`
	Quantity     int     `url:"quantity,omitempty"`
	Type         string  `url:"type"`
	Price        float64 `url:"price,omitempty"`
	Stop         float64 `url:"stop,omitempty"`
	OptionSymbol string  `url:"option_symbol,omitempty"`

	// Specific to multileg orders
	MultiSide         []string `url:"side,omitempty,[]"`
	MultiQuantity     []int    `url:"quantity,omitempty,[]"`
	MultiOptionSymbol []string `url:"option_symbol,omitempty,[]"`

	// Specific to preview
	Preview bool `url:"preview,omitempty"`
}

OrderParams specifies the query parameters for querying an order. Refer to https://godoc.org/github.com/google/go-querystring/query for building the struct mapping.

type OrderService

type OrderService service

OrderService handles routes related to orders from the Tradier API.

func (*OrderService) Create

func (s *OrderService) Create(accountID string, params *OrderParams) (*Order, *Response, error)

Create sends an order creation request. This method supports single-sided orders as well as multileg and combo orders.

func (*OrderService) Delete

func (s *OrderService) Delete(accountID, orderID string) (*Order, *Response, error)

Delete sends an order deletion/cancellation request.

func (*OrderService) Preview

func (s *OrderService) Preview(accountID string, params *OrderParams) (*Order, *Response, error)

Preview sends an order preview request.

func (*OrderService) Update

func (s *OrderService) Update(accountID, orderID string, params *OrderParams) (*Order, *Response, error)

Update sends an order update request.

type Orders

type Orders []*Order

Orders represents the orders JSON object.

func (*Orders) MarshalJSON

func (o *Orders) MarshalJSON() ([]byte, error)

MarshalJSON marshals Orders into JSON.

func (*Orders) UnmarshalJSON

func (o *Orders) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON unmarshals orders into Orders object.

type Position

type Position struct {
	CostBasis    *float64   `json:"cost_basis,omitempty"`
	DateAcquired *time.Time `json:"date_acquired,omitempty"`
	ID           *int       `json:"id,omitempty"`
	Quantity     *float64   `json:"quantity,omitempty"`
	Symbol       *string    `json:"symbol,omitempty"`
}

Position represents the position JSON object.

type Positions

type Positions []*Position

Positions represents the positions JSON object.

func (*Positions) MarshalJSON

func (p *Positions) MarshalJSON() ([]byte, error)

MarshalJSON marshals Positions into JSON.

func (*Positions) UnmarshalJSON

func (p *Positions) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals positions into Positions object.

type Profile

type Profile struct {
	Account []*Account `json:"account,omitempty"`
	ID      *string    `json:"id,omitempty"`
	Name    *string    `json:"name,omitempty"`
}

Profile represents the profile JSON object.

type Quote

type Quote struct {
	Symbol           *string  `json:"symbol"`
	Description      *string  `json:"description"`
	Exch             *string  `json:"exch"`
	Type             *string  `json:"type"`
	Last             *float64 `json:"last"`
	Change           *float64 `json:"change"`
	ChangePercentage *float64 `json:"change_percentage"`
	Volume           *int     `json:"volume"`
	AverageVolume    *int     `json:"average_volume"`
	LastVolume       *int     `json:"last_volume"`
	TradeDate        *int64   `json:"trade_date"`
	Open             *float64 `json:"open"`
	High             *float64 `json:"high"`
	Low              *float64 `json:"low"`
	Close            *float64 `json:"close"`
	Prevclose        *float64 `json:"prevclose"`
	Week52High       *float64 `json:"week_52_high"`
	Week52Low        *float64 `json:"week_52_low"`
	Bid              *float64 `json:"bid"`
	Bidsize          *int     `json:"bidsize"`
	Bidexch          *string  `json:"bidexch"`
	BidDate          *int64   `json:"bid_date"`
	Ask              *float64 `json:"ask"`
	Asksize          *int     `json:"asksize"`
	Askexch          *string  `json:"askexch"`
	AskDate          *int64   `json:"ask_date"`
	RootSymbols      *string  `json:"root_symbols"`
}

Quote represents the quote JSON object.

func (*Quote) MarshalJSON

func (q *Quote) MarshalJSON() ([]byte, error)

MarshalJSON marshals Quote into its JSON representation.

func (*Quote) UnmarshalJSON

func (q *Quote) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals quote into Quote object.

type Quotes

type Quotes []*Quote

Quotes represents the quotes JSON object.

func (*Quotes) MarshalJSON

func (q *Quotes) MarshalJSON() ([]byte, error)

MarshalJSON marshals Quotes into its JSON representation.

func (*Quotes) UnmarshalJSON

func (q *Quotes) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals quotes into Quotes object.

type Response

type Response struct {
	*http.Response
}

Response is the Tradier API response. It wraps the standard http.Response from Traider along with rate limits from the header so that it can be more easily accessed

type Series

type Series struct {
	Data []*Data `json:"data,omitempty"`
}

Series represents the series JSON object from /markets/timesales.

func (*Series) MarshalJSON

func (s *Series) MarshalJSON() ([]byte, error)

MarshalJSON marshals Series into its JSON representation.

func (*Series) UnmarshalJSON

func (s *Series) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals series into Series object.

type Time

type Time struct {
	time.Time
}

Time is the custom time-formatted time

func (*Time) MarshalJSON

func (t *Time) MarshalJSON() ([]byte, error)

MarshalJSON marshals Time into timesales compatible time format

func (Time) String

func (t Time) String() string

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals custom JSON time format for timesales date

type TimeSalesParams

type TimeSalesParams struct {
	Symbol        string `url:"symbol"`
	Interval      string `url:"interval,omitempty"`
	Start         string `url:"start,omitempty"`
	End           string `url:"end,omitempty"`
	SessionFilter string `url:"session_filter,omitempty"`
}

TimeSalesParams specifies the query parameters for querying time and sales for a particular symbol.

type User

type User struct {
	// Profile is specific to users/profile
	Profile *Profile `json:"profile,omitempty"`

	Accounts *Accounts `json:"accounts,omitempty"`
}

User represents the user JSON object.

func (*User) MarshalJSON

func (u *User) MarshalJSON() ([]byte, error)

MarshalJSON marshals Accounts into JSON

type UserService

type UserService service

UserService handles routes related to user inquiry from the Tradier API.

func (*UserService) Balances

func (s *UserService) Balances() (*User, *Response, error)

Balances returns the user's balances for all accounts.

func (*UserService) GainLoss

func (s *UserService) GainLoss() (*User, *Response, error)

GainLoss returns the user's cost basis for all accounts.

func (*UserService) History

func (s *UserService) History() (*User, *Response, error)

History returns the user's trading history for all accounts.

func (*UserService) Orders

func (s *UserService) Orders() (*User, *Response, error)

Orders returns the user's orders for all accounts.

func (*UserService) Positions

func (s *UserService) Positions() (*User, *Response, error)

Positions returns the user's positions for all accounts.

func (*UserService) Profile

func (s *UserService) Profile() (*User, *Response, error)

Profile returns the user's profile information. This includes basic information for all accounts under that user.

type Watchlist

type Watchlist struct {
	Name     *string `json:"name,omitempty"`
	ID       *string `json:"id,omitempty"`
	PublicID *string `json:"public_id,omitempty"`
	Items    *Items  `json:"items,omitempty"`
	// contains filtered or unexported fields
}

Watchlist represents the watchlist JSON object.

func (*Watchlist) MarshalJSON

func (w *Watchlist) MarshalJSON() ([]byte, error)

MarshalJSON marshals Watchlist into its JSON representation.

func (*Watchlist) UnmarshalJSON

func (w *Watchlist) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals watchlist into Watchlist object.

type WatchlistItem

type WatchlistItem struct {
	Symbol *string `json:"symbol,omitempty"`
	ID     *string `json:"id,omitempty"`
}

WatchlistItem represents the item JSON object from the watclist item collection.

type WatchlistParams

type WatchlistParams struct {
	Name    string   `url:"name"`
	Symbols []string `url:"symbols,omitempty,comma"`
}

WatchlistParams specifies the query parameters for handling watchlist creation. Refer to https://godoc.org/github.com/google/go-querystring/query for building the struct mapping.

type Watchlists

type Watchlists []*Watchlist

Watchlists represents the watchlists JSON object.

func (*Watchlists) MarshalJSON

func (w *Watchlists) MarshalJSON() ([]byte, error)

MarshalJSON marshals Watchlists into its JSON representation.

func (*Watchlists) UnmarshalJSON

func (w *Watchlists) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals watchlists into Watchlists object.

type WatchlistsService

type WatchlistsService service

WatchlistsService handles routes related to watchlists from the Tradier API.

func (*WatchlistsService) All

func (s *WatchlistsService) All() (*Watchlists, *Response, error)

All returns all watchlists for the user.

func (*WatchlistsService) Create

func (s *WatchlistsService) Create(name string, params *WatchlistParams) (*Watchlist, *Response, error)

Create sends an watchlist creation request.

func (*WatchlistsService) Delete

func (s *WatchlistsService) Delete(watchlistID string) (*Watchlists, *Response, error)

Delete sends an watchlist deletion request.

func (*WatchlistsService) Get

func (s *WatchlistsService) Get(watchlistID string) (*Watchlist, *Response, error)

Get returns the watchlist for watchlistID.

Directories

Path Synopsis
Package errors handles multiple errors that can be returned from the Tradier API Example: { "errors": { "error": [ "Backoffice rejected override of the order.", "InitialMargin" ] } }
Package errors handles multiple errors that can be returned from the Tradier API Example: { "errors": { "error": [ "Backoffice rejected override of the order.", "InitialMargin" ] } }

Jump to

Keyboard shortcuts

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