Documentation ¶
Overview ¶
Package stockfighter provides a simple wrapper for the Stockfighter API:
Index ¶
- Variables
- type Evidence
- type Execution
- type Fill
- type Game
- type GameState
- type Order
- type OrderBook
- type OrderState
- type OrderType
- type Quote
- type StandingOrder
- type StandingOrderSlice
- type Stockfighter
- func (sf *Stockfighter) Cancel(venue, stock string, id uint64) (*OrderState, error)
- func (sf *Stockfighter) Executions(account, venue, stock string) (chan *Execution, error)
- func (sf *Stockfighter) GameStatus(id uint64) (*GameState, error)
- func (sf *Stockfighter) Heartbeat(venue string) error
- func (sf *Stockfighter) Judge(id uint64, evidence *Evidence) (*GameState, error)
- func (sf *Stockfighter) OrderBook(venue, stock string) (*OrderBook, error)
- func (sf *Stockfighter) Place(order *Order) (*OrderState, error)
- func (sf *Stockfighter) Quote(venue, stock string) (*Quote, error)
- func (sf *Stockfighter) Quotes(account, venue, stock string) (chan *Quote, error)
- func (sf *Stockfighter) Restart(id uint64) error
- func (sf *Stockfighter) Resume(id uint64) error
- func (sf *Stockfighter) Start(level string) (*Game, error)
- func (sf *Stockfighter) Status(venue, stock string, id uint64) (*OrderState, error)
- func (sf *Stockfighter) StockStatus(account, venue, stock string) ([]OrderState, error)
- func (sf *Stockfighter) Stocks(venue string) ([]Symbol, error)
- func (sf *Stockfighter) Stop(id uint64) error
- type Symbol
Constants ¶
This section is empty.
Variables ¶
var URL_BASE = "api.stockfighter.io"
Domain which hosts the API servers
Functions ¶
This section is empty.
Types ¶
type Execution ¶
type Game ¶
type OrderBook ¶
type OrderBook struct { Venue string Symbol string Asks StandingOrderSlice Bids StandingOrderSlice TimeStamp time.Time `json:"ts"` }
type OrderState ¶
type OrderState struct { Venue string Symbol string Price uint64 OriginalQuantity uint64 `json:"originalQty"` Quantity uint64 `json:"qty"` Direction string OrderType OrderType Id uint64 Account string Timestamp time.Time `json:"ts"` Fills []Fill TotalFilled uint64 Open bool }
func (OrderState) String ¶
func (os OrderState) String() string
type OrderType ¶
type OrderType int
func (OrderType) MarshalText ¶
func (*OrderType) UnmarshalText ¶
type Quote ¶
type StandingOrder ¶
type StandingOrderSlice ¶
type StandingOrderSlice []StandingOrder
type Stockfighter ¶
type Stockfighter struct {
// contains filtered or unexported fields
}
func NewStockfighter ¶
func NewStockfighter(apiKey string, debug bool) *Stockfighter
Create new Stockfighter API instance. If debug is true, log all HTTP requests and responses.
func (*Stockfighter) Cancel ¶
func (sf *Stockfighter) Cancel(venue, stock string, id uint64) (*OrderState, error)
Cancel an existing order.
func (*Stockfighter) Executions ¶
func (sf *Stockfighter) Executions(account, venue, stock string) (chan *Execution, error)
Subscribe to a stream of executions for a venue. If stock is a non-empy string, only executions for that stock are returned.
func (*Stockfighter) GameStatus ¶
func (sf *Stockfighter) GameStatus(id uint64) (*GameState, error)
Get the GameState using the instance id from a previously started Game.
func (*Stockfighter) Heartbeat ¶
func (sf *Stockfighter) Heartbeat(venue string) error
Check the API Is Up. If venue is a non-empty string, then check that venue. Returns nil if ok, otherwise the error indicates the problem.
func (*Stockfighter) Judge ¶
func (sf *Stockfighter) Judge(id uint64, evidence *Evidence) (*GameState, error)
func (*Stockfighter) OrderBook ¶
func (sf *Stockfighter) OrderBook(venue, stock string) (*OrderBook, error)
Get the orderbook for a particular stock.
func (*Stockfighter) Place ¶
func (sf *Stockfighter) Place(order *Order) (*OrderState, error)
Place an order
func (*Stockfighter) Quote ¶
func (sf *Stockfighter) Quote(venue, stock string) (*Quote, error)
Get a quick look at the most recent trade information for a stock.
func (*Stockfighter) Quotes ¶
func (sf *Stockfighter) Quotes(account, venue, stock string) (chan *Quote, error)
Subscribe to a stream of quotes for a venue. If stock is a non-empy string, only quotes for that stock are returned.
func (*Stockfighter) Restart ¶
func (sf *Stockfighter) Restart(id uint64) error
Restart a level using the instance id from a previously started Game.
func (*Stockfighter) Resume ¶
func (sf *Stockfighter) Resume(id uint64) error
Resume a level using the instance id from a previously started Game.
func (*Stockfighter) Start ¶
func (sf *Stockfighter) Start(level string) (*Game, error)
Start a new level.
func (*Stockfighter) Status ¶
func (sf *Stockfighter) Status(venue, stock string, id uint64) (*OrderState, error)
Get the status for an existing order.
func (*Stockfighter) StockStatus ¶
func (sf *Stockfighter) StockStatus(account, venue, stock string) ([]OrderState, error)
Get the statuses for all an account's orders of a stock on a venue. If stock is a non-empty string, only statuses for that stock are returned
func (*Stockfighter) Stocks ¶
func (sf *Stockfighter) Stocks(venue string) ([]Symbol, error)
Get the stocks available for trading on a venue.
func (*Stockfighter) Stop ¶
func (sf *Stockfighter) Stop(id uint64) error
Stop a level using the instance id from a previously started Game.