Documentation
¶
Index ¶
- Constants
- Variables
- type Account
- type BrokerageServerPluginLatest
- type BrokerageServerPluginV1
- type ConnectionStatus
- type DebugLevel
- type ErrorWithCode
- type Execution
- type HistoricalDataParams
- type HistoricalDataType
- type Option
- type OptionChain
- type OptionCombo
- type OptionQuote
- type OptionsQuoteParams
- type Position
- type PutOrCall
- type Quote
- type SymbolDetails
- type SymbolType
- type Trade
- type Tristate
- type VendorSpecific
Constants ¶
View Source
const ( DEBUG_OFF DebugLevel = 0 DEBUG_NORMAL = 1 DEBUG_VERBOSE = 2 DEBUG_TRACE = 3 )
View Source
const ( NonOption PutOrCall = "" Put = "PUT" Call = "CALL" )
Variables ¶
View Source
var ( ErrSymbolNotFound = ErrorWithCode{errors.New("symbol not found"), http.StatusNotFound} ErrDisconnected = errors.New("broker disconnected") )
View Source
var ERR_PLUGIN_NOT_IMPLEMENTED = errors.New("Not implemented for this broker")
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { ID string `json:"id"` Broker string `json:"broker"` Type string `json:"type"` NetLiquidation string `json:"net_liquidation"` BuyingPower string `json:"buying_power"` MarginReq string `json:"margin_req"` AvailableFunds string `json:"available_funds"` RealizedPnL string `json:"realized_pnl"` UnrealizedPnL string `json:"unrealized_pnl"` }
type BrokerageServerPluginLatest ¶
type BrokerageServerPluginLatest = BrokerageServerPluginV1
type BrokerageServerPluginV1 ¶
type BrokerageServerPluginV1 interface { Connect() error Close() error Status() *ConnectionStatus Error() error SetDebugLevel(level DebugLevel) AccountList(ctx context.Context) ([]*Account, error) GetStockQuote(ctx context.Context, symbol string) (*Quote, error) GetOptionsChain(ctx context.Context, symbol string) (OptionChain, error) GetOptionsQuotes(ctx context.Context, params OptionsQuoteParams) ([]*OptionQuote, error) GetHistoricalData(ctx context.Context, params HistoricalDataParams) ([]*Quote, error) GetPositions(ctx context.Context) ([]*Position, error) GetTrades(ctx context.Context, startDate time.Time) ([]*Trade, error) }
type ConnectionStatus ¶
type DebugLevel ¶
type DebugLevel int
type ErrorWithCode ¶
type ErrorWithCode struct {
// contains filtered or unexported fields
}
func ArgError ¶
func ArgError(message string) ErrorWithCode
func (ErrorWithCode) Code ¶
func (ec ErrorWithCode) Code() int
type Execution ¶
type Execution struct { ExecutionId string `json:"id"` OptionType string `json:"type,omitempty"` Strike float64 `json:"strike,omitempty"` Expiration string `json:"expiration,omitempty"` Multiplier int `json:"multiplier,omitempty"` Exchange string `json:"exchange"` Size int `json:"size"` Price float64 `json:"price"` Commissions float64 `json:"commissions"` RealizedPnL float64 `json:"realized_pnl,omitempty"` Time time.Time `json:"time"` RawData interface{} `json:"raw_data,omitempty"` }
type HistoricalDataParams ¶
type HistoricalDataType ¶
type HistoricalDataType int
const ( HistoricalDataTypePrice HistoricalDataType = iota HistoricalDataTypeIv HistoricalDataTypeHv )
type OptionChain ¶
type OptionCombo ¶
type OptionCombo struct {
Legs []Option
}
type OptionQuote ¶
type OptionQuote struct { Quote Strike float64 `json:"strike"` Underlying string `json:"underlying"` Expiration string `json:"expiration"` Type PutOrCall `json:"type"` MinPriceDelta float64 `json:"min_price_delta"` FullSymbol string `json:"full_symbol"` // The full symbol for the option OpenInterest int64 `json:"open_interest"` ModelPrice float64 `json:"model_price"` Delta float64 `json:"delta"` Gamma float64 `json:"gamma"` Theta float64 `json:"theta"` Vega float64 `json:"vega"` Rho float64 `json:"rho"` // Not always supported }
type OptionsQuoteParams ¶
type Position ¶
type Position struct { Symbol string `json:"symbol"` Strike float64 `json:"strike,omitempty"` Multiplier string `json:"multiplier,omitempty"` Expiration string `json:"expiration,omitempty"` PutOrCall PutOrCall `json:"option_type,omitempty"` Position int `json:"position"` MarketPrice float64 `json:"mkt_price"` MarketValue float64 `json:"mkt_value"` AvgPrice float64 `json:"avg_price"` UnrealizedPnL float64 `json:"unrealized_pnl"` RealizedPnL float64 `json:"realized_pnl"` RawData interface{} `json:"raw,omitempty"` Broker string `json:"broker"` Account string `json:"account"` }
type Quote ¶
type Quote struct { High float64 `json:"high,omitempty"` Low float64 `json:"low,omitempty"` Open float64 `json:"open,omitempty"` Close float64 `json:"close,omitempty"` Mark float64 `json:"mark,omitempty"` Volume int64 `json:"volume,omitempty"` Bid float64 `json:"bid,omitempty"` BidSize int64 `json:"bid_size,omitempty"` BidExch string `json:"bid_exch,omitempty"` Ask float64 `json:"ask,omitempty"` AskSize int64 `json:"ask_size,omitempty"` AskExch string `json:"ask_exch,omitempty"` LastTime *time.Time `json:"last_time,omitempty"` Last float64 `json:"last,omitempty"` LastSize int64 `json:"last_size,omitempty"` LastExch string `json:"last_exch,omitempty"` OptionHistoricalVolatility float64 `json:"option_hv,omitempty"` OptionImpliedVolatility float64 `json:"option_iv,omitempty"` OptionCallOpenInt int64 `json:"option_call_open_int,omitempty"` OptionCallVolume int64 `json:"option_call_vol,omitempty"` OptionPutOpenInt int64 `json:"option_put_open_int,omitempty"` OptionPutVolume int64 `json:"option_put_vol,omitempty"` AvgVol float64 `json:"avg_vol,omitempty"` // Not supported by all brokers Time time.Time `json:"time,omitempty"` Incomplete bool `json:"incomplete,omitempty"` }
type SymbolDetails ¶
type SymbolDetails struct { Symbol string Description string Vendor VendorSpecific }
type Trade ¶
type Trade struct { Account string `json:"account"` Broker string `json:"broker"` OrderId string `json:"id"` Symbol string `json:"symbol"` Size int `json:"size"` Price float64 `json:"price"` Executions []*Execution `json:"executions"` Time time.Time `json:"time"` RawData interface{} `json:"raw_data,omitempty"` }
type VendorSpecific ¶
type VendorSpecific struct { Data map[string]string `json:"data"` // Keys defines a preferred order to print the keys. Keys []string `json:"keys"` }
VendorSpecific holds information that isn't common to the supported platforms, and isn't vital, but might be interesting to use when it's present.
Click to show internal directories.
Click to hide internal directories.