Documentation ¶
Overview ¶
Package robinhood is a client of Robinhood's trading and screening API.
Index ¶
- type Account
- type Chain
- type Client
- func (c *Client) Chains(symbol string, expiration time.Time) ([]Chain, error)
- func (c *Client) EnsureBearerToken() error
- func (c *Client) Expirations(symbol string) ([]time.Time, error)
- func (c *Client) GetAccounts() ([]Account, error)
- func (c *Client) GetBearerToken() error
- func (c *Client) GetToken() error
- func (c *Client) Option(chain Chain) (Option, error)
- func (c *Client) Order(o Order) error
- func (c *Client) Portfolio() ([]Position, error)
- func (c *Client) Quote(symbol []string) ([]Quote, error)
- type Duration
- type Instrument
- type Option
- type Order
- type OrderType
- type Position
- type Quote
- type Side
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chain ¶
type Chain struct { Strike float64 Expiration time.Time Symbol string Type string // "put" or "call". TODO: use an enum? // contains filtered or unexported fields }
Chain represents a complete option with strike price, expiration, type (put/call) and an underlying symbol.
type Client ¶
type Client struct { // AccountID is the account number this client will use. It is required for // all operations that operate directly on a user's account, such as calls to // get the portfolio and entering and cancelling orders. AccountID string // Token is the access token used for authentication. If it's not present, // then Username and Password must be present. Token string // Username is the user's username with Robinhood. It may be blank if the // client has a Token already. Username string // Password is the user's password. It may be blank if the client has a Token // already. Password string // BearerToken is present when a call to GetBearerToken is successful. It is // only necessary for real-time quotes. BearerToken string // BearerTokenExpiration is the wall clock time that the bearer token expires. BearerTokenExpiration time.Time // contains filtered or unexported fields }
Client is the Robinhood API client. It supports a single account. For users with multiple accounts, create a new Client for each account.
func (*Client) Chains ¶
Chains returns all chains (i.e. a complete option with strike price) for an option on the underlying symbol and an expiration date.
func (*Client) EnsureBearerToken ¶
EnsureBearerToken ensures the client has a bearer token with at least another 30 seconds of time to live.
func (*Client) Expirations ¶
Expirations returns all expiration dates for options for the underlying symbol.
func (*Client) GetAccounts ¶
GetAccounts returns the list of all account numbers associated with a user. Client must be authenticated (i.e. a Token must be supplied).
func (*Client) GetBearerToken ¶
GetBearerToken fetches the bearer token and stores it implicitly.
func (*Client) GetToken ¶
GetToken gets a new token, based on this client's Username and Password. It implicitly saves the new token.
type Instrument ¶
type Instrument string
Instrument represents a Robinhood resource.
func (Instrument) GetID ¶
func (i Instrument) GetID() string
GetID returns the ID part of the Instrument.
type Option ¶
type Option struct { Symbol string // the underlying symbol. Strike float64 Expiration time.Time Type string // "put" or "call". TODO: use an enum? Bid float64 Ask float64 Last float64 MarketPrice float64 // Close to midpoint, but not quite. Volume int64 IV float64 // contains filtered or unexported fields }
Option represents a real-time quote for an option.
type Order ¶
type Order struct { Symbol string Quantity int64 Duration Duration Type OrderType Side Side Price float64 StopPrice float64 // only present for STOP or STOP_LIMIT orders. }
Order describes a buy or sell order.
type OrderType ¶
type OrderType int
OrderType describes whether the order is market, stop, limit, etc.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
chains
chains returns option chains of a given underlying symbol and expiration.
|
chains returns option chains of a given underlying symbol and expiration. |
expirations
expirations returns all expirations for options of a given underlying symbol.
|
expirations returns all expirations for options of a given underlying symbol. |
get_token
get_token is a simple utility to get a user's token, given their username and password.
|
get_token is a simple utility to get a user's token, given their username and password. |
options
options returns live quota for the specified option.
|
options returns live quota for the specified option. |
portfolio
portfolio retrieves the user's portfolio.
|
portfolio retrieves the user's portfolio. |
quotes
quotes retrieves quotes from the Robinhood API for a given symbol(s).
|
quotes retrieves quotes from the Robinhood API for a given symbol(s). |