Versions in this module Expand all Collapse all v1 v1.6.4 Dec 10, 2020 v1.6.3 Dec 9, 2020 Changes in this version + const AccountUpdates + const MaxConnectionAttempts + const TradeUpdates + var DefaultClient = NewClient(common.Credentials()) + func CancelOrder(orderID string) error + func ListBars(symbols []string, opts ListBarParams) (map[string][]Bar, error) + func SetBaseUrl(baseUrl string) + type APIError struct + Code int + Message string + func (e *APIError) Error() string + type Account struct + AccountBlocked bool + AccountNumber string + BuyingPower decimal.Decimal + Cash decimal.Decimal + CashWithdrawable decimal.Decimal + CreatedAt time.Time + Currency string + DaytradeCount int64 + DaytradingBuyingPower decimal.Decimal + DeletedAt *time.Time + Equity decimal.Decimal + ID string + InitialMargin decimal.Decimal + LastEquity decimal.Decimal + LastMaintenanceMargin decimal.Decimal + LongMarketValue decimal.Decimal + MaintenanceMargin decimal.Decimal + Multiplier string + PatternDayTrader bool + PortfolioValue decimal.Decimal + RegTBuyingPower decimal.Decimal + ShortMarketValue decimal.Decimal + ShortingEnabled bool + Status string + TradingBlocked bool + TransfersBlocked bool + UpdatedAt time.Time + func GetAccount() (*Account, error) + type AccountActivitiesRequest struct + ActivityTypes *[]string + After *time.Time + Date *time.Time + Direction *string + PageSize *int + Until *time.Time + type AccountActivity struct + ActivityType string + CumQty decimal.Decimal + Date time.Time + Description string + ID string + LeavesQty decimal.Decimal + NetAmount decimal.Decimal + PerShareAmount decimal.Decimal + Price decimal.Decimal + Qty decimal.Decimal + Side string + Symbol string + TransactionTime time.Time + Type string + func GetAccountActivities(activityType *string, opts *AccountActivitiesRequest) ([]AccountActivity, error) + type AccountConfigurations struct + DtbpCheck DtbpCheck + NoShorting bool + TradeConfirmEmail TradeConfirmEmail + TradeSuspendedByUser bool + func GetAccountConfigurations() (*AccountConfigurations, error) + func UpdateAccountConfigurations(newConfigs AccountConfigurationsRequest) (*AccountConfigurations, error) + type AccountConfigurationsRequest struct + DtbpCheck *string + NoShorting *bool + TradeConfirmEmail *string + TradeSuspendedByUser *bool + type AggV2 struct + Close float32 + High float32 + Low float32 + NumberOfItems int + Open float32 + Ticker string + Timestamp int64 + Volume int32 + type Aggregates struct + Adjusted bool + QueryCount int + Results []AggV2 + ResultsCount int + Status string + Ticker string + func GetAggregates(symbol, timespan, from, to string) (*Aggregates, error) + type Asset struct + Class string + EasyToBorrow bool + Exchange string + ID string + Marginable bool + Name string + Shortable bool + Status string + Symbol string + Tradable bool + func GetAsset(symbol string) (*Asset, error) + func ListAssets(status *string) ([]Asset, error) + type Bar struct + Close float32 + High float32 + Low float32 + Open float32 + Time int64 + Volume int32 + func GetSymbolBars(symbol string, opts ListBarParams) ([]Bar, error) + func (bar *Bar) GetTime() time.Time + type CalendarDay struct + Close string + Date string + Open string + func GetCalendar(start, end *string) ([]CalendarDay, error) + type Client struct + func NewClient(credentials *common.APIKey) *Client + func (c *Client) CancelAllOrders() error + func (c *Client) CancelOrder(orderID string) error + func (c *Client) CloseAllPositions() error + func (c *Client) ClosePosition(symbol string) error + func (c *Client) GetAccount() (*Account, error) + func (c *Client) GetAccountActivities(activityType *string, opts *AccountActivitiesRequest) ([]AccountActivity, error) + func (c *Client) GetAccountConfigurations() (*AccountConfigurations, error) + func (c *Client) GetAggregates(symbol, timespan, from, to string) (*Aggregates, error) + func (c *Client) GetAsset(symbol string) (*Asset, error) + func (c *Client) GetCalendar(start, end *string) ([]CalendarDay, error) + func (c *Client) GetClock() (*Clock, error) + func (c *Client) GetLastQuote(symbol string) (*LastQuoteResponse, error) + func (c *Client) GetLastTrade(symbol string) (*LastTradeResponse, error) + func (c *Client) GetOrder(orderID string) (*Order, error) + func (c *Client) GetPortfolioHistory(period *string, timeframe *RangeFreq, dateEnd *time.Time, extendedHours bool) (*PortfolioHistory, error) + func (c *Client) GetPosition(symbol string) (*Position, error) + func (c *Client) GetSymbolBars(symbol string, opts ListBarParams) ([]Bar, error) + func (c *Client) ListAssets(status *string) ([]Asset, error) + func (c *Client) ListBars(symbols []string, opts ListBarParams) (map[string][]Bar, error) + func (c *Client) ListOrders(status *string, until *time.Time, limit *int, nested *bool) ([]Order, error) + func (c *Client) ListPositions() ([]Position, error) + func (c *Client) PlaceOrder(req PlaceOrderRequest) (*Order, error) + func (c *Client) ReplaceOrder(orderID string, req ReplaceOrderRequest) (*Order, error) + func (c *Client) UpdateAccountConfigurations(newConfigs AccountConfigurationsRequest) (*AccountConfigurations, error) + type ClientMsg struct + Action string + Data interface{} + type Clock struct + IsOpen bool + NextClose time.Time + NextOpen time.Time + Timestamp time.Time + func GetClock() (*Clock, error) + type DtbpCheck string + const Both + const Entry + const Exit + type Fundamental struct + AssetID string + AvgVol int64 + Beta float32 + DivRate float32 + EPS float32 + FiftyTwoWeekHigh decimal.Decimal + FiftyTwoWeekLow decimal.Decimal + FullName string + GrossMargin float32 + IndustryGroup string + IndustryName string + LongDescription string + MarketCap int64 + PC float32 + PEGRatio float32 + PERatio float32 + PS float32 + ROA float32 + ROE float32 + Sector string + SharesOutstanding int64 + ShortDescription string + Symbol string + type LastQuote struct + AskExchange int + AskPrice float32 + AskSize int32 + BidExchange int + BidPrice float32 + BidSize int32 + Timestamp int64 + func (l *LastQuote) Time() time.Time + type LastQuoteResponse struct + Last LastQuote + Status string + Symbol string + func GetLastQuote(symbol string) (*LastQuoteResponse, error) + type LastTrade struct + Cond1 int + Cond2 int + Cond3 int + Cond4 int + Exchange int + Price float32 + Size int32 + Timestamp int64 + func (l *LastTrade) Time() time.Time + type LastTradeResponse struct + Last LastTrade + Status string + Symbol string + func GetLastTrade(symbol string) (*LastTradeResponse, error) + type ListBarParams struct + EndDt *time.Time + Limit *int + StartDt *time.Time + Timeframe string + type Order struct + AssetID string + CanceledAt *time.Time + Class string + ClientOrderID string + CreatedAt time.Time + Exchange string + ExpiredAt *time.Time + ExtendedHours bool + FailedAt *time.Time + FilledAt *time.Time + FilledAvgPrice *decimal.Decimal + FilledQty decimal.Decimal + Hwm *decimal.Decimal + ID string + Legs *[]Order + LimitPrice *decimal.Decimal + Qty decimal.Decimal + ReplacedAt *time.Time + Replaces *string + Side Side + Status string + StopPrice *decimal.Decimal + SubmittedAt time.Time + Symbol string + TimeInForce TimeInForce + TrailPercent *decimal.Decimal + TrailPrice *decimal.Decimal + Type OrderType + UpdatedAt time.Time + func GetOrder(orderID string) (*Order, error) + func ListOrders(status *string, until *time.Time, limit *int, nested *bool) ([]Order, error) + func PlaceOrder(req PlaceOrderRequest) (*Order, error) + func ReplaceOrder(orderID string, req ReplaceOrderRequest) (*Order, error) + type OrderAttributes struct + StopLossLimitPrice *decimal.Decimal + StopLossStopPrice *decimal.Decimal + TakeProfitLimitPrice *decimal.Decimal + type OrderClass string + const Bracket + const Oco + const Oto + const Simple + type OrderType string + const Limit + const Market + const Stop + const StopLimit + const TrailingStop + type PlaceOrderRequest struct + AccountID string + AssetKey *string + ClientOrderID string + LimitPrice *decimal.Decimal + OrderClass OrderClass + Qty decimal.Decimal + Side Side + StopLoss *StopLoss + StopPrice *decimal.Decimal + TakeProfit *TakeProfit + TimeInForce TimeInForce + TrailPercent *decimal.Decimal + TrailPrice *decimal.Decimal + Type OrderType + type PortfolioHistory struct + BaseValue decimal.Decimal + Equity []decimal.Decimal + ProfitLoss []decimal.Decimal + ProfitLossPct []decimal.Decimal + Timeframe RangeFreq + Timestamp []int64 + func GetPortfolioHistory(period *string, timeframe *RangeFreq, dateEnd *time.Time, extendedHours bool) (*PortfolioHistory, error) + type Position struct + AccountID string + AssetID string + ChangeToday decimal.Decimal + Class string + CostBasis decimal.Decimal + CurrentPrice decimal.Decimal + EntryPrice decimal.Decimal + Exchange string + LastdayPrice decimal.Decimal + MarketValue decimal.Decimal + Qty decimal.Decimal + Side string + Symbol string + UnrealizedPL decimal.Decimal + UnrealizedPLPC decimal.Decimal + func GetPosition(symbol string) (*Position, error) + func ListPositions() ([]Position, error) + type RangeFreq string + const Day1 + const Hour1 + const Min1 + const Min15 + const Min5 + type ReplaceOrderRequest struct + ClientOrderID string + LimitPrice *decimal.Decimal + Qty *decimal.Decimal + StopPrice *decimal.Decimal + TimeInForce TimeInForce + Trail *decimal.Decimal + type ServerMsg struct + Data interface{} + Stream string + type Side string + const Buy + const Sell + type StopLoss struct + LimitPrice *decimal.Decimal + StopPrice *decimal.Decimal + type Stream struct + func GetDataStream() *Stream + func GetStream() *Stream + func (s *Stream) Close() error + func (s *Stream) Subscribe(channel string, handler func(msg interface{})) (err error) + func (s *Stream) Unsubscribe(channel string) (err error) + type StreamAgg struct + AccumulatedVolume int32 + Close float32 + End int64 + Event string + High float32 + Low float32 + Open float32 + OpenPrice float32 + Start int64 + Symbol string + VWAP float32 + Volume int32 + func (s *StreamAgg) Time() time.Time + type StreamQuote struct + AskExchange int + AskPrice float32 + AskSize int32 + BidExchange int + BidPrice float32 + BidSize int32 + Event string + Symbol string + Timestamp int64 + func (s *StreamQuote) Time() time.Time + type StreamTrade struct + Conditions []int + Event string + Exchange int + Price float32 + Size int32 + Symbol string + TapeID int + Timestamp int64 + TradeID string + func (s *StreamTrade) Time() time.Time + type TakeProfit struct + LimitPrice *decimal.Decimal + type TimeInForce string + const CLS + const Day + const FOK + const GTC + const GTD + const GTX + const IOC + const OPG + type TradeConfirmEmail string + const All + const None + type TradeUpdate struct + Event string + Order Order