Documentation ¶
Index ¶
- Constants
- Variables
- func MyTradierProductionPosition()
- func MyTradierSandboxPosition()
- func MyTradier_Market()
- func MyTradier_Stream()
- func OpenStreamSocket(id string)
- func ParseTimeMs(tsMs string) (time.Time, error)
- func Redis_Subscribe()
- type Client
- type ClientParams
- type DateTime
- type Filter
- type FloatOrNaN
- type Interval
- type MarketCalendar
- type MarketState
- type MarketStatus
- type Position
- type Quote
- type Security
- type SecurityType
- type Stream
- type TimeSale
- type TradierError
Constants ¶
View Source
const ( // fasthhtp Maximum number of connections per each host which may be established. MaxConnsPerHost = 100 // fasthhtp Maximum number of attempts for idempotent calls MaxIdemponentCallAttempts = 10 // Error returned by Tradier if we make too big of a request. ErrBodyBufferOverflow = "protocol.http.TooBigBody" )
View Source
const ( SandboxEndpoint = "https://sandbox.tradier.com" APIEndpoint = "https://api.tradier.com" StreamEndpoint = "https://stream.tradier.com" )
Variables ¶
View Source
var ( // ErrNoAccountSelected is returned if account-specific methods // are attempted to be used without selecting an account first. ErrNoAccountSelected = errors.New("no account selected") )
Functions ¶
func MyTradierProductionPosition ¶
func MyTradierProductionPosition()
func MyTradierSandboxPosition ¶
func MyTradierSandboxPosition()
func MyTradier_Market ¶
func MyTradier_Market()
func MyTradier_Stream ¶
func MyTradier_Stream()
func OpenStreamSocket ¶
func OpenStreamSocket(id string)
func Redis_Subscribe ¶
func Redis_Subscribe()
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides methods for making requests to the Tradier API.
func NewClient ¶
func NewClient(params ClientParams) *Client
func (*Client) GetAccountPositions ¶
Get the current account Positions
func (*Client) GetMarketState ¶
func (tc *Client) GetMarketState() (MarketStatus, error)
Get the current state of the market (open/closed/etc.)
func (*Client) GetSessionID ¶
func (*Client) SelectAccount ¶
type ClientParams ¶
type ClientParams struct { Endpoint string AuthToken string Client *fasthttp.Client RetryLimit int Account string }
func DefaultParams ¶
func DefaultParams(authToken string) ClientParams
DefaultParams returns ClientParams initialized with default values.
type DateTime ¶
DateTime wraps time.Time and adds flexible implementations for unmarshaling JSON in the different forms it appears in the Tradier API.
func (*DateTime) UnmarshalJSON ¶
type FloatOrNaN ¶
type FloatOrNaN float64
func (*FloatOrNaN) UnmarshalJSON ¶
func (f *FloatOrNaN) UnmarshalJSON(data []byte) error
type MarketCalendar ¶
type MarketState ¶
type MarketState string
const ( MarketPremarket MarketState = "premarket" MarketOpen MarketState = "open" MarketPostmarket MarketState = "postmarket" MarketClosed MarketState = "closed" )
type MarketStatus ¶
type Quote ¶
type Quote struct { Symbol string Description string Exchange string `json:"exch"` Type string Change float64 ChangePercentage float64 `json:"change_percentage"` Volume int AverageVolume int Last float64 LastVolume int TradeDate DateTime `json:"trade_date"` Open float64 High float64 Low float64 Close float64 PreviousClose float64 `json:"prevclose"` Week52High float64 `json:"week_52_high"` Week52Low float64 `json:"week_52_low"` Bid float64 BidSize int BidExchange string `json:"bidexch"` BidDate DateTime `json:"bid_date"` Ask float64 AskSize int AskExchange string `json:"askexch"` AskDate DateTime `json:"ask_date"` OpenInterest float64 `json:"open_interest"` Underlying string Strike float64 ContractSize int ExpirationDate DateTime `json:"expiration_date"` ExpirationType string `json:"expiration_type"` OptionType string `json:"option_type"` RootSymbol string `json:"root_symbol"` }
type SecurityType ¶
type SecurityType string
const ( SecurityTypeStock SecurityType = "stock" SecurityTypeIndex SecurityType = "index" SecurityTypeETF SecurityType = "etf" SecurityTypeMutualFund SecurityType = "mutual_fund" )
type TimeSale ¶
type TimeSale struct { Date DateTime Time DateTime Timestamp int64 Open FloatOrNaN Close FloatOrNaN High FloatOrNaN Low FloatOrNaN Price FloatOrNaN Vwap FloatOrNaN Volume int64 }
type TradierError ¶
type TradierError struct { Fault struct { FaultString string Detail struct { ErrorCode string } } HttpStatusCode int Message string }
func (TradierError) Error ¶
func (te TradierError) Error() string
Click to show internal directories.
Click to hide internal directories.