gotd

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

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

Go to latest
Published: Oct 9, 2020 License: MIT Imports: 22 Imported by: 2

README

gotd - TD Ameritrade API in Go

GoDoc

Table of Contents

Apply

Installation

$ go get github.com/z-Wind/gotd

Examples

HTTP
auth := NewAuth()
client := auth.GetClient(clientsecretPath, "TDAmeritrade-go.json")
td, err := New(client)
HTTPS
auth := NewAuth()
auth.SetTLS(TLSCertPath, TLSKeyPath)
client := auth.GetClient(clientsecretPath, "TDAmeritrade-go.json")
td, err := New(client)
Quotes
call := td.Quotes.GetQuote("VTI")
quote, err := call.Do()

Reference

Documentation

Index

Examples

Constants

View Source
const (
	AccountFieldPositions = "positions"
	AccountFieldOrders    = "orders"

	InstrumentsProjectionSymbolSearch = "symbol-search"
	InstrumentsProjectionSymbolRegex  = "symbol-regex"
	InstrumentsProjectionDescSearch   = "desc-search"
	InstrumentsProjectionDescRegex    = "desc-regex"
	InstrumentsProjectionFundamental  = "fundamental"

	HoursMarketsEQUITY = "EQUITY"
	HoursMarketsOPTION = "OPTION"
	HoursMarketsFUTURE = "FUTURE"
	HoursMarketsBOND   = "BOND"
	HoursMarketsFOREX  = "FOREX"

	MoversIndexCOMPX    = "$COMPX"
	MoversIndexDJI      = "$DJI"
	MoversIndexSPXX     = "$SPX.X"
	MoversDirectionUp   = "up"
	MoversDirectionDown = "down"
	MoversChangePercent = "percent"
	MoversChangeValue   = "value"

	OptionChainContractTypeCALL   = "CALL"
	OptionChainContractTypePUT    = "PUT"
	OptionChainContractTypeALL    = "ALL"
	OptionChainStrategySINGLE     = "SINGLE"
	OptionChainStrategyANALYTICAL = "ANALYTICAL"
	OptionChainStrategyCOVERED    = "COVERED"
	OptionChainStrategyVERTICAL   = "VERTICAL"
	OptionChainStrategyCALENDAR   = "CALENDAR"
	OptionChainStrategySTRANGLE   = "STRANGLE"
	OptionChainStrategySTRADDLE   = "STRADDLE"
	OptionChainStrategyBUTTERFLY  = "BUTTERFLY"
	OptionChainStrategyCONDOR     = "CONDOR"
	OptionChainStrategyDIAGONAL   = "DIAGONAL"
	OptionChainStrategyCOLLAR     = "COLLAR"
	OptionChainStrategyROLL       = "ROLL"
	OptionChainRangeITM           = "ITM"
	OptionChainRangeNTM           = "NTM"
	OptionChainRangeOTM           = "OTM"
	OptionChainRangeSAK           = "SAK"
	OptionChainRangeSBK           = "SBK"
	OptionChainRangeSNK           = "SNK"
	OptionChainRangeALL           = "ALL"
	OptionChainExpMonthJAN        = "JAN"
	OptionChainExpMonthFEB        = "FEB"
	OptionChainExpMonthMAR        = "MAR"
	OptionChainExpMonthAPR        = "APR"
	OptionChainExpMonthMAY        = "MAY"
	OptionChainExpMonthJUN        = "JUN"
	OptionChainExpMonthJULY       = "JULY"
	OptionChainExpMonthAUG        = "AUG"
	OptionChainExpMonthSEP        = "SEP"
	OptionChainExpMonthOCT        = "OCT"
	OptionChainExpMonthNOV        = "NOV"
	OptionChainExpMonthDEC        = "DEC"
	OptionChainExpMonthALL        = "ALL"
	OptionChainTypeS              = "S"
	OptionChainTypeNS             = "NS"
	OptionChainTypeALL            = "ALL"

	PriceHistoryPeriodTypeDay        = "day"
	PriceHistoryPeriodTypeMonth      = "month"
	PriceHistoryPeriodTypeYear       = "year"
	PriceHistoryPeriodTypeYtd        = "ytd"
	PriceHistoryFrequencyTypeMinute  = "minute"
	PriceHistoryFrequencyTypeDaily   = "daily"
	PriceHistoryFrequencyTypeWeekly  = "weekly"
	PriceHistoryFrequencyTypeMonthly = "monthly"

	TransactionsKindALL             = "ALL"
	TransactionsKindTRADE           = "TRADE"
	TransactionsKindBUYONLY         = "BUY_ONLY"
	TransactionsKindSELLONLY        = "SELL_ONLY"
	TransactionsKindCASHInOrCASHOut = "CASH_IN_OR_CASH_OUT"
	TransactionsKindCHECKING        = "CHECKING"
	TransactionsKindDIVIDEND        = "DIVIDEND"
	TransactionsKindINTEREST        = "INTEREST"
	TransactionsKindOTHER           = "OTHER"
	TransactionsKindADVISORFEES     = "ADVISOR_FEES"

	UserPrincipalsFieldsStreamerSubscriptionKeys = "streamerSubscriptionKeys"
	UserPrincipalsFieldsStreamerConnectionInfo   = "streamerConnectionInfo"
	UserPrincipalsFieldsPreferences              = "preferences"
	UserPrincipalsFieldsSurrogateIds             = "surrogateIds"

	OrdersStatusAWAITINGPARENTORDER      = "AWAITING_PARENT_ORDER"
	OrdersStatusAWAITINGCONDITION        = "AWAITING_CONDITION"
	OrdersStatusAWAITINGMANUALREVIEW     = "AWAITING_MANUAL_REVIEW"
	OrdersStatusACCEPTED                 = "ACCEPTED"
	OrdersStatusAWAITINGUROUT            = "AWAITING_UR_OUT"
	OrdersStatusPENDINGACTIVATION        = "PENDING_ACTIVATION"
	OrdersStatusQUEUED                   = "QUEUED"
	OrdersStatusWORKING                  = "WORKING"
	OrdersStatusREJECTED                 = "REJECTED"
	OrdersStatusPENDINGCANCEL            = "PENDING_CANCEL"
	OrdersStatusCANCELED                 = "CANCELED"
	OrdersStatusPENDINGREPLACE           = "PENDING_REPLACE"
	OrdersStatusREPLACED                 = "REPLACED"
	OrdersStatusFILLED                   = "FILLED"
	OrdersStatusEXPIRED                  = "EXPIRED"
	OrderInstructionBuy                  = "BUY"
	OrderInstructionSELL                 = "SELL"
	OrderAssetTypeEQUITY                 = "EQUITY"
	OrderAssetTypeOPTION                 = "OPTION"
	OrderAssetTypeINDEX                  = "INDEX"
	OrderAssetTypeMUTUALFUND             = "MUTUAL_FUND"
	OrderAssetTypeCASHEQUIVALENT         = "CASH_EQUIVALENT"
	OrderAssetTypeFIXEDINCOME            = "FIXED_INCOME"
	OrderAssetTypeCURRENCYOrderAssetType = "CURRENCYOrderAssetType"

	PreferencesTimeoutFIFTYFIVEMINUTES = "FIFTY_FIVE_MINUTES"
	PreferencesTimeoutTWOHOURS         = "TWO_HOURS"
	PreferencesTimeoutFOURHOURS        = "FOUR_HOURS"
	PreferencesTimeoutEIGHTHOURS       = "EIGHT_HOURS"

	TokenGrantTypeAuthorizationCode = "authorization_code"
	TokenGrantTypeRefreshToken      = "refresh_token"
	TokenAccessTypeOffline          = "offline"
	TokenAccessTypeOnline           = "online"
)

setting value

View Source
const (
	// Version defines the gax version being used. This is typically sent
	// in an HTTP header to services.
	Version = "0.5"

	// UserAgent is the header string used to identify this package.
	UserAgent = "td-api-go-client/" + Version
)

Variables

This section is empty.

Functions

func CheckResponse

func CheckResponse(res *http.Response) error

CheckResponse returns an error (of type *Error) if the response status code is not 2xx.

func DecodeResponse

func DecodeResponse(target interface{}, res *http.Response) error

DecodeResponse decodes the body of res into target. If there is no body, target is unchanged.

func JSONReader

func JSONReader(v interface{}) (io.Reader, error)

JSONReader convert struct to reader for json request

func ResolveRelative

func ResolveRelative(basePath string, elem ...string) string

ResolveRelative join path

func SendRequest

func SendRequest(ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error)

SendRequest sends a single HTTP request using the given client. If ctx is non-nil, it sends the request with req.WithContext

Types

type Account

type Account struct {
	SecuritiesAccount `json:"securitiesAccount,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	ServerResponse `json:"-"`
}

Account https://developer.tdameritrade.com/account-access/apis

type AccountList

type AccountList struct {
	Accounts []*Account

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	ServerResponse `json:"-"`
}

AccountList https://developer.tdameritrade.com/account-access/apis

type AccountU

type AccountU struct {
	AccountID         string            `json:"accountId,omitempty"`         //"string"
	Description       string            `json:"description,omitempty"`       //"string"
	DisplayName       string            `json:"displayName,omitempty"`       //"string"
	AccountCdDomainID string            `json:"accountCdDomainId,omitempty"` //"string"
	Company           string            `json:"company,omitempty"`           //"string"
	Segment           string            `json:"segment,omitempty"`           //"string"
	SurrogateIds      map[string]string `json:"surrogateIds,omitempty"`      //"object"
	Preferences       Preferences       `json:"preferences,omitempty"`
	ACL               string            `json:"acl,omitempty"` //"string"
	Authorizations    Authorizations    `json:"authorizations,omitempty"`
}

AccountU https://developer.tdameritrade.com/user-principal/apis

type AccountsGetAccountCall

type AccountsGetAccountCall struct {
	DefaultCall
	// contains filtered or unexported fields
}

AccountsGetAccountCall https://developer.tdameritrade.com/account-access/apis/get/accounts/%7BaccountId%7D-0 Account balances, positions, and orders for a specific account.

func (*AccountsGetAccountCall) Do

func (c *AccountsGetAccountCall) Do() (*Account, error)

Do send request

func (*AccountsGetAccountCall) Fields

Fields https://developer.tdameritrade.com/account-access/apis/get/accounts/%7BaccountId%7D-0 Balances displayed by default, additional fields can be added here by adding positions or orders Example: fields=positions,orders

type AccountsGetAccountListCall

type AccountsGetAccountListCall struct {
	DefaultCall
}

AccountsGetAccountListCall https://developer.tdameritrade.com/account-access/apis/get/accounts-0 Account balances, positions, and orders for all linked accounts.

func (*AccountsGetAccountListCall) Do

Do send request

func (*AccountsGetAccountListCall) Fields

Fields https://developer.tdameritrade.com/account-access/apis/get/accounts-0 Balances displayed by default, additional fields can be added here by adding positions or orders Example: fields=positions,orders

type AccountsService

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

AccountsService https://developer.tdameritrade.com/account-access/apis APIs to access Account Balances, Positions, Trade Info and place Trades

func NewAccountsService

func NewAccountsService(s *Service) *AccountsService

NewAccountsService https://developer.tdameritrade.com/account-access/apis APIs to access Account Balances, Positions, Trade Info and place Trades

func (*AccountsService) GetAccount

func (r *AccountsService) GetAccount(accountID string) *AccountsGetAccountCall

GetAccount https://developer.tdameritrade.com/account-access/apis/get/accounts/%7BaccountId%7D-0 Account balances, positions, and orders for a specific account.

func (*AccountsService) GetAccountList

func (r *AccountsService) GetAccountList() *AccountsGetAccountListCall

GetAccountList https://developer.tdameritrade.com/account-access/apis/get/accounts-0 Account balances, positions, and orders for all linked accounts.

type Auth

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

Auth for oauth2

func NewAuth

func NewAuth() *Auth

NewAuth create Auth

func (*Auth) GetClient

func (a *Auth) GetClient(clientsecretPath, tokenFile string) *http.Client

GetClient generate a Client. It returns the generated Client. clientsecret file format reference to client_secret.json.sample

Example
auth := NewAuth()
client := auth.GetClient(clientsecretPath, "TDAmeritrade-go.json")
_, err := New(client)
if err != nil {
	log.Fatal(err)
}
Example (Tls)
auth := NewAuth()
auth.SetTLS("./instance/cert.pem", "./instance/key.pem")
client := auth.GetClient(clientsecretPath, "TDAmeritrade-go.json")
_, err := New(client)
if err != nil {
	log.Fatal(err)
}

func (*Auth) SetTLS

func (a *Auth) SetTLS(TLSCertPath, TLSKeyPath string)

SetTLS when redirectURL is TLS, it should be setted

type Authorizations

type Authorizations struct {
	Apex               bool   `json:"apex,omitempty"`
	LevelTwoQuotes     bool   `json:"levelTwoQuotes,omitempty"`
	StockTrading       bool   `json:"stockTrading,omitempty"`
	MarginTrading      bool   `json:"marginTrading,omitempty"`
	StreamingNews      bool   `json:"streamingNews,omitempty"`
	OptionTradingLevel string `json:"optionTradingLevel,omitempty"` //"'COVERED' or 'FULL' or 'LONG' or 'SPREAD' or 'NONE'"
	StreamerAccess     bool   `json:"streamerAccess,omitempty"`
	AdvancedMargin     bool   `json:"advancedMargin,omitempty"`
	ScottradeAccount   bool   `json:"scottradeAccount,omitempty"`
}

Authorizations https://developer.tdameritrade.com/user-principal/apis

type Candle

type Candle struct {
	Close    float64 `json:"close,omitempty"`
	Datetime Time    `json:"datetime,omitempty"`
	High     float64 `json:"high,omitempty"`
	Low      float64 `json:"low,omitempty"`
	Open     float64 `json:"open,omitempty"`
	Volume   float64 `json:"volume,omitempty"`
}

Candle https://developer.tdameritrade.com/price-history/apis

type CurrentBalances

type CurrentBalances struct {
	AccruedInterest              float64 `json:"accruedInterest,omitempty"`
	CashBalance                  float64 `json:"cashBalance,omitempty"`
	CashReceipts                 float64 `json:"cashReceipts,omitempty"`
	LongOptionMarketValue        float64 `json:"longOptionMarketValue,omitempty"`
	LiquidationValue             float64 `json:"liquidationValue,omitempty"`
	LongMarketValue              float64 `json:"longMarketValue,omitempty"`
	MoneyMarketFund              float64 `json:"moneyMarketFund,omitempty"`
	Savings                      float64 `json:"savings,omitempty"`
	ShortMarketValue             float64 `json:"shortMarketValue,omitempty"`
	PendingDeposits              float64 `json:"pendingDeposits,omitempty"`
	CashAvailableForTrading      float64 `json:"cashAvailableForTrading,omitempty"`
	CashAvailableForWithdrawal   float64 `json:"cashAvailableForWithdrawal,omitempty"`
	CashCall                     float64 `json:"cashCall,omitempty"`
	LongNonMarginableMarketValue float64 `json:"longNonMarginableMarketValue,omitempty"`
	TotalCash                    float64 `json:"totalCash,omitempty"`
	ShortOptionMarketValue       float64 `json:"shortOptionMarketValue,omitempty"`
	MutualFundValue              float64 `json:"mutualFundValue,omitempty"`
	BondValue                    float64 `json:"bondValue,omitempty"`
	CashDebitCallValue           float64 `json:"cashDebitCallValue,omitempty"`
	UnsettledCash                float64 `json:"unsettledCash,omitempty"`
}

CurrentBalances https://developer.tdameritrade.com/account-access/apis

type DefaultCall

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

DefaultCall call template

func (*DefaultCall) Context

func (c *DefaultCall) Context(ctx context.Context) *DefaultCall

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*DefaultCall) Header

func (c *DefaultCall) Header() http.Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

type Error

type Error struct {
	// Code is the HTTP response status code and will always be populated.
	Code int `json:"code,omitempty"`
	// Message is the server response message and is only populated when
	// explicitly referenced by the JSON server response.
	Message string `json:"message,omitempty"`
	// Body is the raw response returned by the server.
	// It is often but not always JSON, depending on how the request fails.
	Body string
	// Header contains the response header fields from the server.
	Header http.Header
}

Error contains an error response from the server.

func (*Error) Error

func (e *Error) Error() string

type Execution

type Execution struct {
	ActivityType           string          `json:"activityType,omitempty"`  //"'EXECUTION' or 'ORDER_ACTION'",
	ExecutionType          string          `json:"executionType,omitempty"` //"'FILL'",
	Quantity               float64         `json:"quantity,omitempty"`
	OrderRemainingQuantity float64         `json:"orderRemainingQuantity,omitempty"`
	ExecutionLegs          []*ExecutionLeg `json:"executionLegs,omitempty"`
}

Execution https://developer.tdameritrade.com/account-access/apis

type ExecutionLeg

type ExecutionLeg struct {
	LegID             int64   `json:"legId,omitempty"`
	Quantity          float64 `json:"quantity,omitempty"`
	MismarkedQuantity float64 `json:"mismarkedQuantity,omitempty"`
	Price             float64 `json:"price,omitempty"`
	Time              string  `json:"time,omitempty"`
}

ExecutionLeg https://developer.tdameritrade.com/account-access/apis

type Fees

type Fees struct {
	RFee          float64 `json:"rFee,omitempty"`
	AdditionalFee float64 `json:"additionalFee,omitempty"`
	CDSCFee       float64 `json:"cdscFee,omitempty"`
	RegFee        float64 `json:"regFee,omitempty"`
	OtherCharges  float64 `json:"otherCharges,omitempty"`
	Commission    float64 `json:"commission,omitempty"`
	OptRegFee     float64 `json:"optRegFee,omitempty"`
	SecFee        float64 `json:"secFee,omitempty"`
}

Fees https://developer.tdameritrade.com/transaction-history/apis

type FundamentalData

type FundamentalData struct {
	Symbol              string  `json:"symbol,omitempty"`
	High52              float64 `json:"high52,omitempty"`
	Low52               float64 `json:"low52,omitempty"`
	DividendAmount      float64 `json:"dividendAmount,omitempty"`
	DividendYield       float64 `json:"dividendYield,omitempty"`
	DividendDate        string  `json:"dividendDate,omitempty"`
	PeRatio             float64 `json:"peRatio,omitempty"`
	PegRatio            float64 `json:"pegRatio,omitempty"`
	PbRatio             float64 `json:"pbRatio,omitempty"`
	PrRatio             float64 `json:"prRatio,omitempty"`
	PcfRatio            float64 `json:"pcfRatio,omitempty"`
	GrossMarginTTM      float64 `json:"grossMarginTTM,omitempty"`
	GrossMarginMRQ      float64 `json:"grossMarginMRQ,omitempty"`
	NetProfitMarginTTM  float64 `json:"netProfitMarginTTM,omitempty"`
	NetProfitMarginMRQ  float64 `json:"netProfitMarginMRQ,omitempty"`
	OperatingMarginTTM  float64 `json:"operatingMarginTTM,omitempty"`
	OperatingMarginMRQ  float64 `json:"operatingMarginMRQ,omitempty"`
	ReturnOnEquity      float64 `json:"returnOnEquity,omitempty"`
	ReturnOnAssets      float64 `json:"returnOnAssets,omitempty"`
	ReturnOnInvestment  float64 `json:"returnOnInvestment,omitempty"`
	QuickRatio          float64 `json:"quickRatio,omitempty"`
	CurrentRatio        float64 `json:"currentRatio,omitempty"`
	InterestCoverage    float64 `json:"interestCoverage,omitempty"`
	TotalDebtToCapital  float64 `json:"totalDebtToCapital,omitempty"`
	LtDebtToEquity      float64 `json:"ltDebtToEquity,omitempty"`
	TotalDebtToEquity   float64 `json:"totalDebtToEquity,omitempty"`
	EpsTTM              float64 `json:"epsTTM,omitempty"`
	EpsChangePercentTTM float64 `json:"epsChangePercentTTM,omitempty"`
	EpsChangeYear       float64 `json:"epsChangeYear,omitempty"`
	EpsChange           float64 `json:"epsChange,omitempty"`
	RevChangeYear       float64 `json:"revChangeYear,omitempty"`
	RevChangeTTM        float64 `json:"revChangeTTM,omitempty"`
	RevChangeIn         float64 `json:"revChangeIn,omitempty"`
	SharesOutstanding   float64 `json:"sharesOutstanding,omitempty"`
	MarketCapFloat      float64 `json:"marketCapFloat,omitempty"`
	MarketCap           float64 `json:"marketCap,omitempty"`
	BookValuePerShare   float64 `json:"bookValuePerShare,omitempty"`
	ShortIntToFloat     float64 `json:"shortIntToFloat,omitempty"`
	ShortIntDayToCover  float64 `json:"shortIntDayToCover,omitempty"`
	DivGrowthRate3Year  float64 `json:"divGrowthRate3Year,omitempty"`
	DividendPayAmount   float64 `json:"dividendPayAmount,omitempty"`
	DividendPayDate     string  `json:"dividendPayDate,omitempty"`
	Beta                float64 `json:"beta,omitempty"`
	Vol1DayAvg          float64 `json:"vol1DayAvg,omitempty"`
	Vol10DayAvg         float64 `json:"vol10DayAvg,omitempty"`
	Vol3MonthAvg        float64 `json:"vol3MonthAvg,omitempty"`
}

FundamentalData https://developer.tdameritrade.com/instruments/apis

type InitialBalances

type InitialBalances struct {
	AccruedInterest            float64 `json:"accruedInterest,omitempty"`
	CashAvailableForTrading    float64 `json:"cashAvailableForTrading,omitempty"`
	CashAvailableForWithdrawal float64 `json:"cashAvailableForWithdrawal,omitempty"`
	CashBalance                float64 `json:"cashBalance,omitempty"`
	BondValue                  float64 `json:"bondValue,omitempty"`
	CashReceipts               float64 `json:"cashReceipts,omitempty"`
	LiquidationValue           float64 `json:"liquidationValue,omitempty"`
	LongOptionMarketValue      float64 `json:"longOptionMarketValue,omitempty"`
	LongStockValue             float64 `json:"longStockValue,omitempty"`
	MoneyMarketFund            float64 `json:"moneyMarketFund,omitempty"`
	MutualFundValue            float64 `json:"mutualFundValue,omitempty"`
	ShortOptionMarketValue     float64 `json:"shortOptionMarketValue,omitempty"`
	ShortStockValue            float64 `json:"shortStockValue,omitempty"`
	IsInCall                   bool    `json:"isInCall,omitempty"`
	UnsettledCash              float64 `json:"unsettledCash,omitempty"`
	CashDebitCallValue         float64 `json:"cashDebitCallValue,omitempty"`
	PendingDeposits            float64 `json:"pendingDeposits,omitempty"`
	AccountValue               float64 `json:"accountValue,omitempty"`
}

InitialBalances https://developer.tdameritrade.com/account-access/apis

type Instrument

type Instrument struct {
	// ServerResponse contains the HTTP response code and headers from the
	// server.
	ServerResponse `json:"-"`

	Cusip       string `json:"cusip,omitempty"`
	Symbol      string `json:"symbol,omitempty"`
	Description string `json:"description,omitempty"`
	Exchange    string `json:"exchange,omitempty"`
	AssetType   string `json:"assetType,omitempty"` //"'EQUITY' or 'ETF' or 'FOREX' or 'FUTURE' or 'FUTURE_OPTION' or 'INDEX' or 'INDICATOR' or 'MUTUAL_FUND' or 'OPTION' or 'UNKNOWN' or 'BOND'"

	Fundamental *FundamentalData `json:"fundamental,omitempty"`
	BondPrice   float64          `json:"bondPrice,omitempty"` // for "'BOND'"

	// OPTION
	//Cusip              string               `json:"cusip,omitempty"`
	//Symbol             string               `json:"symbol,omitempty"`
	//Description        string               `json:"description,omitempty"`
	Type               string               `json:"type,omitempty"`    //"'VANILLA' or 'BINARY' or 'BARRIER'",
	PutCall            string               `json:"putCall,omitempty"` //"'PUT' or 'CALL'",
	UnderlyingSymbol   string               `json:"underlyingSymbol,omitempty"`
	OptionMultiplier   float64              `json:"optionMultiplier,omitempty"`
	OptionDeliverables []*OptionDeliverable `json:"optionDeliverables,omitempty"`

	// FIXED_INCOME
	//Cusip        string  `json:"cusip,omitempty"`
	//Symbol       string  `json:"symbol,omitempty"`
	//Description  string  `json:"description,omitempty"`
	MaturityDate string  `json:"maturityDate,omitempty"`
	VariableRate float64 `json:"variableRate,omitempty"`
	Factor       float64 `json:"factor,omitempty"`

	// transactionHistory
	//================================================================
	//Symbol               string  `json:"symbol,omitempty"`               //"string"
	//UnderlyingSymbol     string  `json:"underlyingSymbol,omitempty"`     //"string"
	OptionExpirationDate string  `json:"optionExpirationDate,omitempty"` //"string"
	OptionStrikePrice    float64 `json:"optionStrikePrice,omitempty"`
	//PutCall              string  `json:"putCall,omitempty"`          //"string"
	//Cusip                string  `json:"cusip,omitempty"`            //"string"
	//Description          string  `json:"description,omitempty"`      //"string"
	//AssetType            string  `json:"assetType,omitempty"`        //"string"
	BondMaturityDate string  `json:"bondMaturityDate,omitempty"` //"string"
	BondInterestRate float64 `json:"bondInterestRate,omitempty"`
}

Instrument https://developer.tdameritrade.com/instruments/apis

type InstrumentMap

type InstrumentMap struct {
	Instruments map[string]*Instrument

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	ServerResponse `json:"-"`
}

InstrumentMap https://developer.tdameritrade.com/instruments/apis

type InstrumentsGetInstrumentCall

type InstrumentsGetInstrumentCall struct {
	DefaultCall
	// contains filtered or unexported fields
}

InstrumentsGetInstrumentCall https://developer.tdameritrade.com/instruments/apis/get/instruments/%7Bcusip%7D Get an instrument by CUSIP

func (*InstrumentsGetInstrumentCall) Do

Do send request

type InstrumentsSearchInstrumentsCall

type InstrumentsSearchInstrumentsCall struct {
	DefaultCall
}

InstrumentsSearchInstrumentsCall https://developer.tdameritrade.com/instruments/apis/get/instruments Search or retrieve instrument data, including fundamental data.

func (*InstrumentsSearchInstrumentsCall) Do

Do send request

type InstrumentsService

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

InstrumentsService https://developer.tdameritrade.com/instruments/apis Search for instrument and fundamental data

func NewInstrumentsService

func NewInstrumentsService(s *Service) *InstrumentsService

NewInstrumentsService https://developer.tdameritrade.com/instruments/apis Search for instrument and fundamental data

func (*InstrumentsService) GetInstrument

func (r *InstrumentsService) GetInstrument(cusip string) *InstrumentsGetInstrumentCall

GetInstrument https://developer.tdameritrade.com/instruments/apis/get/instruments/%7Bcusip%7D Get an instrument by CUSIP

func (*InstrumentsService) SearchInstruments

func (r *InstrumentsService) SearchInstruments(symbol, projection string) *InstrumentsSearchInstrumentsCall

SearchInstruments https://developer.tdameritrade.com/instruments/apis/get/instruments Search or retrieve instrument data, including fundamental data.

type Key

type Key struct {
	Key string `json:"key,omitempty"` //"string"
}

Key https://developer.tdameritrade.com/user-principal/apis

type Leg

type Leg struct {
	Symbol      string  `json:"symbol,omitempty"`
	PutCallInd  string  `json:"putCallInd,omitempty"`
	Description string  `json:"description,omitempty"`
	Bid         float64 `json:"bid,omitempty"`
	Ask         float64 `json:"ask,omitempty"`
	Range       string  `json:"range,omitempty"`
	StrikePrice float64 `json:"strikePrice,omitempty"`
	TotalVolume float64 `json:"totalVolume,omitempty"`
}

Leg https://developer.tdameritrade.com/option-chains/apis

type MarketHour

type MarketHour struct {
	Category     string       `json:"category,omitempty"`
	Date         string       `json:"date,omitempty"`
	Exchange     string       `json:"exchange,omitempty"`
	IsOpen       bool         `json:"isOpen,omitempty"`
	MarketType   string       `json:"marketType,omitempty"` //"'BOND' or 'EQUITY' or 'ETF' or 'FOREX' or 'FUTURE' or 'FUTURE_OPTION' or 'INDEX' or 'INDICATOR' or 'MUTUAL_FUND' or 'OPTION' or 'UNKNOWN'"
	Product      string       `json:"product,omitempty"`
	ProductName  string       `json:"productName,omitempty"`
	SessionHours SessionHours `json:"sessionHours,omitempty"` //"object"
}

MarketHour https://developer.tdameritrade.com/market-hours/apis

type MarketHourMap

type MarketHourMap struct {
	MarketHourProductMaps map[string]map[string]MarketHour

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	ServerResponse `json:"-"`
}

MarketHourMap https://developer.tdameritrade.com/market-hours/apis

type MarketHourProductMap

type MarketHourProductMap struct {
	MarketHours map[string]MarketHour

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	ServerResponse `json:"-"`
}

MarketHourProductMap https://developer.tdameritrade.com/market-hours/apis

type MarketHoursGetHoursForASingleMarketCall

type MarketHoursGetHoursForASingleMarketCall struct {
	DefaultCall
	// contains filtered or unexported fields
}

MarketHoursGetHoursForASingleMarketCall https://developer.tdameritrade.com/market-hours/apis/get/marketdata/%7Bmarket%7D/hours Retrieve market hours for specified single market

func (*MarketHoursGetHoursForASingleMarketCall) Date

Date https://developer.tdameritrade.com/market-hours/apis/get/marketdata/%7Bmarket%7D/hours "The date for which market hours information is requested. Valid ISO-8601 formats are : yyyy-MM-dd and yyyy-MM-dd'T'HH:mm:ssz."

func (*MarketHoursGetHoursForASingleMarketCall) Do

Do send request

type MarketHoursGetHoursForMultipleMarketsCall

type MarketHoursGetHoursForMultipleMarketsCall struct {
	DefaultCall
}

MarketHoursGetHoursForMultipleMarketsCall https://developer.tdameritrade.com/market-hours/apis/get/marketdata/hours Retrieve market hours for specified markets

func (*MarketHoursGetHoursForMultipleMarketsCall) Date

Date https://developer.tdameritrade.com/market-hours/apis/get/marketdata/hours "The date for which market hours information is requested. Valid ISO-8601 formats are : yyyy-MM-dd and yyyy-MM-dd'T'HH:mm:ssz."

func (*MarketHoursGetHoursForMultipleMarketsCall) Do

Do send request

type MarketHoursService

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

MarketHoursService https://developer.tdameritrade.com/market-hours/apis Operating hours of markets

func NewMarketHoursService

func NewMarketHoursService(s *Service) *MarketHoursService

NewMarketHoursService https://developer.tdameritrade.com/market-hours/apis Operating hours of markets

func (*MarketHoursService) GetHoursForASingleMarket

func (r *MarketHoursService) GetHoursForASingleMarket(market string) *MarketHoursGetHoursForASingleMarketCall

GetHoursForASingleMarket https://developer.tdameritrade.com/market-hours/apis/get/marketdata/%7Bmarket%7D/hours Retrieve market hours for specified single market

func (*MarketHoursService) GetHoursForMultipleMarkets

func (r *MarketHoursService) GetHoursForMultipleMarkets(markets ...string) *MarketHoursGetHoursForMultipleMarketsCall

GetHoursForMultipleMarkets https://developer.tdameritrade.com/market-hours/apis/get/marketdata/hours Retrieve market hours for specified markets The markets for which you're requesting market hours, comma-separated. Valid markets are EQUITY, OPTION, FUTURE, BOND, or FOREX.

type MonthlyStrategy

type MonthlyStrategy struct {
	Month              string            `json:"month,omitempty"`
	Year               int64             `json:"year,omitempty"`
	Day                int64             `json:"day,omitempty"`
	DaysToExp          int64             `json:"daysToExp,omitempty"`
	SecondaryMonth     string            `json:"secondaryMonth,omitempty"`
	SecondaryYear      int64             `json:"secondaryYear,omitempty"`
	SecondaryDay       int64             `json:"secondaryDay,omitempty"`
	SecondaryDaysToExp int64             `json:"secondaryDaysToExp,omitempty"`
	Type               string            `json:"type,omitempty"`
	SecondaryType      string            `json:"secondaryType,omitempty"`
	SecondaryLeap      bool              `json:"secondaryLeap,omitempty"`
	OptionStrategyList []*OptionStrategy `json:"optionStrategyList,omitempty"`
}

MonthlyStrategy https://developer.tdameritrade.com/option-chains/apis

type Mover

type Mover struct {
	// ServerResponse contains the HTTP response code and headers from the
	// server.
	ServerResponse `json:"-"`

	Change      float64 `json:"change,omitempty"`
	Description string  `json:"description,omitempty"` //"string"
	Direction   string  `json:"direction,omitempty"`   //"'up' or 'down'"
	Last        float64 `json:"last,omitempty"`
	Symbol      string  `json:"symbol,omitempty"` //"string"
	TotalVolume float64 `json:"totalVolume,omitempty"`
}

Mover https://developer.tdameritrade.com/movers/apis

type MoversGetMoversCall

type MoversGetMoversCall struct {
	DefaultCall
	// contains filtered or unexported fields
}

MoversGetMoversCall https://developer.tdameritrade.com/movers/apis/get/marketdata/%7Bindex%7D/movers Top 10 (up or down) movers by value or percent for a particular market

func (*MoversGetMoversCall) Change

func (c *MoversGetMoversCall) Change(change string) *MoversGetMoversCall

Change https://developer.tdameritrade.com/movers/apis/get/marketdata/%7Bindex%7D/movers To return movers with the specified change types of percent or value

func (*MoversGetMoversCall) Direction

func (c *MoversGetMoversCall) Direction(direction string) *MoversGetMoversCall

Direction https://developer.tdameritrade.com/movers/apis/get/marketdata/%7Bindex%7D/movers To return movers with the specified directions of up or down

func (*MoversGetMoversCall) Do

func (c *MoversGetMoversCall) Do() (*Mover, error)

Do send request

type MoversService

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

MoversService https://developer.tdameritrade.com/movers/apis Retrieve mover information by index symbol, direction type and change

func NewMoversService

func NewMoversService(s *Service) *MoversService

NewMoversService https://developer.tdameritrade.com/movers/apis Retrieve mover information by index symbol, direction type and change

func (*MoversService) GetMovers

func (r *MoversService) GetMovers(index string) *MoversGetMoversCall

GetMovers https://developer.tdameritrade.com/movers/apis/get/marketdata/%7Bindex%7D/movers Top 10 (up or down) movers by value or percent for a particular market

type Option

type Option struct {
	PutCall                string                `json:"putCall,omitempty"`      //"'PUT' or 'CALL'"
	Symbol                 string                `json:"symbol,omitempty"`       //"string"
	Description            string                `json:"description,omitempty"`  //"string"
	ExchangeName           string                `json:"exchangeName,omitempty"` //"string"
	Bid                    float64               `json:"bid,omitempty"`
	Ask                    float64               `json:"ask,omitempty"`
	Last                   float64               `json:"last,omitempty"`
	Mark                   float64               `json:"mark,omitempty"`
	BidSize                float64               `json:"bidSize,omitempty"`
	AskSize                float64               `json:"askSize,omitempty"`
	LastSize               float64               `json:"lastSize,omitempty"`
	HighPrice              float64               `json:"highPrice,omitempty"`
	LowPrice               float64               `json:"lowPrice,omitempty"`
	OpenPrice              float64               `json:"openPrice,omitempty"`
	ClosePrice             float64               `json:"closePrice,omitempty"`
	TotalVolume            float64               `json:"totalVolume,omitempty"`
	TradeDate              string                `json:"tradeDate,omitempty"`
	QuoteTimeInLong        float64               `json:"quoteTimeInLong,omitempty"`
	TradeTimeInLong        float64               `json:"tradeTimeInLong,omitempty"`
	NetChange              float64               `json:"netChange,omitempty"`
	Volatility             float64               `json:"volatility,omitempty"`
	Delta                  float64               `json:"delta,omitempty"`
	Gamma                  float64               `json:"gamma,omitempty"`
	Theta                  float64               `json:"theta,omitempty"`
	Vega                   float64               `json:"vega,omitempty"`
	Rho                    float64               `json:"rho,omitempty"`
	TimeValue              float64               `json:"timeValue,omitempty"`
	OpenInterest           float64               `json:"openInterest,omitempty"`
	IsInTheMoney           bool                  `json:"isInTheMoney,omitempty"`
	TheoreticalOptionValue float64               `json:"theoreticalOptionValue,omitempty"`
	TheoreticalVolatility  float64               `json:"theoreticalVolatility,omitempty"`
	IsMini                 bool                  `json:"isMini,omitempty"`
	IsNonStandard          bool                  `json:"isNonStandard,omitempty"`
	OptionDeliverablesList []*OptionDeliverables `json:"optionDeliverablesList,omitempty"`
	StrikePrice            float64               `json:"strikePrice,omitempty"`
	ExpirationDate         float64               `json:"expirationDate,omitempty"`
	DaysToExpiration       float64               `json:"daysToExpiration,omitempty"`
	ExpirationType         string                `json:"expirationType,omitempty"` //"string"
	LastTradingDay         float64               `json:"lastTradingDay,omitempty"`
	Multiplier             float64               `json:"multiplier,omitempty"`
	SettlementType         string                `json:"settlementType,omitempty"`  //"string"
	DeliverableNote        string                `json:"deliverableNote,omitempty"` //"string"
	IsIndexOption          bool                  `json:"isIndexOption,omitempty"`
	PercentChange          float64               `json:"percentChange,omitempty"`
	MarkChange             float64               `json:"markChange,omitempty"`
	MarkPercentChange      float64               `json:"markPercentChange,omitempty"`
	NonStandard            bool                  `json:"nonStandard,omitempty"`
	Mini                   bool                  `json:"mini,omitempty"`
	InTheMoney             bool                  `json:"inTheMoney,omitempty"`
}

Option https://developer.tdameritrade.com/option-chains/apis

type OptionChain

type OptionChain struct {
	// ServerResponse contains the HTTP response code and headers from the
	// server.
	ServerResponse `json:"-"`

	Symbol              string                          `json:"symbol,omitempty"` //"string"
	Status              string                          `json:"status,omitempty"` //"string"
	Underlying          *Underlying                     `json:"underlying,omitempty"`
	Strategy            string                          `json:"strategy,omitempty"` //"'SINGLE' or 'ANALYTICAL' or 'COVERED' or 'VERTICAL' or 'CALENDAR' or 'STRANGLE' or 'STRADDLE' or 'BUTTERFLY' or 'CONDOR' or 'DIAGONAL' or 'COLLAR' or 'ROLL'"
	Interval            float64                         `json:"interval,omitempty"`
	Intervals           []float64                       `json:"intervals,omitempty"`
	IsDelayed           bool                            `json:"isDelayed,omitempty"`
	IsIndex             bool                            `json:"isIndex,omitempty"`
	DaysToExpiration    float64                         `json:"daysToExpiration,omitempty"`
	InterestRate        float64                         `json:"interestRate,omitempty"`
	UnderlyingPrice     float64                         `json:"underlyingPrice,omitempty"`
	Volatility          float64                         `json:"volatility,omitempty"`
	MonthlyStrategyList []*MonthlyStrategy              `json:"monthlyStrategyList,omitempty"`
	CallExpDateMap      map[string]map[string][]*Option `json:"callExpDateMap,omitempty"` //"object"
	PutExpDateMap       map[string]map[string][]*Option `json:"putExpDateMap,omitempty"`  //"object"
}

OptionChain https://developer.tdameritrade.com/option-chains/apis

type OptionChainsGetOptionChainCall

type OptionChainsGetOptionChainCall struct {
	DefaultCall
}

OptionChainsGetOptionChainCall https://developer.tdameritrade.com/option-chains/apis/get/marketdata/chains Get option chain for an optionable Symbol

func (*OptionChainsGetOptionChainCall) ContractType

ContractType https://developer.tdameritrade.com/option-chains/apis/get/marketdata/chains Type of contracts to return in the chain. Can be CALL, PUT, or ALL. Default is ALL.

func (*OptionChainsGetOptionChainCall) DaysToExpiration

func (c *OptionChainsGetOptionChainCall) DaysToExpiration(daysToExpiration float64) *OptionChainsGetOptionChainCall

DaysToExpiration https://developer.tdameritrade.com/option-chains/apis/get/marketdata/chains Days to expiration to use in calculations. Applies only to ANALYTICAL strategy chains (see strategy param).

func (*OptionChainsGetOptionChainCall) Do

Do send request

func (*OptionChainsGetOptionChainCall) ExpMonth

ExpMonth https://developer.tdameritrade.com/option-chains/apis/get/marketdata/chains Return only options expiring in the specified month. Month is given in the three character format. Example: JAN Default is ALL.

func (*OptionChainsGetOptionChainCall) FromDate

FromDate https://developer.tdameritrade.com/option-chains/apis/get/marketdata/chains Only return expirations after this date. For strategies, expiration refers to the nearest term expiration in the strategy. Valid ISO-8601 formats are: yyyy-MM-dd and yyyy-MM-dd'T'HH:mm:ssz.

func (*OptionChainsGetOptionChainCall) IncludeQuotes

func (c *OptionChainsGetOptionChainCall) IncludeQuotes(includeQuotes bool) *OptionChainsGetOptionChainCall

IncludeQuotes https://developer.tdameritrade.com/option-chains/apis/get/marketdata/chains Include quotes for options in the option chain. Can be TRUE or FALSE. Default is FALSE.

func (*OptionChainsGetOptionChainCall) InterestRate

InterestRate https://developer.tdameritrade.com/option-chains/apis/get/marketdata/chains Interest rate to use in calculations. Applies only to ANALYTICAL strategy chains (see strategy param).

func (*OptionChainsGetOptionChainCall) Interval

Interval https://developer.tdameritrade.com/option-chains/apis/get/marketdata/chains Strike interval for spread strategy chains (see strategy param).

func (*OptionChainsGetOptionChainCall) OptionType

OptionType https://developer.tdameritrade.com/option-chains/apis/get/marketdata/chains Type of contracts to return. Possible values are:

S: Standard contracts NS: Non-standard contracts ALL: All contracts

Default is ALL.

func (*OptionChainsGetOptionChainCall) Range

Range https://developer.tdameritrade.com/option-chains/apis/get/marketdata/chains Returns options for the given range. Possible values are:

ITM: In-the-money NTM: Near-the-money OTM: Out-of-the-money SAK: Strikes Above Market SBK: Strikes Below Market SNK: Strikes Near Market ALL: All Strikes

Default is ALL.

func (*OptionChainsGetOptionChainCall) Strategy

Strategy https://developer.tdameritrade.com/option-chains/apis/get/marketdata/chains Passing a value returns a Strategy Chain. Possible values are SINGLE, ANALYTICAL (allows use of the volatility, underlyingPrice, interestRate, and daysToExpiration params to calculate theoretical values), COVERED, VERTICAL, CALENDAR, STRANGLE, STRADDLE, BUTTERFLY, CONDOR, DIAGONAL, COLLAR, or ROLL. Default is SINGLE.

func (*OptionChainsGetOptionChainCall) Strike

Strike https://developer.tdameritrade.com/option-chains/apis/get/marketdata/chains Provide a strike price to return options only at that strike price.

func (*OptionChainsGetOptionChainCall) StrikeCount

StrikeCount https://developer.tdameritrade.com/option-chains/apis/get/marketdata/chains

The number of strikes to return above and below the at-the-money price.

func (*OptionChainsGetOptionChainCall) ToDate

ToDate https://developer.tdameritrade.com/option-chains/apis/get/marketdata/chains Only return expirations before this date. For strategies, expiration refers to the nearest term expiration in the strategy. Valid ISO-8601 formats are: yyyy-MM-dd and yyyy-MM-dd'T'HH:mm:ssz.

func (*OptionChainsGetOptionChainCall) UnderlyingPrice

func (c *OptionChainsGetOptionChainCall) UnderlyingPrice(underlyingPrice float64) *OptionChainsGetOptionChainCall

UnderlyingPrice https://developer.tdameritrade.com/option-chains/apis/get/marketdata/chains Underlying price to use in calculations. Applies only to ANALYTICAL strategy chains (see strategy param).

func (*OptionChainsGetOptionChainCall) Volatility

Volatility https://developer.tdameritrade.com/option-chains/apis/get/marketdata/chains Volatility to use in calculations. Applies only to ANALYTICAL strategy chains (see strategy param).

type OptionChainsService

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

OptionChainsService https://developer.tdameritrade.com/option-chains/apis Get Option Chains for optionable symbols

func NewOptionChainsService

func NewOptionChainsService(s *Service) *OptionChainsService

NewOptionChainsService https://developer.tdameritrade.com/option-chains/apis Get Option Chains for optionable symbols

func (*OptionChainsService) GetOptionChain

func (r *OptionChainsService) GetOptionChain(symbol string) *OptionChainsGetOptionChainCall

GetOptionChain https://developer.tdameritrade.com/option-chains/apis/get/marketdata/chains Get option chain for an optionable Symbol

type OptionDeliverable

type OptionDeliverable struct {
	Symbol           string  `json:"symbol,omitempty"`
	DeliverableUnits float64 `json:"deliverableUnits,omitempty"`
	CurrencyType     string  `json:"currencyType,omitempty"` //"'USD' or 'CAD' or 'EUR' or 'JPY'",
	AssetType        string  `json:"assetType,omitempty"`    //"'EQUITY' or 'OPTION' or 'INDEX' or 'MUTUAL_FUND' or 'CASH_EQUIVALENT' or 'FIXED_INCOME' or 'CURRENCY'"
}

OptionDeliverable https://developer.tdameritrade.com/account-access/apis

type OptionDeliverables

type OptionDeliverables struct {
	Symbol           string `json:"symbol,omitempty"`           //"string"
	AssetType        string `json:"assetType,omitempty"`        //"string"
	DeliverableUnits string `json:"deliverableUnits,omitempty"` //"string"
	CurrencyType     string `json:"currencyType,omitempty"`     //"string"
}

OptionDeliverables https://developer.tdameritrade.com/option-chains/apis

type OptionStrategy

type OptionStrategy struct {
	PrimaryLeg     *Leg    `json:"primaryLeg,omitempty"`
	SecondaryLeg   *Leg    `json:"secondaryLeg,omitempty"`
	StrategyStrike string  `json:"strategyStrike,omitempty"`
	StrategyBid    float64 `json:"strategyBid,omitempty"`
	StrategyAsk    float64 `json:"strategyAsk,omitempty"`
}

OptionStrategy https://developer.tdameritrade.com/option-chains/apis

type Order

type Order struct {
	// ServerResponse contains the HTTP response code and headers from the
	// server.
	ServerResponse `json:"-"`

	Session                   string                `json:"session,omitempty"`   //"'NORMAL' or 'AM' or 'PM' or 'SEAMLESS'"
	Duration                  string                `json:"duration,omitempty"`  //"'DAY' or 'GOOD_TILL_CANCEL' or 'FILL_OR_KILL'"
	OrderType                 string                `json:"orderType,omitempty"` //"'MARKET' or 'LIMIT' or 'STOP' or 'STOP_LIMIT' or 'TRAILING_STOP' or 'MARKET_ON_CLOSE' or 'EXERCISE' or 'TRAILING_STOP_LIMIT' or 'NET_DEBIT' or 'NET_CREDIT' or 'NET_ZERO'"
	CancelTime                string                `json:"cancelTime,omitempty"`
	ComplexOrderStrategyType  string                `json:"complexOrderStrategyType,omitempty"` //"'NONE' or 'COVERED' or 'VERTICAL' or 'BACK_RATIO' or 'CALENDAR' or 'DIAGONAL' or 'STRADDLE' or 'STRANGLE' or 'COLLAR_SYNTHETIC' or 'BUTTERFLY' or 'CONDOR' or 'IRON_CONDOR' or 'VERTICAL_ROLL' or 'COLLAR_WITH_STOCK' or 'DOUBLE_DIAGONAL' or 'UNBALANCED_BUTTERFLY' or 'UNBALANCED_CONDOR' or 'UNBALANCED_IRON_CONDOR' or 'UNBALANCED_VERTICAL_ROLL' or 'CUSTOM'"
	Quantity                  float64               `json:"quantity,omitempty"`
	FilledQuantity            float64               `json:"filledQuantity,omitempty"`
	RemainingQuantity         float64               `json:"remainingQuantity,omitempty"`
	RequestedDestination      string                `json:"requestedDestination,omitempty"` //"'INET' or 'ECN_ARCA' or 'CBOE' or 'AMEX' or 'PHLX' or 'ISE' or 'BOX' or 'NYSE' or 'NASDAQ' or 'BATS' or 'C2' or 'AUTO'"
	DestinationLinkName       string                `json:"destinationLinkName,omitempty"`
	ReleaseTime               string                `json:"releaseTime,omitempty"`
	StopPrice                 float64               `json:"stopPrice,omitempty"`
	StopPriceLinkBasis        string                `json:"stopPriceLinkBasis,omitempty"` //"'MANUAL' or 'BASE' or 'TRIGGER' or 'LAST' or 'BID' or 'ASK' or 'ASK_BID' or 'MARK' or 'AVERAGE'"
	StopPriceLinkType         string                `json:"stopPriceLinkType,omitempty"`  //"'VALUE' or 'PERCENT' or 'TICK'"
	StopPriceOffset           float64               `json:"stopPriceOffset,omitempty"`
	StopType                  string                `json:"stopType,omitempty"`       //"'STANDARD' or 'BID' or 'ASK' or 'LAST' or 'MARK'"
	PriceLinkBasis            string                `json:"priceLinkBasis,omitempty"` //"'MANUAL' or 'BASE' or 'TRIGGER' or 'LAST' or 'BID' or 'ASK' or 'ASK_BID' or 'MARK' or 'AVERAGE'"
	PriceLinkType             string                `json:"priceLinkType,omitempty"`  //"'VALUE' or 'PERCENT' or 'TICK'"
	Price                     float64               `json:"price,omitempty"`
	TaxLotMethod              string                `json:"taxLotMethod,omitempty"` //"'FIFO' or 'LIFO' or 'HIGH_COST' or 'LOW_COST' or 'AVERAGE_COST' or 'SPECIFIC_LOT'"
	OrderLegCollections       []*OrderLegCollection `json:"orderLegCollection,omitempty"`
	ActivationPrice           float64               `json:"activationPrice,omitempty"`
	SpecialInstruction        string                `json:"specialInstruction,omitempty"` //"'ALL_OR_NONE' or 'DO_NOT_REDUCE' or 'ALL_OR_NONE_DO_NOT_REDUCE'"
	OrderStrategyType         string                `json:"orderStrategyType,omitempty"`  //"'SINGLE' or 'OCO' or 'TRIGGER'"
	OrderID                   int64                 `json:"orderId,omitempty"`
	Cancelable                bool                  `json:"cancelable,omitempty"`
	Editable                  bool                  `json:"editable,omitempty"`
	Status                    string                `json:"status,omitempty"` //"'AWAITING_PARENT_ORDER' or 'AWAITING_CONDITION' or 'AWAITING_MANUAL_REVIEW' or 'ACCEPTED' or 'AWAITING_UR_OUT' or 'PENDING_ACTIVATION' or 'QUEUED' or 'WORKING' or 'REJECTED' or 'PENDING_CANCEL' or 'CANCELED' or 'PENDING_REPLACE' or 'REPLACED' or 'FILLED' or 'EXPIRED'"
	EnteredTime               string                `json:"enteredTime,omitempty"`
	CloseTime                 string                `json:"closeTime,omitempty"`
	Tag                       string                `json:"tag,omitempty"`
	AccountID                 float64               `json:"accountId,omitempty"`
	OrderActivityCollections  []*Execution          `json:"orderActivityCollection,omitempty"`
	ReplacingOrderCollections []*Order              `json:"replacingOrderCollection,omitempty"`
	ChildOrderStrategies      []*Order              `json:"childOrderStrategies,omitempty"`
	StatusDescription         string                `json:"statusDescription,omitempty"`
}

Order https://developer.tdameritrade.com/account-access/apis

type OrderLegCollection

type OrderLegCollection struct {
	OrderLegType   string      `json:"orderLegType,omitempty"` //"'EQUITY' or 'OPTION' or 'INDEX' or 'MUTUAL_FUND' or 'CASH_EQUIVALENT' or 'FIXED_INCOME' or 'CURRENCY'",
	LegID          int64       `json:"legId,omitempty"`
	Instrument     *Instrument `json:"instrument,omitempty"`     //"\"The type <Instrument> has the following subclasses [Option, MutualFund, CashEquivalent, Equity, FixedIncome] descriptions are listed below\"",
	Instruction    string      `json:"instruction,omitempty"`    //"'BUY' or 'SELL' or 'BUY_TO_COVER' or 'SELL_SHORT' or 'BUY_TO_OPEN' or 'BUY_TO_CLOSE' or 'SELL_TO_OPEN' or 'SELL_TO_CLOSE' or 'EXCHANGE'",
	PositionEffect string      `json:"positionEffect,omitempty"` //"'OPENING' or 'CLOSING' or 'AUTOMATIC'",
	Quantity       float64     `json:"quantity,omitempty"`
	QuantityType   string      `json:"quantityType,omitempty"` //"'ALL_SHARES' or 'DOLLARS' or 'SHARES'"
}

OrderLegCollection https://developer.tdameritrade.com/account-access/apis

type OrderList

type OrderList struct {
	Orders []*Order

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	ServerResponse `json:"-"`
}

OrderList https://developer.tdameritrade.com/account-access/apis

type OrderStrategie

type OrderStrategie struct {
	Session                  string                `json:"session,omitempty"`   //"'NORMAL' or 'AM' or 'PM' or 'SEAMLESS'",
	Duration                 string                `json:"duration,omitempty"`  //"'DAY' or 'GOOD_TILL_CANCEL' or 'FILL_OR_KILL'",
	OrderType                string                `json:"orderType,omitempty"` //"'MARKET' or 'LIMIT' or 'STOP' or 'STOP_LIMIT' or 'TRAILING_STOP' or 'MARKET_ON_CLOSE' or 'EXERCISE' or 'TRAILING_STOP_LIMIT' or 'NET_DEBIT' or 'NET_CREDIT' or 'NET_ZERO'",
	CancelTime               string                `json:"cancelTime,omitempty"`
	ComplexOrderStrategyType string                `json:"complexOrderStrategyType,omitempty"` //"'NONE' or 'COVERED' or 'VERTICAL' or 'BACK_RATIO' or 'CALENDAR' or 'DIAGONAL' or 'STRADDLE' or 'STRANGLE' or 'COLLAR_SYNTHETIC' or 'BUTTERFLY' or 'CONDOR' or 'IRON_CONDOR' or 'VERTICAL_ROLL' or 'COLLAR_WITH_STOCK' or 'DOUBLE_DIAGONAL' or 'UNBALANCED_BUTTERFLY' or 'UNBALANCED_CONDOR' or 'UNBALANCED_IRON_CONDOR' or 'UNBALANCED_VERTICAL_ROLL' or 'CUSTOM'",
	Quantity                 float64               `json:"quantity,omitempty"`
	FilledQuantity           float64               `json:"filledQuantity,omitempty"`
	RemainingQuantity        float64               `json:"remainingQuantity,omitempty"`
	RequestedDestination     string                `json:"requestedDestination,omitempty"` //"'INET' or 'ECN_ARCA' or 'CBOE' or 'AMEX' or 'PHLX' or 'ISE' or 'BOX' or 'NYSE' or 'NASDAQ' or 'BATS' or 'C2' or 'AUTO'",
	DestinationLinkName      string                `json:"destinationLinkName,omitempty"`
	ReleaseTime              string                `json:"releaseTime,omitempty"`
	StopPrice                float64               `json:"stopPrice,omitempty"`
	StopPriceLinkBasis       string                `json:"stopPriceLinkBasis,omitempty"` //"'MANUAL' or 'BASE' or 'TRIGGER' or 'LAST' or 'BID' or 'ASK' or 'ASK_BID' or 'MARK' or 'AVERAGE'",
	StopPriceLinkType        string                `json:"stopPriceLinkType,omitempty"`  //"'VALUE' or 'PERCENT' or 'TICK'",
	StopPriceOffset          float64               `json:"stopPriceOffset,omitempty"`
	StopType                 string                `json:"stopType,omitempty"`       //"'STANDARD' or 'BID' or 'ASK' or 'LAST' or 'MARK'",
	PriceLinkBasis           string                `json:"priceLinkBasis,omitempty"` //"'MANUAL' or 'BASE' or 'TRIGGER' or 'LAST' or 'BID' or 'ASK' or 'ASK_BID' or 'MARK' or 'AVERAGE'",
	PriceLinkType            string                `json:"priceLinkType,omitempty"`  //"'VALUE' or 'PERCENT' or 'TICK'",
	Price                    float64               `json:"price,omitempty"`
	TaxLotMethod             string                `json:"taxLotMethod,omitempty"` //"'FIFO' or 'LIFO' or 'HIGH_COST' or 'LOW_COST' or 'AVERAGE_COST' or 'SPECIFIC_LOT'",
	OrderLegCollections      []*OrderLegCollection `json:"orderLegCollection,omitempty"`
	ActivationPrice          float64               `json:"activationPrice,omitempty"`
	SpecialInstruction       string                `json:"specialInstruction,omitempty"` //"'ALL_OR_NONE' or 'DO_NOT_REDUCE' or 'ALL_OR_NONE_DO_NOT_REDUCE'",
	OrderStrategyType        string                `json:"orderStrategyType,omitempty"`  //"'SINGLE' or 'OCO' or 'TRIGGER'",
	OrderID                  int64                 `json:"orderId,omitempty"`
	Cancelable               bool                  `json:"cancelable,omitempty"`
	Editable                 bool                  `json:"editable,omitempty"`
	Status                   string                `json:"status,omitempty"` //"'AWAITING_PARENT_ORDER' or 'AWAITING_CONDITION' or 'AWAITING_MANUAL_REVIEW' or 'ACCEPTED' or 'AWAITING_UR_OUT' or 'PENDING_ACTIVATION' or 'QUEUED' or 'WORKING' or 'REJECTED' or 'PENDING_CANCEL' or 'CANCELED' or 'PENDING_REPLACE' or 'REPLACED' or 'FILLED' or 'EXPIRED'",
	EnteredTime              string                `json:"enteredTime,omitempty"`
	CloseTime                string                `json:"closeTime,omitempty"`
	Tag                      string                `json:"tag,omitempty"`
	AccountID                int64                 `json:"accountId,omitempty"`
	OrderActivityCollection  []*Execution          `json:"orderActivityCollection,omitempty"`  //: ["\"The type <OrderActivity> has the following subclasses [Execution] descriptions are listed below\""],
	ReplacingOrderCollection []json.RawMessage     `json:"replacingOrderCollection,omitempty"` //: [ {} ],
	ChildOrderStrategies     []json.RawMessage     `json:"childOrderStrategies,omitempty"`     //: [ {}  ],
	StatusDescription        string                `json:"statusDescription,omitempty"`
}

OrderStrategie https://developer.tdameritrade.com/account-access/apis

type OrdersCancelOrderCall

type OrdersCancelOrderCall struct {
	DefaultCall

	OrderID int64
	// contains filtered or unexported fields
}

OrdersCancelOrderCall https://developer.tdameritrade.com/account-access/apis/delete/accounts/%7BaccountId%7D/orders/%7BorderId%7D-0 Cancel a specific order for a specific account.

func (*OrdersCancelOrderCall) Do

Do send request

type OrdersGetOrderCall

type OrdersGetOrderCall struct {
	DefaultCall

	OrderID int64
	// contains filtered or unexported fields
}

OrdersGetOrderCall https://developer.tdameritrade.com/account-access/apis/get/accounts/%7BaccountId%7D/orders/%7BorderId%7D-0 Get a specific order for a specific account.

func (*OrdersGetOrderCall) Do

func (c *OrdersGetOrderCall) Do() (*Order, error)

Do send request

type OrdersGetOrdersByPathCall

type OrdersGetOrdersByPathCall struct {
	DefaultCall
	// contains filtered or unexported fields
}

OrdersGetOrdersByPathCall https://developer.tdameritrade.com/account-access/apis/get/accounts/%7BaccountId%7D/orders-0 Orders for a specific account.

func (*OrdersGetOrdersByPathCall) Do

Do send request

func (*OrdersGetOrdersByPathCall) FromEnteredTime

FromEnteredTime https://developer.tdameritrade.com/account-access/apis/get/accounts/%7BaccountId%7D/orders-0 Specifies that no orders entered before this time should be returned. Valid ISO-8601 formats are : yyyy-MM-dd. Date must be within 60 days from today's date. 'toEnteredTime' must also be set.

func (*OrdersGetOrdersByPathCall) MaxResults

MaxResults https://developer.tdameritrade.com/account-access/apis/get/accounts/%7BaccountId%7D/orders-0 The maximum number of orders to retrieve.

func (*OrdersGetOrdersByPathCall) Status

Status https://developer.tdameritrade.com/account-access/apis/get/accounts/%7BaccountId%7D/orders-0 Specifies that only orders of this status should be returned.

func (*OrdersGetOrdersByPathCall) ToEnteredTime

ToEnteredTime https://developer.tdameritrade.com/account-access/apis/get/accounts/%7BaccountId%7D/orders-0 Specifies that no orders entered after this time should be returned.Valid ISO-8601 formats are : yyyy-MM-dd. 'fromEnteredTime' must also be set.

type OrdersGetOrdersByQueryCall

type OrdersGetOrdersByQueryCall struct {
	DefaultCall
}

OrdersGetOrdersByQueryCall https://developer.tdameritrade.com/account-access/apis/get/orders-0 All orders for a specific account or, if account ID isn't specified, orders will be returned for all linked accounts

func (*OrdersGetOrdersByQueryCall) Do

Do send request

func (*OrdersGetOrdersByQueryCall) FromEnteredTime

FromEnteredTime https://developer.tdameritrade.com/account-access/apis/get/orders-0 Specifies that no orders entered before this time should be returned.Valid ISO-8601 formats are : yyyy-MM-dd. Date must be within 60 days from today's date. 'toEnteredTime' must also be set.

func (*OrdersGetOrdersByQueryCall) MaxResults

MaxResults https://developer.tdameritrade.com/account-access/apis/get/orders-0 The maximum number of orders to retrieve.

func (*OrdersGetOrdersByQueryCall) Status

Status https://developer.tdameritrade.com/account-access/apis/get/orders-0 Specifies that only orders of this status should be returned.

func (*OrdersGetOrdersByQueryCall) ToEnteredTime

ToEnteredTime https://developer.tdameritrade.com/account-access/apis/get/orders-0 Specifies that no orders entered after this time should be returned.Valid ISO-8601 formats are : yyyy-MM-dd. 'fromEnteredTime' must also be set.

type OrdersPlaceOrderCall

type OrdersPlaceOrderCall struct {
	DefaultCall

	Order *Order
	// contains filtered or unexported fields
}

OrdersPlaceOrderCall https://developer.tdameritrade.com/account-access/apis/post/accounts/%7BaccountId%7D/orders-0 Place an order for a specific account.

func (*OrdersPlaceOrderCall) Do

Do send request

type OrdersReplaceOrderCall

type OrdersReplaceOrderCall struct {
	DefaultCall

	OrderID int64
	Order   *Order
	// contains filtered or unexported fields
}

OrdersReplaceOrderCall https://developer.tdameritrade.com/account-access/apis/put/accounts/%7BaccountId%7D/orders/%7BorderId%7D-0 Replace an existing order for an account. The existing order will be replaced by the new order. Once replaced, the old order will be canceled and a new order will be created.

func (*OrdersReplaceOrderCall) Do

Do send request

type OrdersService

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

OrdersService https://developer.tdameritrade.com/account-access/apis APIs to access Account Balances, Positions, Trade Info and place Trades

func NewOrdersService

func NewOrdersService(s *Service) *OrdersService

NewOrdersService https://developer.tdameritrade.com/account-access/apis APIs to access Account Balances, Positions, Trade Info and place Trades

func (*OrdersService) CancelOrder

func (r *OrdersService) CancelOrder(accountID string, OrderID int64) *OrdersCancelOrderCall

CancelOrder https://developer.tdameritrade.com/account-access/apis/delete/accounts/%7BaccountId%7D/orders/%7BorderId%7D-0 Cancel a specific order for a specific account.

func (*OrdersService) GetOrder

func (r *OrdersService) GetOrder(accountID string, OrderID int64) *OrdersGetOrderCall

GetOrder https://developer.tdameritrade.com/account-access/apis/get/accounts/%7BaccountId%7D/orders/%7BorderId%7D-0 Get a specific order for a specific account.

func (*OrdersService) GetOrdersByPath

func (r *OrdersService) GetOrdersByPath(accountID string) *OrdersGetOrdersByPathCall

GetOrdersByPath https://developer.tdameritrade.com/account-access/apis/get/accounts/%7BaccountId%7D/orders-0 Orders for a specific account.

func (*OrdersService) GetOrdersByQuery

func (r *OrdersService) GetOrdersByQuery(accountID string) *OrdersGetOrdersByQueryCall

GetOrdersByQuery https://developer.tdameritrade.com/account-access/apis/get/orders-0 All orders for a specific account or, if account ID isn't specified, orders will be returned for all linked accounts

func (*OrdersService) PlaceOrder

func (r *OrdersService) PlaceOrder(accountID string, Order *Order) *OrdersPlaceOrderCall

PlaceOrder https://developer.tdameritrade.com/account-access/apis/post/accounts/%7BaccountId%7D/orders-0 Place an order for a specific account.

func (*OrdersService) ReplaceOrder

func (r *OrdersService) ReplaceOrder(accountID string, OrderID int64, Order *Order) *OrdersReplaceOrderCall

ReplaceOrder https://developer.tdameritrade.com/account-access/apis/put/accounts/%7BaccountId%7D/orders/%7BorderId%7D-0 Replace an existing order for an account. The existing order will be replaced by the new order. Once replaced, the old order will be canceled and a new order will be created.

type Period

type Period struct {
	Start string `json:"start,omitempty"`
	End   string `json:"end,omitempty"`
}

Period https://developer.tdameritrade.com/market-hours/apis

type Position

type Position struct {
	ShortQuantity                  float64     `json:"shortQuantity,omitempty"`
	AveragePrice                   float64     `json:"averagePrice,omitempty"`
	CurrentDayProfitLoss           float64     `json:"currentDayProfitLoss,omitempty"`
	CurrentDayProfitLossPercentage float64     `json:"currentDayProfitLossPercentage,omitempty"`
	LongQuantity                   float64     `json:"longQuantity,omitempty"`
	SettledLongQuantity            float64     `json:"settledLongQuantity,omitempty"`
	SettledShortQuantity           float64     `json:"settledShortQuantity,omitempty"`
	AgedQuantity                   float64     `json:"agedQuantity,omitempty"`
	InstrumenA                     *Instrument `json:"instrument,omitempty"`
	MarketValue                    float64     `json:"marketValue,omitempty"`
}

Position https://developer.tdameritrade.com/account-access/apis

type Preferences

type Preferences struct {
	// ServerResponse contains the HTTP response code and headers from the
	// server.
	ServerResponse `json:"-"`

	ExpressTrading                   bool    `json:"expressTrading,omitempty"`
	DirectOptionsRouting             bool    `json:"directOptionsRouting,omitempty"`
	DirectEquityRouting              bool    `json:"directEquityRouting,omitempty"`
	DefaultEquityOrderLegInstruction string  `json:"defaultEquityOrderLegInstruction,omitempty"` //"'BUY' or 'SELL' or 'BUY_TO_COVER' or 'SELL_SHORT' or 'NONE'"
	DefaultEquityOrderType           string  `json:"defaultEquityOrderType,omitempty"`           //"'MARKET' or 'LIMIT' or 'STOP' or 'STOP_LIMIT' or 'TRAILING_STOP' or 'MARKET_ON_CLOSE' or 'NONE'"
	DefaultEquityOrderPriceLinkType  string  `json:"defaultEquityOrderPriceLinkType,omitempty"`  //"'VALUE' or 'PERCENT' or 'NONE'"
	DefaultEquityOrderDuration       string  `json:"defaultEquityOrderDuration,omitempty"`       //"'DAY' or 'GOOD_TILL_CANCEL' or 'NONE'"
	DefaultEquityOrderMarketSession  string  `json:"defaultEquityOrderMarketSession,omitempty"`  //"'AM' or 'PM' or 'NORMAL' or 'SEAMLESS' or 'NONE'"
	DefaultEquityQuantity            float64 `json:"defaultEquityQuantity,omitempty"`
	MutualFundTaxLotMethod           string  `json:"mutualFundTaxLotMethod,omitempty"`    //"'FIFO' or 'LIFO' or 'HIGH_COST' or 'LOW_COST' or 'MINIMUM_TAX' or 'AVERAGE_COST' or 'NONE'"
	OptionTaxLotMethod               string  `json:"optionTaxLotMethod,omitempty"`        //"'FIFO' or 'LIFO' or 'HIGH_COST' or 'LOW_COST' or 'MINIMUM_TAX' or 'AVERAGE_COST' or 'NONE'"
	EquityTaxLotMethod               string  `json:"equityTaxLotMethod,omitempty"`        //"'FIFO' or 'LIFO' or 'HIGH_COST' or 'LOW_COST' or 'MINIMUM_TAX' or 'AVERAGE_COST' or 'NONE'"
	DefaultAdvancedToolLaunch        string  `json:"defaultAdvancedToolLaunch,omitempty"` //"'TA' or 'N' or 'Y' or 'TOS' or 'NONE' or 'CC2'"
	AuthTokenTimeout                 string  `json:"authTokenTimeout,omitempty"`          //"'FIFTY_FIVE_MINUTES' or 'TWO_HOURS' or 'FOUR_HOURS' or 'EIGHT_HOURS'"
}

Preferences https://developer.tdameritrade.com/user-principal/apis

type PriceHistory

type PriceHistory struct {
	// ServerResponse contains the HTTP response code and headers from the
	// server.
	ServerResponse `json:"-"`

	Candles []Candle `json:"candles,omitempty"`
	Empty   bool     `json:"empty,omitempty"`
	Symbol  string   `json:"symbol,omitempty"` //"string"
}

PriceHistory https://developer.tdameritrade.com/price-history/apis

type PriceHistoryGetPriceHistoryCall

type PriceHistoryGetPriceHistoryCall struct {
	DefaultCall
	// contains filtered or unexported fields
}

PriceHistoryGetPriceHistoryCall https://developer.tdameritrade.com/price-history/apis/get/marketdata/%7Bsymbol%7D/pricehistory Get price history for a symbol

func (*PriceHistoryGetPriceHistoryCall) Do

Do send request

func (*PriceHistoryGetPriceHistoryCall) EndDate

EndDate https://developer.tdameritrade.com/price-history/apis/get/marketdata/%7Bsymbol%7D/pricehistory End date as milliseconds since epoch. If startDate and endDate are provided, period should not be provided. Default is previous trading day.

func (*PriceHistoryGetPriceHistoryCall) Frequency

Frequency https://developer.tdameritrade.com/price-history/apis/get/marketdata/%7Bsymbol%7D/pricehistory The number of the frequencyType to be included in each candle.

Valid frequencies by frequencyType (defaults marked with an asterisk):

minute: 1*, 5, 10, 15, 30 daily: 1* weekly: 1* monthly: 1*

func (*PriceHistoryGetPriceHistoryCall) FrequencyType

FrequencyType https://developer.tdameritrade.com/price-history/apis/get/marketdata/%7Bsymbol%7D/pricehistory The type of frequency with which a new candle is formed.

Valid frequencyTypes by periodType (defaults marked with an asterisk):

day: minute* month: daily, weekly* year: daily, weekly, monthly* ytd: daily, weekly*

func (*PriceHistoryGetPriceHistoryCall) NeedExtendedHoursData

func (c *PriceHistoryGetPriceHistoryCall) NeedExtendedHoursData(needExtendedHoursData bool) *PriceHistoryGetPriceHistoryCall

NeedExtendedHoursData https://developer.tdameritrade.com/price-history/apis/get/marketdata/%7Bsymbol%7D/pricehistory true to return extended hours data, false for regular market hours only. Default is true

func (*PriceHistoryGetPriceHistoryCall) Period

Period https://developer.tdameritrade.com/price-history/apis/get/marketdata/%7Bsymbol%7D/pricehistory The number of periods to show.

Example: For a 2 day / 1 min chart, the values would be:

period: 2 periodType: day frequency: 1 frequencyType: min

Valid periods by periodType (defaults marked with an asterisk):

day: 1, 2, 3, 4, 5, 10* month: 1*, 2, 3, 6 year: 1*, 2, 3, 5, 10, 15, 20 ytd: 1*

func (*PriceHistoryGetPriceHistoryCall) PeriodType

PeriodType https://developer.tdameritrade.com/price-history/apis/get/marketdata/%7Bsymbol%7D/pricehistory The type of period to show. Valid values are day, month, year, or ytd (year to date). Default is day.

func (*PriceHistoryGetPriceHistoryCall) StartDate

StartDate https://developer.tdameritrade.com/price-history/apis/get/marketdata/%7Bsymbol%7D/pricehistory Start date as milliseconds since epoch. If startDate and endDate are provided, period should not be provided.

type PriceHistoryService

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

PriceHistoryService https://developer.tdameritrade.com/price-history/apis Historical price data for charts

func NewPriceHistoryService

func NewPriceHistoryService(s *Service) *PriceHistoryService

NewPriceHistoryService https://developer.tdameritrade.com/price-history/apis Historical price data for charts

func (*PriceHistoryService) GetPriceHistory

func (r *PriceHistoryService) GetPriceHistory(symbol string) *PriceHistoryGetPriceHistoryCall

GetPriceHistory https://developer.tdameritrade.com/price-history/apis/get/marketdata/%7Bsymbol%7D/pricehistory Get price history for a symbol

type ProjectedBalances

type ProjectedBalances struct {
	AccruedInterest              float64 `json:"accruedInterest,omitempty"`
	CashBalance                  float64 `json:"cashBalance,omitempty"`
	CashReceipts                 float64 `json:"cashReceipts,omitempty"`
	LongOptionMarketValue        float64 `json:"longOptionMarketValue,omitempty"`
	LiquidationValue             float64 `json:"liquidationValue,omitempty"`
	LongMarketValue              float64 `json:"longMarketValue,omitempty"`
	MoneyMarketFund              float64 `json:"moneyMarketFund,omitempty"`
	Savings                      float64 `json:"savings,omitempty"`
	ShortMarketValue             float64 `json:"shortMarketValue,omitempty"`
	PendingDeposits              float64 `json:"pendingDeposits,omitempty"`
	CashAvailableForTrading      float64 `json:"cashAvailableForTrading,omitempty"`
	CashAvailableForWithdrawal   float64 `json:"cashAvailableForWithdrawal,omitempty"`
	CashCall                     float64 `json:"cashCall,omitempty"`
	LongNonMarginableMarketValue float64 `json:"longNonMarginableMarketValue,omitempty"`
	TotalCash                    float64 `json:"totalCash,omitempty"`
	ShortOptionMarketValue       float64 `json:"shortOptionMarketValue,omitempty"`
	MutualFundValue              float64 `json:"mutualFundValue,omitempty"`
	BondValue                    float64 `json:"bondValue,omitempty"`
	CashDebitCallValue           float64 `json:"cashDebitCallValue,omitempty"`
	UnsettledCash                float64 `json:"unsettledCash,omitempty"`
}

ProjectedBalances https://developer.tdameritrade.com/account-access/apis

type Quote

type Quote struct {
	// ServerResponse contains the HTTP response code and headers from the
	// server.
	ServerResponse `json:"-"`

	// Quote
	// ===========================================================================
	AssetType string `json:"assetType,omitempty"`

	// MutualFund
	Symbol          string  `json:"symbol,omitempty"`
	Description     string  `json:"description,omitempty"`
	ClosePrice      float64 `json:"closePrice,omitempty"`
	NetChange       float64 `json:"netChange,omitempty"`
	TotalVolume     float64 `json:"totalVolume,omitempty"`
	TradeTimeInLong float64 `json:"tradeTimeInLong,omitempty"`
	Exchange        string  `json:"exchange,omitempty"`
	ExchangeName    string  `json:"exchangeName,omitempty"`
	Digits          float64 `json:"digits,omitempty"`
	Wk52High        float64 `json:"52WkHigh,omitempty"`
	Wk52Low         float64 `json:"52WkLow,omitempty"`
	NAV             float64 `json:"nAV,omitempty"`
	PeRatio         float64 `json:"peRatio,omitempty"`
	DivAmount       float64 `json:"divAmount,omitempty"`
	DivYield        float64 `json:"divYield,omitempty"`
	DivDate         string  `json:"divDate,omitempty"`
	SecurityStatus  string  `json:"securityStatus,omitempty"`
	Delayed         bool    `json:"Delayed,omitempty"`

	// Future
	//Symbol                string  `json:"symbol,omitempty"`
	BidPriceInDouble   float64 `json:"bidPriceInDouble,omitempty"`
	AskPriceInDouble   float64 `json:"askPriceInDouble,omitempty"`
	LastPriceInDouble  float64 `json:"lastPriceInDouble,omitempty"`
	BidID              string  `json:"bidId,omitempty"`
	BidTick            string  `json:"bidTick,omitempty"`
	AskID              string  `json:"askId,omitempty"`
	HighPriceInDouble  float64 `json:"highPriceInDouble,omitempty"`
	LowPriceInDouble   float64 `json:"lowPriceInDouble,omitempty"`
	ClosePriceInDouble float64 `json:"closePriceInDouble,omitempty"`
	//Exchange              string  `json:"exchange,omitempty"`
	//Description           string  `json:"description,omitempty"`
	LastID              string  `json:"lastId,omitempty"`
	OpenPriceInDouble   float64 `json:"openPriceInDouble,omitempty"`
	ChangeInDouble      float64 `json:"changeInDouble,omitempty"`
	FuturePercentChange float64 `json:"futurePercentChange,omitempty"`
	//ExchangeName          string  `json:"exchangeName,omitempty"`
	//SecurityStatus        string  `json:"securityStatus,omitempty"`
	OpenInterest          float64 `json:"openInterest,omitempty"`
	Mark                  float64 `json:"mark,omitempty"`
	Tick                  float64 `json:"tick,omitempty"`
	TickAmount            float64 `json:"tickAmount,omitempty"`
	Product               string  `json:"product,omitempty"`
	FuturePriceFormat     string  `json:"futurePriceFormat,omitempty"`
	FutureTradingHours    string  `json:"futureTradingHours,omitempty"`
	FutureIsTradable      bool    `json:"futureIsTradable,omitempty"`
	FutureMultiplier      float64 `json:"futureMultiplier,omitempty"`
	FutureIsActive        bool    `json:"futureIsActive,omitempty"`
	FutureSettlementPrice float64 `json:"futureSettlementPrice,omitempty"`
	FutureActiveSymbol    string  `json:"futureActiveSymbol,omitempty"`
	FutureExpirationDate  string  `json:"futureExpirationDate,omitempty"`

	// FutureOptions
	//Symbol                      string  `json:"symbol,omitempty"`
	//BidPriceInDouble            float64 `json:"bidPriceInDouble,omitempty"`
	//AskPriceInDouble            float64 `json:"askPriceInDouble,omitempty"`
	//LastPriceInDouble           float64 `json:"lastPriceInDouble,omitempty"`
	//HighPriceInDouble           float64 `json:"highPriceInDouble,omitempty"`
	//LowPriceInDouble            float64 `json:"lowPriceInDouble,omitempty"`
	//ClosePriceInDouble          float64 `json:"closePriceInDouble,omitempty"`
	//Description                 string  `json:"description,omitempty"`
	//OpenPriceInDouble           float64 `json:"openPriceInDouble,omitempty"`
	NetChangeInDouble float64 `json:"netChangeInDouble,omitempty"`
	//OpenInterest                float64 `json:"openInterest,omitempty"`
	//ExchangeName                string  `json:"exchangeName,omitempty"`
	//SecurityStatus              string  `json:"securityStatus,omitempty"`
	Volatility                  float64 `json:"volatility,omitempty"`
	MoneyIntrinsicValueInDouble float64 `json:"moneyIntrinsicValueInDouble,omitempty"`
	MultiplierInDouble          float64 `json:"multiplierInDouble,omitempty"`
	//Digits                      float64 `json:"digits,omitempty"`
	StrikePriceInDouble float64 `json:"strikePriceInDouble,omitempty"`
	ContractType        string  `json:"contractType,omitempty"`
	Underlying          string  `json:"underlying,omitempty"`
	TimeValueInDouble   float64 `json:"timeValueInDouble,omitempty"`
	DeltaInDouble       float64 `json:"deltaInDouble,omitempty"`
	GammaInDouble       float64 `json:"gammaInDouble,omitempty"`
	ThetaInDouble       float64 `json:"thetaInDouble,omitempty"`
	VegaInDouble        float64 `json:"vegaInDouble,omitempty"`
	RhoInDouble         float64 `json:"rhoInDouble,omitempty"`
	//Mark                        float64 `json:"mark,omitempty"`
	//Tick                        float64 `json:"tick,omitempty"`
	//TickAmount                  float64 `json:"tickAmount,omitempty"`
	//FutureIsTradable            bool    `json:"futureIsTradable,omitempty"`
	//FutureTradingHours          string  `json:"futureTradingHours,omitempty"`
	//FuturePercentChange         float64 `json:"futurePercentChange,omitempty"`
	//FutureIsActive              bool    `json:"futureIsActive,omitempty"`
	//FutureExpirationDate        float64 `json:"futureExpirationDate,omitempty"`
	ExpirationType string `json:"expirationType,omitempty"`
	ExerciseType   string `json:"exerciseType,omitempty"`
	InTheMoney     bool   `json:"inTheMoney,omitempty"`

	// Index
	//Symbol          string  `json:"symbol,omitempty"`
	//Description     string  `json:"description,omitempty"`
	LastPrice float64 `json:"lastPrice,omitempty"`
	OpenPrice float64 `json:"openPrice,omitempty"`
	HighPrice float64 `json:"highPrice,omitempty"`
	LowPrice  float64 `json:"lowPrice,omitempty"`

	// Option
	//Symbol                 string  `json:"symbol,omitempty"`
	//Description            string  `json:"description,omitempty"`
	BidPrice float64 `json:"bidPrice,omitempty"`
	BidSize  float64 `json:"bidSize,omitempty"`
	AskPrice float64 `json:"askPrice,omitempty"`
	AskSize  float64 `json:"askSize,omitempty"`
	//LastPrice              float64 `json:"lastPrice,omitempty"`
	LastSize float64 `json:"lastSize,omitempty"`
	//OpenPrice              float64 `json:"openPrice,omitempty"`
	//HighPrice              float64 `json:"highPrice,omitempty"`
	//LowPrice               float64 `json:"lowPrice,omitempty"`
	//ClosePrice             float64 `json:"closePrice,omitempty"`
	//NetChange              float64 `json:"netChange,omitempty"`
	//TotalVolume            float64 `json:"totalVolume,omitempty"`
	QuoteTimeInLong float64 `json:"quoteTimeInLong,omitempty"`
	//TradeTimeInLong        float64 `json:"tradeTimeInLong,omitempty"`
	//Mark                   float64 `json:"mark,omitempty"`
	//OpenInterest           float64 `json:"openInterest,omitempty"`
	//Volatility             float64 `json:"volatility,omitempty"`
	MoneyIntrinsicValue float64 `json:"moneyIntrinsicValue,omitempty"`
	Multiplier          float64 `json:"multiplier,omitempty"`
	StrikePrice         float64 `json:"strikePrice,omitempty"`
	//ContractType           string  `json:"contractType,omitempty"`
	//Underlying             string  `json:"underlying,omitempty"`
	TimeValue    float64 `json:"timeValue,omitempty"`
	Deliverables string  `json:"deliverables,omitempty"`
	Delta        float64 `json:"delta,omitempty"`
	Gamma        float64 `json:"gamma,omitempty"`
	Theta        float64 `json:"theta,omitempty"`
	Vega         float64 `json:"vega,omitempty"`
	Rho          float64 `json:"rho,omitempty"`
	//SecurityStatus         string  `json:"securityStatus,omitempty"`
	TheoreticalOptionValue float64 `json:"theoreticalOptionValue,omitempty"`
	UnderlyingPrice        float64 `json:"underlyingPrice,omitempty"`
	UvExpirationType       string  `json:"uvExpirationType,omitempty"`
	//Exchange               string  `json:"exchange,omitempty"`
	//ExchangeName           string  `json:"exchangeName,omitempty"`
	SettlementType string `json:"settlementType,omitempty"`

	// Forex
	//Symbol             string  `json:"symbol,omitempty"`
	//BidPriceInDouble   float64 `json:"bidPriceInDouble,omitempty"`
	//AskPriceInDouble   float64 `json:"askPriceInDouble,omitempty"`
	//LastPriceInDouble  float64 `json:"lastPriceInDouble,omitempty"`
	//HighPriceInDouble  float64 `json:"highPriceInDouble,omitempty"`
	//LowPriceInDouble   float64 `json:"lowPriceInDouble,omitempty"`
	//ClosePriceInDouble float64 `json:"closePriceInDouble,omitempty"`
	//Exchange           string  `json:"exchange,omitempty"`
	//Description        string  `json:"description,omitempty"`
	//OpenPriceInDouble  float64 `json:"openPriceInDouble,omitempty"`
	//ChangeInDouble     float64 `json:"changeInDouble,omitempty"`
	PercentChange float64 `json:"percentChange,omitempty"`
	//ExchangeName       string  `json:"exchangeName,omitempty"`
	//Digits             float64 `json:"digits,omitempty"`
	//SecurityStatus     string  `json:"securityStatus,omitempty"`
	//Tick               float64 `json:"tick,omitempty"`
	//TickAmount         float64 `json:"tickAmount,omitempty"`
	//Product            string  `json:"product,omitempty"`
	TradingHours string `json:"tradingHours,omitempty"`
	IsTradable   bool   `json:"isTradable,omitempty"`
	MarketMaker  string `json:"marketMaker,omitempty"`

	// ETF
	//Symbol                       string  `json:"symbol,omitempty"`
	//Description                  string  `json:"description,omitempty"`
	//BidPrice                     float64 `json:"bidPrice,omitempty"`
	//BidSize                      float64 `json:"bidSize,omitempty"`
	//BidID                        string  `json:"bidId,omitempty"`
	//AskPrice                     float64 `json:"askPrice,omitempty"`
	//AskSize                      float64 `json:"askSize,omitempty"`
	//AskID                        string  `json:"askId,omitempty"`
	//LastPrice                    float64 `json:"lastPrice,omitempty"`
	//LastSize                     float64 `json:"lastSize,omitempty"`
	//LastID                       string  `json:"lastId,omitempty"`
	//OpenPrice                    float64 `json:"openPrice,omitempty"`
	//HighPrice                    float64 `json:"highPrice,omitempty"`
	//LowPrice                     float64 `json:"lowPrice,omitempty"`
	//ClosePrice                   float64 `json:"closePrice,omitempty"`
	//NetChange                    float64 `json:"netChange,omitempty"`
	//TotalVolume                  float64 `json:"totalVolume,omitempty"`
	//QuoteTimeInLong              float64 `json:"quoteTimeInLong,omitempty"`
	//TradeTimeInLong              float64 `json:"tradeTimeInLong,omitempty"`
	//Mark                         float64 `json:"mark,omitempty"`
	//Exchange                     string  `json:"exchange,omitempty"`
	//ExchangeName                 string  `json:"exchangeName,omitempty"`
	Marginable bool `json:"marginable,omitempty"`
	Shortable  bool `json:"shortable,omitempty"`
	//Volatility                   float64 `json:"volatility,omitempty"`
	//Digits                       float64 `json:"digits,omitempty"`
	//Wk52High                     float64 `json:"52WkHigh,omitempty"`
	//Wk52Low                      float64 `json:"52WkLow,omitempty"`
	//PeRatio                      float64 `json:"peRatio,omitempty"`
	//DivAmount                    float64 `json:"divAmount,omitempty"`
	//DivYield                     float64 `json:"divYield,omitempty"`
	//DivDate                      string  `json:"divDate,omitempty"`
	//SecurityStatus               string  `json:"securityStatus,omitempty"`
	RegularMarketLastPrice       float64 `json:"regularMarketLastPrice,omitempty"`
	RegularMarketLastSize        float64 `json:"regularMarketLastSize,omitempty"`
	RegularMarketNetChange       float64 `json:"regularMarketNetChange,omitempty"`
	RegularMarketTradeTimeInLong float64 `json:"regularMarketTradeTimeInLong,omitempty"`
}

Quote https://developer.tdameritrade.com/quotes/apis

type QuoteMap

type QuoteMap struct {
	Quotes map[string]*Quote

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	ServerResponse `json:"-"`
}

QuoteMap https://developer.tdameritrade.com/quotes/apis

type Quotes

type Quotes struct {
	IsNyseDelayed   bool `json:"isNyseDelayed,omitempty"`
	IsNasdaqDelayed bool `json:"isNasdaqDelayed,omitempty"`
	IsOpraDelayed   bool `json:"isOpraDelayed,omitempty"`
	IsAmexDelayed   bool `json:"isAmexDelayed,omitempty"`
	IsCmeDelayed    bool `json:"isCmeDelayed,omitempty"`
	IsIceDelayed    bool `json:"isIceDelayed,omitempty"`
	IsForexDelayed  bool `json:"isForexDelayed,omitempty"`
}

Quotes https://developer.tdameritrade.com/user-principal/apis

type QuotesGetQuoteCall

type QuotesGetQuoteCall struct {
	DefaultCall
	// contains filtered or unexported fields
}

QuotesGetQuoteCall https://developer.tdameritrade.com/quotes/apis/get/marketdata/%7Bsymbol%7D/quotes Get quote for a symbol

func (*QuotesGetQuoteCall) Do

func (c *QuotesGetQuoteCall) Do() (*Quote, error)

Do send request

type QuotesGetQuoteListCall

type QuotesGetQuoteListCall struct {
	DefaultCall
}

QuotesGetQuoteListCall https://developer.tdameritrade.com/quotes/apis/get/marketdata/quotes Get quote for one or more symbols

func (*QuotesGetQuoteListCall) Do

Do send request

type QuotesService

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

QuotesService https://developer.tdameritrade.com/quotes/apis Request real-time and delayed top level quote data

func NewQuotesService

func NewQuotesService(s *Service) *QuotesService

NewQuotesService https://developer.tdameritrade.com/quotes/apis Request real-time and delayed top level quote data

func (*QuotesService) GetQuote

func (r *QuotesService) GetQuote(symbol string) *QuotesGetQuoteCall

GetQuote https://developer.tdameritrade.com/quotes/apis/get/marketdata/%7Bsymbol%7D/quotes Get quote for a symbol

Example
auth := NewAuth()
auth.SetTLS("./instance/cert.pem", "./instance/key.pem")
client := auth.GetClient(clientsecretPath, "TDAmeritrade-go.json")
td, err := New(client)
if err != nil {
	log.Fatal(err)
}

call := td.Quotes.GetQuote("VTI")
quote, err := call.Do()
if err != nil {
	log.Fatal(err)
}
fmt.Printf("%+v\n", quote)

func (*QuotesService) GetQuoteList

func (r *QuotesService) GetQuoteList(symbol ...string) *QuotesGetQuoteListCall

GetQuoteList https://developer.tdameritrade.com/quotes/apis/get/marketdata/quotes Get quote for one or more symbols

type SavedOrder

type SavedOrder struct {
	*Order
	SavedOrderID int64  `json:"savedOrderId,omitempty"` // for saved order
	SavedTime    string `json:"savedTime,omitempty"`    // for saved order

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	ServerResponse `json:"-"`
}

SavedOrder https://developer.tdameritrade.com/account-access/apis

type SavedOrderList

type SavedOrderList struct {
	SavedOrders []*SavedOrder

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	ServerResponse `json:"-"`
}

SavedOrderList https://developer.tdameritrade.com/account-access/apis

type SavedOrdersCreateSavedOrderCall

type SavedOrdersCreateSavedOrderCall struct {
	DefaultCall
	// contains filtered or unexported fields
}

SavedOrdersCreateSavedOrderCall https://developer.tdameritrade.com/account-access/apis/post/accounts/%7BaccountId%7D/savedorders-0 Save an order for a specific account.

func (*SavedOrdersCreateSavedOrderCall) Do

Do send request

type SavedOrdersDeleteSavedOrderCall

type SavedOrdersDeleteSavedOrderCall struct {
	DefaultCall
	// contains filtered or unexported fields
}

SavedOrdersDeleteSavedOrderCall https://developer.tdameritrade.com/account-access/apis/delete/accounts/%7BaccountId%7D/savedorders/%7BsavedOrderId%7D-0 Delete a specific saved order for a specific account.

func (*SavedOrdersDeleteSavedOrderCall) Do

Do send request

type SavedOrdersGetSavedOrderCall

type SavedOrdersGetSavedOrderCall struct {
	DefaultCall
	// contains filtered or unexported fields
}

SavedOrdersGetSavedOrderCall https://developer.tdameritrade.com/account-access/apis/get/accounts/%7BaccountId%7D/savedorders/%7BsavedOrderId%7D-0 Specific saved order by its ID, for a specific account.

func (*SavedOrdersGetSavedOrderCall) Do

Do send request

type SavedOrdersGetSavedOrdersByPathCall

type SavedOrdersGetSavedOrdersByPathCall struct {
	DefaultCall
	// contains filtered or unexported fields
}

SavedOrdersGetSavedOrdersByPathCall https://developer.tdameritrade.com/account-access/apis/get/accounts/%7BaccountId%7D/savedorders-0 Saved orders for a specific account.

func (*SavedOrdersGetSavedOrdersByPathCall) Do

Do send request

type SavedOrdersReplaceSavedOrderCall

type SavedOrdersReplaceSavedOrderCall struct {
	DefaultCall
	// contains filtered or unexported fields
}

SavedOrdersReplaceSavedOrderCall https://developer.tdameritrade.com/account-access/apis/put/accounts/%7BaccountId%7D/savedorders/%7BsavedOrderId%7D-0 Replace an existing saved order for an account. The existing saved order will be replaced by the new order.

func (*SavedOrdersReplaceSavedOrderCall) Do

Do send request

type SavedOrdersService

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

SavedOrdersService https://developer.tdameritrade.com/account-access/apis APIs to access Account Balances, Positions, Trade Info and place Trades

func NewSavedOrdersService

func NewSavedOrdersService(s *Service) *SavedOrdersService

NewSavedOrdersService https://developer.tdameritrade.com/account-access/apis APIs to access Account Balances, Positions, Trade Info and place Trades

func (*SavedOrdersService) CreateSavedOrder

func (r *SavedOrdersService) CreateSavedOrder(accountID string, savedOrder *SavedOrder) *SavedOrdersCreateSavedOrderCall

CreateSavedOrder https://developer.tdameritrade.com/account-access/apis/post/accounts/%7BaccountId%7D/savedorders-0 Save an order for a specific account.

func (*SavedOrdersService) DeleteSavedOrder

func (r *SavedOrdersService) DeleteSavedOrder(accountID string, savedOrderID int64) *SavedOrdersDeleteSavedOrderCall

DeleteSavedOrder https://developer.tdameritrade.com/account-access/apis/delete/accounts/%7BaccountId%7D/savedorders/%7BsavedOrderId%7D-0 Delete a specific saved order for a specific account.

func (*SavedOrdersService) GetSavedOrder

func (r *SavedOrdersService) GetSavedOrder(accountID string, savedOrderID int64) *SavedOrdersGetSavedOrderCall

GetSavedOrder https://developer.tdameritrade.com/account-access/apis/get/accounts/%7BaccountId%7D/savedorders/%7BsavedOrderId%7D-0 Specific saved order by its ID, for a specific account.

func (*SavedOrdersService) GetSavedOrdersByPath

func (r *SavedOrdersService) GetSavedOrdersByPath(accountID string) *SavedOrdersGetSavedOrdersByPathCall

GetSavedOrdersByPath https://developer.tdameritrade.com/account-access/apis/get/accounts/%7BaccountId%7D/savedorders-0 Saved orders for a specific account.

func (*SavedOrdersService) ReplaceSavedOrder

func (r *SavedOrdersService) ReplaceSavedOrder(accountID string, savedOrderID int64, savedOrder *SavedOrder) *SavedOrdersReplaceSavedOrderCall

ReplaceSavedOrder https://developer.tdameritrade.com/account-access/apis/put/accounts/%7BaccountId%7D/savedorders/%7BsavedOrderId%7D-0 Replace an existing saved order for an account. The existing saved order will be replaced by the new order.

type SecuritiesAccount

type SecuritiesAccount struct {
	Type                    string             `json:"type,omitempty"`
	AccountID               string             `json:"accountId,omitempty"`
	RoundTrips              float64            `json:"roundTrips,omitempty"`
	IsDayTrader             bool               `json:"isDayTrader,omitempty"`
	IsClosingOnlyRestricted bool               `json:"isClosingOnlyRestricted,omitempty"`
	Positions               []*Position        `json:"positions,omitempty"`
	OrderStrategies         []*OrderStrategie  `json:"orderStrategies,omitempty"`
	InitialBalances         *InitialBalances   `json:"initialBalances,omitempty"`
	CurrentBalances         *CurrentBalances   `json:"currentBalances,omitempty"`
	ProjectedBalances       *ProjectedBalances `json:"projectedBalances,omitempty"`
}

SecuritiesAccount https://developer.tdameritrade.com/account-access/apis

type ServerResponse

type ServerResponse struct {
	// HTTPStatusCode is the server's response status code. When using a
	// resource method's Do call, this will always be in the 2xx range.
	HTTPStatusCode int
	// Header contains the response header fields from the server.
	Header http.Header
}

ServerResponse is embedded in each Do response and provides the HTTP status code and header sent by the server.

type Service

type Service struct {
	BasePath  string // API endpoint base URL
	UserAgent string // optional additional User-Agent fragment

	Orders             *OrdersService
	SavedOrders        *SavedOrdersService
	Accounts           *AccountsService
	Instruments        *InstrumentsService
	MarketHours        *MarketHoursService
	Movers             *MoversService
	OptionChains       *OptionChainsService
	PriceHistory       *PriceHistoryService
	Quotes             *QuotesService
	TransactionHistory *TransactionHistoryService
	UserPrincipals     *UserPrincipalsService
	Watchlist          *WatchlistService
	// contains filtered or unexported fields
}

Service TD api Service

func New

func New(client *http.Client) (*Service, error)

New TDAmeritrade API Server

type SessionHours

type SessionHours struct {
	PreMarket     []Period `json:"preMarket,omitempty"`
	RegularMarket []Period `json:"regularMarket,omitempty"`
	PostMarket    []Period `json:"postMarket,omitempty"`
}

SessionHours https://developer.tdameritrade.com/market-hours/apis

type StreamerInfo

type StreamerInfo struct {
	StreamerBinaryURL string `json:"streamerBinaryUrl,omitempty"` //"string"
	StreamerSocketURL string `json:"streamerSocketUrl,omitempty"` //"string"
	Token             string `json:"token,omitempty"`             //"string"
	TokenTimestamp    string `json:"tokenTimestamp,omitempty"`    //"string"
	UserGroup         string `json:"userGroup,omitempty"`         //"string"
	AccessLevel       string `json:"accessLevel,omitempty"`       //"string"
	ACL               string `json:"acl,omitempty"`               //"string"
	AppID             string `json:"appId,omitempty"`             //"string"
}

StreamerInfo https://developer.tdameritrade.com/user-principal/apis

type SubscriptionKey

type SubscriptionKey struct {
	// ServerResponse contains the HTTP response code and headers from the
	// server.
	ServerResponse `json:"-"`

	Keys []*Key `json:"keys,omitempty"`
}

SubscriptionKey https://developer.tdameritrade.com/user-principal/apis

type Time

type Time time.Time

Time for time.Unix

func (*Time) MarshalJSON

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

MarshalJSON for time.Unix

func (Time) String

func (t Time) String() string

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(bs []byte) (err error)

UnmarshalJSON for time.Unix

type Transaction

type Transaction struct {
	// ServerResponse contains the HTTP response code and headers from the
	// server.
	ServerResponse `json:"-"`

	Type                          string           `json:"type,omitempty"`                    //"'TRADE' or 'RECEIVE_AND_DELIVER' or 'DIVIDEND_OR_INTEREST' or 'ACH_RECEIPT' or 'ACH_DISBURSEMENT' or 'CASH_RECEIPT' or 'CASH_DISBURSEMENT' or 'ELECTRONIC_FUND' or 'WIRE_OUT' or 'WIRE_IN' or 'JOURNAL' or 'MEMORANDUM' or 'MARGIN_CALL' or 'MONEY_MARKET' or 'SMA_ADJUSTMENT'"
	ClearingReferenceNumber       string           `json:"clearingReferenceNumber,omitempty"` //"string"
	SubAccount                    string           `json:"subAccount,omitempty"`              //"string"
	SettlementDate                string           `json:"settlementDate,omitempty"`          //"string"
	OrderID                       string           `json:"orderId,omitempty"`                 //"string"
	Sma                           float64          `json:"sma,omitempty"`
	RequirementReallocationAmount float64          `json:"requirementReallocationAmount,omitempty"`
	DayTradeBuyingPowerEffect     float64          `json:"dayTradeBuyingPowerEffect,omitempty"`
	NetAmount                     float64          `json:"netAmount,omitempty"`
	TransactionDate               string           `json:"transactionDate,omitempty"`    //"string"
	OrderDate                     string           `json:"orderDate,omitempty"`          //"string"
	TransactionSubType            string           `json:"transactionSubType,omitempty"` //"string"
	TransactionID                 int64            `json:"transactionId,omitempty"`
	CashBalanceEffectFlag         bool             `json:"cashBalanceEffectFlag,omitempty"`
	Description                   string           `json:"description,omitempty"` //"string"
	AchStatus                     string           `json:"achStatus,omitempty"`   //"'Approved' or 'Rejected' or 'Cancel' or 'Error'"
	AccruedInterest               float64          `json:"accruedInterest,omitempty"`
	Fees                          *Fees            `json:"fees,omitempty"` //"object"
	TransactionItem               *TransactionItem `json:"transactionItem,omitempty"`
}

Transaction https://developer.tdameritrade.com/transaction-history/apis

type TransactionHistoryGetTransactionCall

type TransactionHistoryGetTransactionCall struct {
	DefaultCall
	// contains filtered or unexported fields
}

TransactionHistoryGetTransactionCall https://developer.tdameritrade.com/transaction-history/apis/get/accounts/%7BaccountId%7D/transactions/%7BtransactionId%7D-0 Transaction for a specific account. 感覺 api 有問題,給正確的 transactionID 卻找不到

func (*TransactionHistoryGetTransactionCall) Do

Do send request

type TransactionHistoryGetTransactionListCall

type TransactionHistoryGetTransactionListCall struct {
	DefaultCall
	// contains filtered or unexported fields
}

TransactionHistoryGetTransactionListCall https://developer.tdameritrade.com/transaction-history/apis/get/accounts/%7BaccountId%7D/transactions-0 Transactions for a specific account.

func (*TransactionHistoryGetTransactionListCall) Do

Do send request

func (*TransactionHistoryGetTransactionListCall) EndDate

EndDate https://developer.tdameritrade.com/transaction-history/apis/get/accounts/%7BaccountId%7D/transactions-0 Only transactions before the End Date will be returned. Note: The maximum date range is one year. Valid ISO-8601 formats are : yyyy-MM-dd.

func (*TransactionHistoryGetTransactionListCall) StartDate

StartDate https://developer.tdameritrade.com/transaction-history/apis/get/accounts/%7BaccountId%7D/transactions-0 Only transactions after the Start Date will be returned. Note: The maximum date range is one year. Valid ISO-8601 formats are : yyyy-MM-dd.

func (*TransactionHistoryGetTransactionListCall) Symbol

Symbol https://developer.tdameritrade.com/transaction-history/apis/get/accounts/%7BaccountId%7D/transactions-0 Only transactions with the specified symbol will be returned.

func (*TransactionHistoryGetTransactionListCall) Type

Type https://developer.tdameritrade.com/transaction-history/apis/get/accounts/%7BaccountId%7D/transactions-0 Only transactions with the specified type will be returned.

type TransactionHistoryService

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

TransactionHistoryService https://developer.tdameritrade.com/transaction-history/apis APIs to access transaction history on the account

func NewTransactionHistoryService

func NewTransactionHistoryService(s *Service) *TransactionHistoryService

NewTransactionHistoryService https://developer.tdameritrade.com/transaction-history/apis APIs to access transaction history on the account

func (*TransactionHistoryService) GetTransaction

func (r *TransactionHistoryService) GetTransaction(accountID, transactionID string) *TransactionHistoryGetTransactionCall

GetTransaction https://developer.tdameritrade.com/transaction-history/apis/get/accounts/%7BaccountId%7D/transactions/%7BtransactionId%7D-0 Transaction for a specific account. 感覺 api 有問題,給正確的 transactionID 卻找不到

func (*TransactionHistoryService) GetTransactionList

GetTransactionList https://developer.tdameritrade.com/transaction-history/apis/get/accounts/%7BaccountId%7D/transactions-0 Transactions for a specific account.

type TransactionItem

type TransactionItem struct {
	AccountID            int64       `json:"accountId,omitempty"`
	Amount               float64     `json:"amount,omitempty"`
	Price                float64     `json:"price,omitempty"`
	Cost                 float64     `json:"cost,omitempty"`
	ParentOrderKey       float64     `json:"parentOrderKey,omitempty"`
	ParentChildIndicator string      `json:"parentChildIndicator,omitempty"` //"string"
	Instruction          string      `json:"instruction,omitempty"`          //"string"
	PositionEffect       string      `json:"positionEffect,omitempty"`       //"string"
	Instrument           *Instrument `json:"instrument,omitempty"`
}

TransactionItem https://developer.tdameritrade.com/transaction-history/apis

type TransactionList

type TransactionList struct {
	Transactions []*Transaction

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	ServerResponse `json:"-"`
}

TransactionList https://developer.tdameritrade.com/transaction-history/apis

type Underlying

type Underlying struct {
	Ask               float64 `json:"ask,omitempty"`
	AskSize           string  `json:"askSize,omitempty"`
	Bid               float64 `json:"bid,omitempty"`
	BidSize           string  `json:"bidSize,omitempty"`
	Change            float64 `json:"change,omitempty"`
	Close             float64 `json:"close,omitempty"`
	Delayed           bool    `json:"delayed,omitempty"`
	Description       string  `json:"description,omitempty"`  //"string"
	ExchangeName      string  `json:"exchangeName,omitempty"` //"string"
	FiftyTwoWeekHigh  float64 `json:"fiftyTwoWeekHigh,omitempty"`
	FiftyTwoWeekLow   float64 `json:"fiftyTwoWeekLow,omitempty"`
	HighPrice         float64 `json:"highPrice,omitempty"`
	Last              float64 `json:"last,omitempty"`
	LowPrice          float64 `json:"lowPrice,omitempty"`
	Mark              float64 `json:"mark,omitempty"`
	MarkChange        float64 `json:"markChange,omitempty"`
	MarkPercentChange float64 `json:"markPercentChange,omitempty"`
	OpenPrice         float64 `json:"openPrice,omitempty"`
	PercentChange     float64 `json:"percentChange,omitempty"`
	QuoteTime         string  `json:"quoteTime,omitempty"`
	Symbol            string  `json:"symbol,omitempty"` //"string"
	TotalVolume       string  `json:"totalVolume,omitempty"`
	TradeTime         string  `json:"tradeTime,omitempty"`
}

Underlying https://developer.tdameritrade.com/option-chains/apis

type UserPrincipal

type UserPrincipal struct {
	// ServerResponse contains the HTTP response code and headers from the
	// server.
	ServerResponse `json:"-"`

	AuthToken                string           `json:"authToken,omitempty"`           //"string"
	UserID                   string           `json:"userId,omitempty"`              //"string"
	UserCdDomainID           string           `json:"userCdDomainId,omitempty"`      //"string"
	PrimaryAccountID         string           `json:"primaryAccountId,omitempty"`    //"string"
	LastLoginTime            string           `json:"lastLoginTime,omitempty"`       //"string"
	TokenExpirationTime      string           `json:"tokenExpirationTime,omitempty"` //"string"
	LoginTime                string           `json:"loginTime,omitempty"`           //"string"
	AccessLevel              string           `json:"accessLevel,omitempty"`         //"string"
	StalePassword            bool             `json:"stalePassword,omitempty"`
	StreamerInfo             *StreamerInfo    `json:"streamerInfo,omitempty"`
	ProfessionalStatus       string           `json:"professionalStatus,omitempty"` //"'PROFESSIONAL' or 'NON_PROFESSIONAL' or 'UNKNOWN_STATUS'"
	Quotes                   *Quotes          `json:"quotes,omitempty"`
	StreamerSubscriptionKeys *SubscriptionKey `json:"streamerSubscriptionKeys,omitempty"`
	Accounts                 []*AccountU      `json:"accounts,omitempty"`
}

UserPrincipal https://developer.tdameritrade.com/user-principal/apis

type UserPrincipalsGetPreferencesCall

type UserPrincipalsGetPreferencesCall struct {
	DefaultCall
	// contains filtered or unexported fields
}

UserPrincipalsGetPreferencesCall https://developer.tdameritrade.com/user-principal/apis/get/accounts/%7BaccountId%7D/preferences-0 Preferences for a specific account.

func (*UserPrincipalsGetPreferencesCall) Do

Do send request

type UserPrincipalsGetStreamerSubscriptionKeysCall

type UserPrincipalsGetStreamerSubscriptionKeysCall struct {
	DefaultCall
}

UserPrincipalsGetStreamerSubscriptionKeysCall https://developer.tdameritrade.com/user-principal/apis/get/userprincipals/streamersubscriptionkeys-0 SubscriptionKey for provided accounts or default accounts.

func (*UserPrincipalsGetStreamerSubscriptionKeysCall) Do

Do send request

type UserPrincipalsGetUserPrincipalsCall

type UserPrincipalsGetUserPrincipalsCall struct {
	DefaultCall
}

UserPrincipalsGetUserPrincipalsCall https://developer.tdameritrade.com/user-principal/apis/get/userprincipals-0 User Principal details.

func (*UserPrincipalsGetUserPrincipalsCall) Do

Do send request

func (*UserPrincipalsGetUserPrincipalsCall) Fields

Fields https://developer.tdameritrade.com/user-principal/apis/get/userprincipals-0 A comma separated String which allows one to specify additional fields to return. None of these fields are returned by default. Possible values in this String can be:

streamerSubscriptionKeys streamerConnectionInfo preferences surrogateIds

Example: fields=streamerSubscriptionKeys,streamerConnectionInfo

type UserPrincipalsService

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

UserPrincipalsService https://developer.tdameritrade.com/user-principal/apis APIs to access user-authorized accounts and their preferences

func NewUserPrincipalsService

func NewUserPrincipalsService(s *Service) *UserPrincipalsService

NewUserPrincipalsService https://developer.tdameritrade.com/user-principal/apis APIs to access user-authorized accounts and their preferences

func (*UserPrincipalsService) GetPreferences

func (r *UserPrincipalsService) GetPreferences(accountID string) *UserPrincipalsGetPreferencesCall

GetPreferences https://developer.tdameritrade.com/user-principal/apis/get/accounts/%7BaccountId%7D/preferences-0 Preferences for a specific account.

func (*UserPrincipalsService) GetStreamerSubscriptionKeys

func (r *UserPrincipalsService) GetStreamerSubscriptionKeys(accountIDs ...string) *UserPrincipalsGetStreamerSubscriptionKeysCall

GetStreamerSubscriptionKeys https://developer.tdameritrade.com/user-principal/apis/get/userprincipals/streamersubscriptionkeys-0 SubscriptionKey for provided accounts or default accounts.

func (*UserPrincipalsService) GetUserPrincipals

GetUserPrincipals https://developer.tdameritrade.com/user-principal/apis/get/userprincipals-0 User Principal details.

func (*UserPrincipalsService) UpdatePreferences

func (r *UserPrincipalsService) UpdatePreferences(accountID string, preferences *Preferences) *UserPrincipalsUpdatePreferencesCall

UpdatePreferences https://developer.tdameritrade.com/user-principal/apis/put/accounts/%7BaccountId%7D/preferences-0 Update preferences for a specific account. Please note that the directOptionsRouting and directEquityRouting values cannot be modified via this operation.

type UserPrincipalsUpdatePreferencesCall

type UserPrincipalsUpdatePreferencesCall struct {
	DefaultCall
	// contains filtered or unexported fields
}

UserPrincipalsUpdatePreferencesCall https://developer.tdameritrade.com/user-principal/apis/put/accounts/%7BaccountId%7D/preferences-0 Update preferences for a specific account. Please note that the directOptionsRouting and directEquityRouting values cannot be modified via this operation.

func (*UserPrincipalsUpdatePreferencesCall) Do

Do send request

type Watchlist

type Watchlist struct {
	// ServerResponse contains the HTTP response code and headers from the
	// server.
	ServerResponse `json:"-"`

	Name           string           `json:"name,omitempty"`        //"string"
	WatchlistID    string           `json:"watchlistId,omitempty"` //"string"
	AccountID      string           `json:"accountId,omitempty"`   //"string"
	Status         string           `json:"status,omitempty"`      //"'UNCHANGED' or 'CREATED' or 'UPDATED' or 'DELETED'"
	WatchlistItems []*WatchlistItem `json:"watchlistItems,omitempty"`
}

Watchlist https://developer.tdameritrade.com/watchlist/apis

type WatchlistCreateWatchlistCall

type WatchlistCreateWatchlistCall struct {
	DefaultCall
	// contains filtered or unexported fields
}

WatchlistCreateWatchlistCall https://developer.tdameritrade.com/watchlist/apis/post/accounts/%7BaccountId%7D/watchlists-0 Create watchlist for specific account.This method does not verify that the symbol or asset type are valid.

func (*WatchlistCreateWatchlistCall) Do

Do send request

type WatchlistDeleteWatchlistCall

type WatchlistDeleteWatchlistCall struct {
	DefaultCall
	// contains filtered or unexported fields
}

WatchlistDeleteWatchlistCall https://developer.tdameritrade.com/watchlist/apis/delete/accounts/%7BaccountId%7D/watchlists/%7BwatchlistId%7D-0 Delete watchlist for a specific account.

func (*WatchlistDeleteWatchlistCall) Do

Do send request

type WatchlistGetWatchlistCall

type WatchlistGetWatchlistCall struct {
	DefaultCall
	// contains filtered or unexported fields
}

WatchlistGetWatchlistCall https://developer.tdameritrade.com/watchlist/apis/get/accounts/%7BaccountId%7D/watchlists/%7BwatchlistId%7D-0 Specific watchlist for a specific account.

func (*WatchlistGetWatchlistCall) Do

Do send request

type WatchlistGetWatchlistsForMultipleAccountsCall

type WatchlistGetWatchlistsForMultipleAccountsCall struct {
	DefaultCall
}

WatchlistGetWatchlistsForMultipleAccountsCall https://developer.tdameritrade.com/watchlist/apis/get/accounts/watchlists-0 All watchlists for all of the user's linked accounts.

func (*WatchlistGetWatchlistsForMultipleAccountsCall) Do

Do send request

type WatchlistGetWatchlistsForSingleAccountCall

type WatchlistGetWatchlistsForSingleAccountCall struct {
	DefaultCall
	// contains filtered or unexported fields
}

WatchlistGetWatchlistsForSingleAccountCall https://developer.tdameritrade.com/watchlist/apis/get/accounts/%7BaccountId%7D/watchlists-0 All watchlists of an account.

func (*WatchlistGetWatchlistsForSingleAccountCall) Do

Do send request

type WatchlistItem

type WatchlistItem struct {
	SequenceID    int64       `json:"sequenceId,omitempty"`
	Quantity      float64     `json:"quantity,omitempty"`
	AveragePrice  float64     `json:"averagePrice,omitempty"`
	Commission    float64     `json:"commission,omitempty"`
	PurchasedDate string      `json:"purchasedDate,omitempty"` //"DateParam\"",
	Instrument    *Instrument `json:"instrument,omitempty"`
	Status        string      `json:"status,omitempty"` //"'UNCHANGED' or 'CREATED' or 'UPDATED' or 'DELETED'"
}

WatchlistItem https://developer.tdameritrade.com/watchlist/apis

type WatchlistList

type WatchlistList struct {
	Watchlists []*Watchlist

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	ServerResponse `json:"-"`
}

WatchlistList https://developer.tdameritrade.com/watchlist/apis

type WatchlistReplaceWatchlistCall

type WatchlistReplaceWatchlistCall struct {
	DefaultCall
	// contains filtered or unexported fields
}

WatchlistReplaceWatchlistCall https://developer.tdameritrade.com/watchlist/apis/put/accounts/%7BaccountId%7D/watchlists/%7BwatchlistId%7D-0 Replace watchlist for a specific account. This method does not verify that the symbol or asset type are valid.

func (*WatchlistReplaceWatchlistCall) Do

Do send request

type WatchlistService

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

WatchlistService https://developer.tdameritrade.com/watchlist/apis APIs to perform CRUD operations on Account Watchlist

func NewWatchlistService

func NewWatchlistService(s *Service) *WatchlistService

NewWatchlistService https://developer.tdameritrade.com/watchlist/apis APIs to perform CRUD operations on Account Watchlist

func (*WatchlistService) CreateWatchlist

func (r *WatchlistService) CreateWatchlist(accountID string, watchlist *Watchlist) *WatchlistCreateWatchlistCall

CreateWatchlist https://developer.tdameritrade.com/watchlist/apis/post/accounts/%7BaccountId%7D/watchlists-0 Create watchlist for specific account.This method does not verify that the symbol or asset type are valid.

func (*WatchlistService) DeleteWatchlist

func (r *WatchlistService) DeleteWatchlist(accountID, watchlistID string) *WatchlistDeleteWatchlistCall

DeleteWatchlist https://developer.tdameritrade.com/watchlist/apis/delete/accounts/%7BaccountId%7D/watchlists/%7BwatchlistId%7D-0 Delete watchlist for a specific account.

func (*WatchlistService) GetWatchlist

func (r *WatchlistService) GetWatchlist(accountID, watchlistID string) *WatchlistGetWatchlistCall

GetWatchlist https://developer.tdameritrade.com/watchlist/apis/get/accounts/%7BaccountId%7D/watchlists/%7BwatchlistId%7D-0 Specific watchlist for a specific account.

func (*WatchlistService) GetWatchlistsForMultipleAccounts

func (r *WatchlistService) GetWatchlistsForMultipleAccounts() *WatchlistGetWatchlistsForMultipleAccountsCall

GetWatchlistsForMultipleAccounts https://developer.tdameritrade.com/watchlist/apis/get/accounts/watchlists-0 All watchlists for all of the user's linked accounts.

func (*WatchlistService) GetWatchlistsForSingleAccount

func (r *WatchlistService) GetWatchlistsForSingleAccount(accountID string) *WatchlistGetWatchlistsForSingleAccountCall

GetWatchlistsForSingleAccount https://developer.tdameritrade.com/watchlist/apis/get/accounts/%7BaccountId%7D/watchlists-0 All watchlists of an account.

func (*WatchlistService) ReplaceWatchlist

func (r *WatchlistService) ReplaceWatchlist(accountID, watchlistID string, watchlist *Watchlist) *WatchlistReplaceWatchlistCall

ReplaceWatchlist https://developer.tdameritrade.com/watchlist/apis/put/accounts/%7BaccountId%7D/watchlists/%7BwatchlistId%7D-0 Replace watchlist for a specific account. This method does not verify that the symbol or asset type are valid.

func (*WatchlistService) UpdateWatchlist

func (r *WatchlistService) UpdateWatchlist(accountID, watchlistID string, watchlist *Watchlist) *WatchlistUpdateWatchlistCall

UpdateWatchlist https://developer.tdameritrade.com/watchlist/apis/patch/accounts/%7BaccountId%7D/watchlists/%7BwatchlistId%7D-0 Partially update watchlist for a specific account: change watchlist name, add to the beginning/end of a watchlist, update or delete items in a watchlist. This method does not verify that the symbol or asset type are valid.

type WatchlistUpdateWatchlistCall

type WatchlistUpdateWatchlistCall struct {
	DefaultCall
	// contains filtered or unexported fields
}

WatchlistUpdateWatchlistCall https://developer.tdameritrade.com/watchlist/apis/patch/accounts/%7BaccountId%7D/watchlists/%7BwatchlistId%7D-0 Partially update watchlist for a specific account: change watchlist name, add to the beginning/end of a watchlist, update or delete items in a watchlist. This method does not verify that the symbol or asset type are valid.

func (*WatchlistUpdateWatchlistCall) Do

Do send request

Jump to

Keyboard shortcuts

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