Versions in this module Expand all Collapse all v0 v0.2.3 May 25, 2022 Changes in this version + var ChangeTypes = []string + var DirectionTypes = []string + var ErrNoCode = fmt.Errorf("missing code in request from TD Ameritrade") + var ErrNoState = fmt.Errorf("missing state in request from TD Ameritrade") + type Account struct + type AccountOptions struct + Orders bool + Position bool + type Accounts []*Account + type AccountsService struct + func (s *AccountsService) CancelOrder(ctx context.Context, accountID, orderID string) (*Response, error) + func (s *AccountsService) CreateSavedOrder(ctx context.Context, accountID string, order *Order) (*Response, error) + func (s *AccountsService) DeleteSavedOrder(ctx context.Context, accountID, savedOrderID string) (*Response, error) + func (s *AccountsService) GetAccount(ctx context.Context, accountID string, opts *AccountOptions) (*Account, *Response, error) + func (s *AccountsService) GetAccounts(ctx context.Context, opts *AccountOptions) (*Accounts, *Response, error) + func (s *AccountsService) GetOrder(ctx context.Context, accountID, orderID string) (*Response, error) + func (s *AccountsService) GetOrderByPath(ctx context.Context, accountID string, orderParams *OrderParams) (*Orders, *Response, error) + func (s *AccountsService) GetOrderByQuery(ctx context.Context, accountID string, orderParams *OrderParams) (*Orders, *Response, error) + func (s *AccountsService) GetSavedOrder(ctx context.Context, accountID, savedOrderID string, orderParams *OrderParams) (*Response, error) + func (s *AccountsService) PlaceOrder(ctx context.Context, accountID string, order *Order) (*Response, error) + func (s *AccountsService) ReplaceOrder(ctx context.Context, accountID string, orderID string, order *Order) (*Response, error) + func (s *AccountsService) ReplaceSavedOrder(ctx context.Context, accountID, savedOrderID string, order *Order) (*Response, error) + type Authenticator struct + AuthOpts []oauth2.AuthCodeOption + OAuth2 oauth2.Config + Store PersistentStore + func NewAuthenticator(store PersistentStore, oauth2 oauth2.Config, opts ...oauth2.AuthCodeOption) *Authenticator + func (a *Authenticator) AuthenticatedClient(ctx context.Context, req *http.Request) (*Client, error) + func (a *Authenticator) FinishOAuth2Flow(ctx context.Context, w http.ResponseWriter, req *http.Request) (*Client, error) + func (a *Authenticator) StartOAuth2Flow(w http.ResponseWriter, req *http.Request) (string, error) + type Authorizations struct + AdvancedMargin bool + Apex bool + LevelTwoQuotes bool + MarginTrading bool + OptionTradingLevel string + ScottradeAccount bool + StockTrading bool + StreamerAccess bool + StreamingNews bool + type Balance struct + AccruedInterest float64 + BondValue float64 + CashAvailableForTrading float64 + CashAvailableForWithdrawal float64 + CashBalance float64 + CashCall float64 + CashDebitCallValue float64 + CashReceipts float64 + LiquidationValue float64 + LongMarketValue float64 + LongNonMarginableMarketValue float64 + LongOptionMarketValue float64 + MoneyMarketFund float64 + MutualFundValue float64 + PendingDeposits float64 + Savings float64 + ShortMarketValue float64 + ShortOptionMarketValue float64 + TotalCash float64 + UnsettledCash float64 + type CancelTime struct + Date string + ShortFormat bool + type CashEquivalent struct + Cusip string + Description string + Symbol string + Type string + type Chains struct + CallExpDateMap ExpDateMap + DaysToExpiration float64 + InterestRate float64 + Interval float64 + IsDelayed bool + IsIndex bool + NumberOfContracts int + PutExpDateMap ExpDateMap + Status string + Strategy string + Symbol string + Underlying Underlying + UnderlyingPrice float64 + Volatility float64 + type ChainsService struct + func (s *ChainsService) GetChains(ctx context.Context, queryValues url.Values) (*Chains, *Response, error) + type Client struct + Account *AccountsService + BaseURL *url.URL + Chains *ChainsService + Instrument *InstrumentService + MarketHours *MarketHoursService + Mover *MoverService + PriceHistory *PriceHistoryService + Quotes *QuotesService + TransactionHistory *TransactionHistoryService + User *UserService + Watchlist *WatchlistService + func NewClient(httpClient *http.Client) (*Client, error) + func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Response, error) + func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) + func (c *Client) UpdateBaseURL(baseURL string) error + type Equity struct + Cusip string + Description string + Symbol string + type Execution struct + ActivityType string + ExecutionLegs []*ExecutionLeg + ExecutionType string + OrderRemainingQuantity float64 + Quantity float64 + type ExecutionLeg struct + LegID int64 + MismarkedQuantity float64 + Price float64 + Quantity float64 + Time string + type ExpDateMap map[string]map[string][]ExpDateOption + type ExpDateOption struct + Ask float64 + AskSize int + Bid float64 + BidAskSize string + BidSize int + ClosePrice float64 + DaysToExpiration int + DeliverableNote string + Delta float64 + Description string + ExchangeName string + ExpirationDate int + ExpirationType string + Gamma float64 + HighPrice float64 + InTheMoney bool + IsIndexOption bool + Last float64 + LastSize float64 + LastTradingDate int + LowPrice float64 + Mark float64 + MarkChange float64 + MarkPercentChange float64 + Mini bool + Multiplier float64 + NetChange float64 + NonStandard bool + OpenInterest int + OpenPrice float64 + OptionDeliverablesList string + PercentChange float64 + PutCall string + QuoteTimeInLong int + Rho float64 + SettlementType string + StrikePrice float64 + Symbol string + TheoreticalOptionValue float64 + TheoreticalVolatility float64 + Theta float64 + TimeValue float64 + TotalVolume int + TradeDate string + TradeTimeInLong int + Vega float64 + Volatility float64 + type FixedIncome struct + Cusip string + Description string + Factor float64 + MaturityDate string + Symbol string + VariableRate float64 + type Hours struct + Category string + Date string + Exchange string + IsOpen bool + MarketType string + Product string + ProductName string + SessionHours SessionHours + type Instrument struct + AssetType string + Data interface{} + func (i *Instrument) MarshalJSON() ([]byte, error) + func (i *Instrument) UnmarshalJSON(bs []byte) (err error) + type InstrumentInfo struct + Cusip string + Description string + Exchange string + Symbol string + Type string + type InstrumentService struct + func (s *InstrumentService) GetInstrument(ctx context.Context, cusip string) (*Instruments, *Response, error) + func (s *InstrumentService) SearchInstruments(ctx context.Context, symbol, projection string) (*Instruments, *Response, error) + type Instruments map[string]*InstrumentInfo + type KeyEntry struct + Key string + type MarketHours map[string]map[string]*Hours + type MarketHoursService struct + func (s *MarketHoursService) GetMarketHours(ctx context.Context, market string, date time.Time) (*MarketHours, *Response, error) + func (s *MarketHoursService) GetMarketHoursMulti(ctx context.Context, markets string, date time.Time) (*MarketHours, *Response, error) + type Mover struct + Change float64 + Description string + Direction string + Last float64 + Symbol string + TotalVolume float64 + type MoverOptions struct + ChangeType string + Direction string + type MoverService struct + func (s *MoverService) Mover(ctx context.Context, symbol string, opts *MoverOptions) (*[]Mover, *Response, error) + type MutualFund struct + Cusip string + Description string + Symbol string + Type string + type NewWatchlist struct + Name string + WatchlistItems []WatchlistItem + type OptionA struct + Cusip string + Description string + OptionDeliverables []*OptionDeliverable + OptionMultiplier float64 + PutCall string + Symbol string + Type string + UnderlyingSymbol string + type OptionDeliverable struct + AssetType string + CurrencyType string + DeliverableUnits float64 + Symbol string + type Order struct + AccountID float64 + ActivationPrice float64 + CancelTime *CancelTime + Cancelable bool + ChildOrderStrategies []*Order + CloseTime string + ComplexOrderStrategyType string + DestinationLinkName string + Duration string + Editable bool + EnteredTime string + FilledQuantity float64 + OrderActivityCollection []*Execution + OrderID int64 + OrderLegCollection []*OrderLegCollection + OrderStrategyType string + OrderType string + Price float64 + PriceLinkBasis string + PriceLinkType string + Quantity float64 + ReleaseTime string + RemainingQuantity float64 + ReplacingOrderCollection []*Order + RequestedDestination string + Session string + SpecialInstruction string + Status string + StatusDescription string + StopPrice float64 + StopPriceLinkBasis string + StopPriceLinkType string + StopPriceOffset float64 + StopType string + Tag string + TaxLotMethod string + type OrderActivity struct + ActivityId int64 + ActivityType string + ExecutionLegs []*ExecutionLeg + ExecutionType string + OrderRemainingQuantity float64 + Quantity float64 + type OrderLegCollection struct + Instruction string + Instrument Instrument + LegID int + OrderLegType string + PositionEffect string + Quantity float64 + QuantityType string + type OrderParams struct + From time.Time + MaxResults int + Status string + To time.Time + type Orders []Order + type Period struct + End string + Start string + type PersistentStore interface + GetState func(*http.Request) (string, error) + GetToken func(req *http.Request) (*oauth2.Token, error) + StoreState func(state string, w http.ResponseWriter, req *http.Request) error + StoreToken func(token *oauth2.Token, w http.ResponseWriter, req *http.Request) error + type Preferences struct + AuthTokenTimeout string + DefaultAdvancedToolLaunch string + DefaultEquityOrderDuration string + DefaultEquityOrderLegInstruction string + DefaultEquityOrderMarketSession string + DefaultEquityOrderPriceLinkType string + DefaultEquityOrderType string + DefaultEquityQuantity int + DirectEquityRouting bool + DirectOptionsRouting bool + EquityTaxLotMethod string + ExpressTrading bool + MutualFundTaxLotMethod string + OptionTaxLotMethod string + type PriceHistory struct + Candles []struct{ ... } + Empty bool + Symbol string + type PriceHistoryOptions struct + EndDate time.Time + Frequency int + FrequencyType string + NeedExtendedHoursData *bool + Period int + PeriodType string + StartDate time.Time + type PriceHistoryService struct + func (s *PriceHistoryService) PriceHistory(ctx context.Context, symbol string, opts *PriceHistoryOptions) (*PriceHistory, *Response, error) + type Quote struct + AskID string + AskPrice float64 + AskSize float64 + AssetMainType string + AssetSubType string + AssetType string + BidID string + BidPrice float64 + BidSize float64 + BidTick string + ClosePrice float64 + Cusip string + Delayed bool + Description string + Digits int + DivAmount float64 + DivDate string + DivYield float64 + Exchange string + ExchangeName string + Five2WkHigh float64 + Five2WkLow float64 + HighPrice float64 + LastID string + LastPrice float64 + LastSize float64 + LowPrice float64 + Marginable bool + Mark float64 + MarkChangeInDouble float64 + MarkPercentChangeInDouble float64 + NAV float64 + NetChange float64 + NetPercentChangeInDouble float64 + OpenPrice float64 + PeRatio float64 + QuoteTimeInLong int64 + RegularMarketLastPrice float64 + RegularMarketLastSize int + RegularMarketNetChange float64 + RegularMarketPercentChangeInDouble float64 + RegularMarketTradeTimeInLong int64 + SecurityStatus string + Shortable bool + Symbol string + TotalVolume float64 + TradeTimeInLong int64 + Volatility float64 + type QuoteDelays struct + IsAmexDelayed bool + IsCmeDelayed bool + IsForexDelayed bool + IsIceDelayed bool + IsNasdaqDelayed bool + IsNyseDelayed bool + IsOpraDelayed bool + type Quotes map[string]*Quote + type QuotesService struct + func (s *QuotesService) GetQuotes(ctx context.Context, symbols string) (*Quotes, *Response, error) + type ReplaceWatchlist struct + Name string + WatchlistID string + WatchlistItems []WatchlistItem + type Response struct + type SecuritiesAccount struct + AccountID string + CurrentBalances Balance + InitialBalances Balance + IsClosingOnlyRestricted bool + IsDayTrader bool + OrderStrategies []struct{ ... } + Positions []struct{ ... } + ProjectedBalances Balance + RoundTrips float64 + Type string + type SessionHours struct + PostMarket []Period + PreMarket []Period + RegularMarket []Period + type StoredWatchlist struct + AccountID string + Name string + Status string + WatchlistID string + WatchlistItems []StoredWatchlistItem + type StoredWatchlistInstrument struct + AssetType string + Description string + Symbol string + type StoredWatchlistItem struct + AveragePrice float64 + Commission float64 + Instrument StoredWatchlistInstrument + PurchasedDate string + Quantity float64 + SequenceID int + Status string + type StreamerInfo struct + ACL string + AccessLevel string + AppID string + StreamerBinaryURL string + StreamerSocketURL string + Token string + TokenTimestamp string + UserGroup string + type StreamerSubscriptionKeys struct + Keys []KeyEntry + type Transaction struct + ACHStatus string + AccruedInterest float64 + CashBalanceEffectFlag bool + ClearingReferenceNumber string + DayTradeBuyingPowerEffect float64 + Description string + Fees TransactionFees + NetAmount float64 + OrderDate string + OrderID string + RequirementReallocationAmount float64 + SMA float64 + SettlementDate string + SubAccount string + TransactionDate string + TransactionID int64 + TransactionItem TransactionItem + TransactionSubType string + Type string + type TransactionFees struct + AdditionalFee float64 + CdscFee float64 + Commission float64 + OptRegFee float64 + OtherCharges float64 + RFee float64 + RegFee float64 + SecFee float64 + type TransactionHistoryOptions struct + EndDate string + StartDate string + Symbol string + Type string + type TransactionHistoryService struct + func (s *TransactionHistoryService) GetTransaction(ctx context.Context, accountID string, transactionID string) (*Transaction, *Response, error) + func (s *TransactionHistoryService) GetTransactions(ctx context.Context, accountID string, opts *TransactionHistoryOptions) (*Transactions, *Response, error) + type TransactionInstrument struct + AssetType string + BondInterestRate float64 + BondMaturityDate string + CUSIP string + Description string + OptionExpirationDate string + OptionStrikePrice float64 + PutCall string + Symbol string + UnderlyingSymbol string + type TransactionItem struct + AccountID int32 + Amount float64 + Cost float64 + Instruction string + Instrument TransactionInstrument + ParentChildIndicator string + ParentOrderKey int32 + PositionEffect string + Price float64 + type Transactions []*Transaction + type Underlying struct + Ask float64 + AskSize int + Bid float64 + BidSize int + Change float64 + Close float64 + Delayed bool + Description string + ExchangeName string + FiftyTwoWeekHigh float64 + FiftyTwoWeekLow float64 + HighPrice float64 + Last float64 + LowPrice float64 + Mark float64 + MarkChange float64 + MarkPercentChange float64 + OpenPrice float64 + PercentChange float64 + QuoteTime int + Symbol string + TotalVolume int + TradeTime int + type UpdateWatchlist struct + Name string + WatchlistID string + WatchlistItems []UpdateWatchlistItem + type UpdateWatchlistItem struct + AveragePrice float64 + Commission float64 + Instrument WatchlistInstrument + PurchasedDate string + Quantity float64 + SequenceID int + type UserAccountInfo struct + ACL string + AccountCdDomainID string + AccountID string + Authorizations Authorizations + Company string + Description string + DisplayName string + Preferences Preferences + Segment string + SurrogateIds string + type UserPrincipal struct + AccessLevel string + Accounts []UserAccountInfo + AuthToken string + LastLoginTime string + LoginTime string + PrimaryAccountID string + ProfessionalStatus string + Quotes QuoteDelays + StalePassword bool + StreamerInfo StreamerInfo + StreamerSubscriptionKeys StreamerSubscriptionKeys + TokenExpirationTime string + UserCdDomainID string + UserID string + type UserService struct + func (s *UserService) GetPreferences(ctx context.Context, accountID string) (*Preferences, *Response, error) + func (s *UserService) GetStreamerSubscriptionKeys(ctx context.Context, accountIDs ...string) (*StreamerSubscriptionKeys, *Response, error) + func (s *UserService) GetUserPrincipals(ctx context.Context, fields ...string) (*UserPrincipal, *Response, error) + func (s *UserService) UpdatePreferences(ctx context.Context, accountID string, newPreferences *Preferences) (*Response, error) + type WatchlistInstrument struct + AssetType string + Symbol string + type WatchlistItem struct + AveragePrice float64 + Commission float64 + Instrument WatchlistInstrument + PurchasedDate string + Quantity float64 + type WatchlistService struct + func (s *WatchlistService) CreateWatchlist(ctx context.Context, accountID string, newWatchlist *NewWatchlist) (*Response, error) + func (s *WatchlistService) DeleteWatchlist(ctx context.Context, accountID, watchlistID string) (*Response, error) + func (s *WatchlistService) GetAllWatchlists(ctx context.Context) (*[]StoredWatchlist, *Response, error) + func (s *WatchlistService) GetAllWatchlistsForAccount(ctx context.Context, accountID string) (*[]StoredWatchlist, *Response, error) + func (s *WatchlistService) GetWatchlist(ctx context.Context, accountID, watchlistID string) (*StoredWatchlist, *Response, error) + func (s *WatchlistService) ReplaceWatchlist(ctx context.Context, accountID string, replaceWatchlist *ReplaceWatchlist) (*Response, error) + func (s *WatchlistService) UpdateWatchlist(ctx context.Context, accountID string, updateWatchlist *UpdateWatchlist) (*Response, error)