Documentation ¶
Overview ¶
Package tdapi supports an interface to the TDAmeritrade API.
Package tdapi supports an interface to the TDAmeritrade API.
Index ¶
- Variables
- type Session
- func (s *Session) AddOptionToStrategy(opt *option.Option, strategy eventFactory.StrategyType) ([]string, error)
- func (s *Session) AddStockOptionsToStream(stock *asset.Stock) error
- func (s *Session) CancelOrder(orderids []string) error
- func (s *Session) DeregisterOptionUpdateChan(id string)
- func (s *Session) DeregisterOrderUpdateChan(id string)
- func (s *Session) DeregisterPortfolioUpdateChan(id string)
- func (s *Session) Login(loginid string, pass string) error
- func (s *Session) Logout() error
- func (s *Session) RegisterOptionUpdateChan(id string) chan *option.Option
- func (s *Session) RegisterOrderUpdateChan(id string) chan *ordermessage.Message
- func (s *Session) RegisterPortfolioUpdateChan(id string) chan *portfolio.Portfolio
- func (s *Session) RemoveOptionFromStrategy(opt *option.Option, strategy eventFactory.StrategyType) ([]string, error)
- func (s *Session) RemoveStockOptionsFromStream(stock *asset.Stock) error
- func (s *Session) RetrieveImpliedVolatilityHistory(stockSymbol string, stock *asset.Stock) error
- func (s *Session) RetrieveOrderBook(accountid string, ob *orderbook.OrderBook) error
- func (s *Session) RetrievePortfolio(portfolioParam *portfolio.Portfolio) error
- func (s *Session) RetrievePriceHistory(stockSymbol string, stock *asset.Stock) error
- func (s *Session) RetrieveSnapshot(symbol string, assetType asset.AssetType, security interface{}) error
- func (s *Session) RetrieveWatchlists(wls *watchlists.Watchlists) error
- func (s *Session) SendSingleLegOptionTrade(order *order.Order) error
Constants ¶
This section is empty.
Variables ¶
var ErrOrderValidation = errors.New("Validating order failed")
ErrOrderValidation represents an error when validation of order structure fails brokerage rules.
Functions ¶
This section is empty.
Types ¶
type Session ¶
type Session struct { sync.RWMutex //RW mutex on the whole structure for next 3 sets of data. Any API call will need to lock and unlock at this level // contains filtered or unexported fields }
Session represents a TD Ameritrade session, which keeps track of various internal state information and caches. Current Spec: User can only stream 1 optionchain at a time, and stream the *tracked* options (from various underlyings)
func (*Session) AddOptionToStrategy ¶
func (s *Session) AddOptionToStrategy(opt *option.Option, strategy eventFactory.StrategyType) ([]string, error)
AddOptionToStrategy adds a strategy to an option
func (*Session) AddStockOptionsToStream ¶
AddStockOptionsToStream streams the stockSymbol and it's corresponding options. Currently only supporting OTM option only, FUTURE to make that configurable
func (*Session) CancelOrder ¶
CancelOrder cancels an order that has been accepted by the broker. Note currently it only cancels the first order in orderids
func (*Session) DeregisterOptionUpdateChan ¶
func (*Session) DeregisterOrderUpdateChan ¶
func (*Session) DeregisterPortfolioUpdateChan ¶
func (*Session) Login ¶
Login logs the user into the broker Post condition: Sets source id for the session, which is used as a param for other method calls
func (*Session) RegisterOptionUpdateChan ¶
func (*Session) RegisterOrderUpdateChan ¶
func (s *Session) RegisterOrderUpdateChan(id string) chan *ordermessage.Message
func (*Session) RegisterPortfolioUpdateChan ¶
func (*Session) RemoveOptionFromStrategy ¶
func (s *Session) RemoveOptionFromStrategy(opt *option.Option, strategy eventFactory.StrategyType) ([]string, error)
RemoveOptionFromStrategy sets the strategy back to null
func (*Session) RemoveStockOptionsFromStream ¶
RemoveStockOptionsFromStream streams the stockSymbol and it's corresponding options. Currently only supporting OTM option only, FUTURE to make that configurable
func (*Session) RetrieveImpliedVolatilityHistory ¶
func (*Session) RetrieveOrderBook ¶
RetrieveOrderBook retrieves the orders from the brokerage firm in an asynchronous method (even though the function call is syncronous)
func (*Session) RetrievePortfolio ¶
RetrievePortfolio requests the broker for the Portfolio information
func (*Session) RetrievePriceHistory ¶
func (*Session) RetrieveSnapshot ¶
func (s *Session) RetrieveSnapshot(symbol string, assetType asset.AssetType, security interface{}) error
RetrieveSnapshot requests the broker for symbol, and is only a single value (for now... in future if needed, expand to mulitple)
func (*Session) RetrieveWatchlists ¶
func (s *Session) RetrieveWatchlists(wls *watchlists.Watchlists) error
RetrieveWatchlists retrieves a watchlist from td