brokerage_server_ib

package module
v0.0.0-...-694f6c4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2017 License: Apache-2.0 Imports: 17 Imported by: 1

README

brokerage_server_ib

Interactive Brokers plugin for brokerage_server

Documentation

Index

Constants

View Source
const (
	IBErrNoDataReturned             = 162
	IBErrSymbolNotFound             = 200
	IBErrMarketDataConnectionOk     = 2104
	IBErrHistoricalDataConnectionOk = 2106
)
View Source
const (
	REPLY_CONTINUE replyBehavior = iota
	REPLY_DONE
)
View Source
const (
	DEFAULT_GATEWAY      = "localhost:7497"
	MAX_SENDS_PER_SECOND = 50
	BrokerName           = "ib"
)

Variables

View Source
var (
	// This should never happen since we don't burst messages.
	ErrWayTooFast       = errors.New("Could not send message at this rate")
	ErrConnectionClosed = errors.New("broker connection closed")
)
View Source
var ErrContractNotFound = errors.New("Contract not found or is ambiguous")

Functions

This section is empty.

Types

type ContractKey

type ContractKey struct {
	Symbol       string
	SecurityType string
	Expiry       ExpiryIBFormat
	Multiplier   string
	Strike       float64
	PutOrCall    types.PutOrCall
}

func ContractKeyFromOption

func ContractKeyFromOption(t *types.Option) ContractKey

func NewContractKey

func NewContractKey(c *ib.Contract) ContractKey

func (ContractKey) ToContract

func (ck ContractKey) ToContract() ib.Contract

type ExpiryIBFormat

type ExpiryIBFormat string

Types with conversion functions to ensure that we don't mix up the different formats.

func (ExpiryIBFormat) String

func (s ExpiryIBFormat) String() string

type ExpiryOCCFormat

type ExpiryOCCFormat string

func (ExpiryOCCFormat) String

func (s ExpiryOCCFormat) String() string

type IB

type IB struct {
	Accounts []string

	// Debug logging level
	Debug   types.DebugLevel
	Timeout time.Duration
	Logger  log15.Logger
	// contains filtered or unexported fields
}

func New

func New(logger log15.Logger, config json.RawMessage) (*IB, error)

func (*IB) AccountList

func (p *IB) AccountList(ctx context.Context) ([]*types.Account, error)

func (*IB) Close

func (p *IB) Close() error

func (*IB) Connect

func (p *IB) Connect() (err error)

func (*IB) Error

func (p *IB) Error() error

func (*IB) GetHistoricalData

func (p *IB) GetHistoricalData(ctx context.Context, params types.HistoricalDataParams) ([]*types.Quote, error)

func (*IB) GetOptionsChain

func (p *IB) GetOptionsChain(ctx context.Context, underlying string) (types.OptionChain, error)

func (*IB) GetOptionsQuotes

func (p *IB) GetOptionsQuotes(ctx context.Context, params types.OptionsQuoteParams) ([]*types.OptionQuote, error)

func (*IB) GetPositions

func (p *IB) GetPositions(ctx context.Context) ([]*types.Position, error)

func (*IB) GetStockQuote

func (p *IB) GetStockQuote(ctx context.Context, symbol string) (*types.Quote, error)

func (*IB) GetTrades

func (p *IB) GetTrades(ctx context.Context, startTime time.Time) ([]*types.Trade, error)

func (*IB) LogDebugNormal

func (p *IB) LogDebugNormal(msg string, args ...interface{})

func (*IB) LogDebugTrace

func (p *IB) LogDebugTrace(msg string, args ...interface{})

func (*IB) LogDebugVerbose

func (p *IB) LogDebugVerbose(msg string, args ...interface{})

func (*IB) SetDebugLevel

func (p *IB) SetDebugLevel(level types.DebugLevel)

func (*IB) Status

func (p *IB) Status() *types.ConnectionStatus

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL