stockfighter

package
v0.0.0-...-43ecc72 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2016 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckStockfighterHeartbeat

func CheckStockfighterHeartbeat()

func CreateWebsocket

func CreateWebsocket(path string) *websocket.Conn

func StockfighterAPI

func StockfighterAPI(endpoint string) []byte

func StockfighterPost

func StockfighterPost(endpoint string, body io.Reader) []byte

Types

type APIStatus

type APIStatus struct {
	OK    bool   `json:"ok"`
	Error string `json:"error"`
}

type GM

type GM struct {
	LevelName  string
	InstanceID int
}

func (*GM) CreateLevel

func (g *GM) CreateLevel() LevelCreate

func (*GM) GetInstanceDetails

func (g *GM) GetInstanceDetails() InstanceType

func (*GM) GetLevels

func (g *GM) GetLevels()

func (*GM) StopLevel

func (g *GM) StopLevel()

type InstanceType

type InstanceType struct {
	OK         bool   `json:"ok"`
	Done       bool   `json:"done"`
	Error      string `json:"error"`
	InstanceID int    `json:"id"`
	State      string `json:"state"`
}

type LevelCreate

type LevelCreate struct {
	OK         bool   `json:"ok"`
	InstanceID int    `json:"instanceID"`
	Account    string `json:"account"`
	//Instructions string `json:"instructions"`
	Tickers []string `json:"tickers"`
	Venues  []string `json:"venues"`
	Error   string   `json:"error"`
}

type Order

type Order struct {
	Price    int  `json:"price"`
	Quantity int  `json:"qty"`
	IsBuy    bool `json:"isBuy"`
}

type OrderBook

type OrderBook struct {
	OK        bool   `json:"ok"`
	Venue     string `json:"venue"`
	Symbol    string `json:"symbol"`
	Timestamp string `json:"ts"`

	Bids []Order `json:"bids"`
	Asks []Order `json:"asks"`
}

type OrderBroker

type OrderBroker struct {
	Venue          string
	TradingAccount string
	Stock          string
}

func (*OrderBroker) Buy

func (ob *OrderBroker) Buy(quantity int, price int)

func (*OrderBroker) CheckVenueHeartbeat

func (ob *OrderBroker) CheckVenueHeartbeat()

func (*OrderBroker) GetOrderBook

func (ob *OrderBroker) GetOrderBook() OrderBook

func (*OrderBroker) GetQuote

func (ob *OrderBroker) GetQuote() QuoteType

func (*OrderBroker) GetStock

func (ob *OrderBroker) GetStock() VenueStocks

type PlaceOrderType

type PlaceOrderType struct {
	Account   string `json:"account"`
	Venue     string `json:"venue"`
	Stock     string `json:"stock"`
	Price     int    `json:"price"`
	Quantity  int    `json:"qty"`
	Direction string `json:"direction"`
	OrderType string `json:"orderType"`
}

type QuoteType

type QuoteType struct {
	Symbol    string `json:"symbol"`
	Venue     string `json:"venue"`
	Bid       int    `json:"bid"`
	Ask       int    `json:"ask"`
	BidSize   int    `json:"bidSize"`
	AskSize   int    `json:"askSize"`
	BidDepth  int    `json:"bidDepth"`
	AskDepth  int    `json:"askDepth"`
	Last      int    `json:"last"`
	LastSize  int    `json:"lastSize"`
	LastTrade string `json:"lastTrade"`
	QuoteTime string `json:"quoteTime"`
}

func (*QuoteType) Spread

func (g *QuoteType) Spread() int

type StockDetails

type StockDetails struct {
	Name   string `json:"name"`
	Symbol string `json:"symbol"`
}

type Tickertape

type Tickertape struct {
	OK    bool      `json:"ok"`
	Quote QuoteType `json:"quote"`
}

type VenueStatus

type VenueStatus struct {
	OK    bool   `json:"ok"`
	Venue string `json:"venue"`
}

type VenueStocks

type VenueStocks struct {
	OK     bool           `json:"ok"`
	Stocks []StockDetails `json:"symbols"`
}

type Websocket

type Websocket struct {
	// contains filtered or unexported fields
}

func NewWebsocket

func NewWebsocket(path string) Websocket

func (*Websocket) CloseWebSocket

func (ws *Websocket) CloseWebSocket()

func (*Websocket) ReceiveWebsocketMsg

func (ws *Websocket) ReceiveWebsocketMsg(msgs chan []byte)

Jump to

Keyboard shortcuts

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