Documentation ¶
Index ¶
- func ApiKey() string
- func DecryptAES(ct string) string
- func EncryptAES(plaintext string) string
- func Secret() string
- type API
- type Account
- func (account *Account) ConfirmGroupOrder(orders []*OrderRequest) ([]*OrderConfirm, error)
- func (account *Account) ConfirmOrder(order *OrderRequest) (*OrderConfirm, error)
- func (account *Account) GetBalances() (*Balance, error)
- func (account *Account) GetBalancesBOD() (*Balance, error)
- func (account *Account) GetHistoricalOrders(since time.Time) ([]*Order, error)
- func (account *Account) GetOrders() ([]*Order, error)
- func (account *Account) GetPositions() ([]*Position, error)
- func (account *Account) PlaceGroupOrder(orders []*OrderRequest) ([]*Order, error)
- func (account *Account) PlaceOrder(order *OrderRequest) (*Order, error)
- type Action
- type Balance
- type LinkedOrder
- type MarketFlags
- type MarketRule
- type MarketRulePredicate
- type MarketRuleTrigger
- type MarketRuleType
- type OAuthToken
- type Order
- type OrderConfirm
- type OrderLeg
- type OrderRequest
- type OrderStatus
- type Position
- type Quote
- type TSOrderType
- type TimeInForceDuration
- type TimeRule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecryptAES ¶
func EncryptAES ¶
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
func (*API) CheckAuth ¶
func (api *API) CheckAuth()
CheckAuth checks if there is a token that is not expired available
func (*API) GetAccounts ¶
type Account ¶
type Account struct { AccountID string Alias string Currency string Status string AccountType string // contains filtered or unexported fields }
func (*Account) ConfirmGroupOrder ¶
func (account *Account) ConfirmGroupOrder(orders []*OrderRequest) ([]*OrderConfirm, error)
ConfirmGroupOrder returns estimated cost and commission information for a group of orders without the orders actually being placed. Request valid for Market, Limit, Stop Market, Stop Limit, Options, and Order Sends Order (OSO) order types.
func (*Account) ConfirmOrder ¶
func (account *Account) ConfirmOrder(order *OrderRequest) (*OrderConfirm, error)
ConfirmOrder returns estimated cost and commission information for an order without the order actually being placed. Request valid for Market, Limit, Stop Market, Stop Limit, Options, and Order Sends Order (OSO) order types.
func (*Account) GetBalances ¶
func (*Account) GetBalancesBOD ¶
func (*Account) GetHistoricalOrders ¶
GetHistoricalOrders retrieves historical orders from tradestation
since is the earliest date to retrieve orders for
func (*Account) GetPositions ¶
func (*Account) PlaceGroupOrder ¶
func (account *Account) PlaceGroupOrder(orders []*OrderRequest) ([]*Order, error)
Creates a new brokerage order. Request valid for all account types. Request valid for Market, Limit, Stop Market, Stop Limit, Options and Order Sends Order (OSO) order types.
func (*Account) PlaceOrder ¶
func (account *Account) PlaceOrder(order *OrderRequest) (*Order, error)
Creates a new brokerage order. Request valid for all account types. Request valid for Market, Limit, Stop Market, Stop Limit, Options and Order Sends Order (OSO) order types.
type Balance ¶
type Balance struct { AccountID string AccountType string BuyingPower float64 CashBalance float64 Commission float64 CostOfPositions float64 DayTrades float64 Equity float64 MaintenanceRate float64 MarketValue float64 OvernightBuyingPower float64 TodaysProfitLoss float64 RealizedProfitLoss float64 RequiredMargin float64 UnclearedDeposit float64 UnrealizedProfitLoss float64 }
type LinkedOrder ¶
type MarketFlags ¶
type MarketRule ¶
type MarketRule struct { RuleType MarketRuleType Symbol string Predicate MarketRulePredicate TriggerKey MarketRuleTrigger Price float64 }
type MarketRulePredicate ¶
type MarketRulePredicate string
const ( LT MarketRulePredicate = "Lt" LTE MarketRulePredicate = "Lte" GT MarketRulePredicate = "Gt" GTE MarketRulePredicate = "Gte" )
type MarketRuleTrigger ¶
type MarketRuleTrigger string
const ( SINGLE_TRADE_TICK MarketRuleTrigger = "STT" // One trade tick must print within your stop price to trigger your stop. SINGLE_TRADE_TICK_NBBO MarketRuleTrigger = "STTN" // One trade tick within the National Best Bid or Offer must print within your stop price to trigger your stop. SINGLE_BIDASK_TICK MarketRuleTrigger = "SBA" // Buy/Cover Orders: One Ask tick must print within your stop price to trigger your stop. Sell/Short Orders: One Bid tick must print within your stop price to trigger your stop. SINGLE_ASKBID_TICK MarketRuleTrigger = "SAB" // Buy/Cover Orders: One Bid tick must print within your stop price to trigger your stop. Sell/Short Orders: One Ask tick must print within your stop price to trigger your stop. DOUBLE_TRADE_TICK MarketRuleTrigger = "DTT" // Two consecutive trade ticks must print within your stop price to trigger your stop. DOUBLE_TRADE_TICK_NBBO MarketRuleTrigger = "DTTN" // Two consecutive trade ticks within the National Best Bid or Offer must print within your stop price to trigger your stop. DOUBLE_BIDASK_TICK MarketRuleTrigger = "DBA" // Buy/Cover Orders: Two consecutive Ask ticks must print within your stop price to trigger your stop. Sell/Short Orders: Two consecutive Bid ticks must print within your stop price to trigger your stop. DOUBLE_ASKBID_TICK MarketRuleTrigger = "DAB" // Buy/Cover Orders: Two consecutive Bid ticks must print within your stop price to trigger your stop. Sell/Short Orders: Two consecutive Ask ticks must print within your stop price to trigger your stop. TWICE_TRADE_TICK MarketRuleTrigger = "TTT" // Two trade ticks must print within your stop price to trigger your stop. TWICE_TRADE_TICK_NBBO MarketRuleTrigger = "TTTN" // Two trade ticks within the National Best Bid or Offer must print within your stop price to trigger your stop. TWICE_BIDASK_TICK MarketRuleTrigger = "TBA" // Buy/Cover Orders: Two Ask ticks must print within your stop price to trigger your stop. Sell/Short Orders: Two Bid ticks must print within your stop price to trigger your stop. TWICE_ASKBID_TICK MarketRuleTrigger = "TAB" // Buy/Cover Orders: Two Bid ticks must print within your stop price to trigger your stop. Sell/Short Orders: Two Ask ticks must print within your stop price to trigger your stop. )
type OAuthToken ¶
type Order ¶
type Order struct { AccountID string AdvancedOptions string ClosedDateTime time.Time CommissionFee float64 ConditionalOrders []*LinkedOrder Duration string FilledPrice float64 GoodTillDate time.Time GroupName string Legs []*OrderLeg MarketActivationRules []*MarketRule OrderID string OpenedDateTime time.Time OrderType string PriceUsedForBuyingPower float64 RejectReason string Routing string Status OrderStatus StatusDescription string TimeActivationRules []*TimeRule UnbundledRouteFee float64 }
type OrderConfirm ¶
type OrderConfirm struct { AccountCurrency string AccountID string BaseCurrency string CounterCurrency string Currency string DebitCreditEstimatedCost float64 EstimatedCommission float64 EstimatedCost float64 EstimatedPrice float64 InitialMarginDisplay string ExpirationDate time.Time Quantity int64 Symbol string TradeAction Action LimitPrice float64 OrderAssetCategory string OrderConfirmID string ProductCurrency string Route string StopPrice float64 SummaryMessage string TimeInForceDur TimeInForceDuration TimeInForceExpiration time.Time }
type OrderRequest ¶
type OrderRequest struct { AccountID string LimitPrice float64 OrderConfirmID string OrderType TSOrderType Quantity int64 StopPrice float64 Symbol string TimeInForceDur TimeInForceDuration TradeAction Action }
type OrderStatus ¶
type OrderStatus string
const ( RECEIVED OrderStatus = "ACK" BROKEN OrderStatus = "BRO" CANCELED OrderStatus = "CAN" EXPIRED OrderStatus = "EXP" FILLED OrderStatus = "FLL" PARTIAL_FILL OrderStatus = "FLP" PARTIAL_FILL_ALIVE OrderStatus = "FPR" TOO_LATE_TO_CANCEL OrderStatus = "LAT" OPEN OrderStatus = "OPN" OUT OrderStatus = "OUT" REJECTED OrderStatus = "REJ" REPLACED OrderStatus = "UCH" CANCEL_SENT OrderStatus = "UCN" TRADE_SERVER_CANCELED OrderStatus = "TSC" CANCEL_REJECTED OrderStatus = "RJC" QUEUED OrderStatus = "DON" REPLACE_SENT OrderStatus = "RSN" CONDITION_MET OrderStatus = "CND" OSO_ORDER OrderStatus = "OSO" SUSPENDED OrderStatus = "SUS" )
type Position ¶
type Position struct { AccountID string AveragePrice float64 AssetType string Last float64 Bid float64 Ask float64 PositionID string LongShort string Quantity int64 Symbol string Timestamp time.Time TodaysProfitLoss float64 TotalCost float64 MarketValue float64 MarkToMarketPrice float64 UnrealizedProfitLoss float64 UnrealizedProfitLossPercent float64 UnrealizedProfitLossQty float64 }
type Quote ¶
type Quote struct { Ask float64 AskSize int64 Bid float64 BidSize int64 Close float64 High float64 Low float64 High52Week float64 High52WeekTimestamp time.Time Last float64 MinPrice float64 MaxPrice float64 FirstNoticeDate time.Time LastTradingDate time.Time Low52Week float64 Low52WeekTimestamp time.Time Flags *MarketFlags NetChange float64 NetChangePct float64 Open float64 PreviousClose float64 PreviousVolume int64 Restrictions []string Symbol string TickSizeTier int64 TradeTime time.Time Volume int64 LastSize int64 LastVenue string VWAP float64 }
type TSOrderType ¶
type TSOrderType string
const ( LIMIT TSOrderType = "Limit" STOP TSOrderType = "StopMarket" MARKET TSOrderType = "Market" STOP_LIMIT TSOrderType = "StopLimit" )
type TimeInForceDuration ¶
type TimeInForceDuration string
const ( DAY TimeInForceDuration = "DAY" DAY_PLUS TimeInForceDuration = "DYP" GOOD_TILL_CANCELLED TimeInForceDuration = "GTC" GOOD_TILL_CANCELLED_PLUS TimeInForceDuration = "GCP" GOOD_THROUGH_DATE TimeInForceDuration = "GDP" ON_OPEN TimeInForceDuration = "OPG" ON_CLOSE TimeInForceDuration = "CLO" IMMEDIATE TimeInForceDuration = "IOC" FILL_OR_KILL TimeInForceDuration = "FOK" ONE_MIN TimeInForceDuration = "1" THREE_MIN TimeInForceDuration = "3" FIVE_MIN TimeInForceDuration = "5" )