stock

package
v0.0.0-...-795d1ad Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HistoryRequest

type HistoryRequest struct {
	// date to retrieve as YYYY-MM-DD
	Date string `json:"date"`
	// the stock symbol e.g AAPL
	Stock string `json:"stock"`
}

type HistoryResponse

type HistoryResponse struct {
	// the close price
	Close float64 `json:"close"`
	// the date
	Date string `json:"date"`
	// the peak price
	High float64 `json:"high"`
	// the low price
	Low float64 `json:"low"`
	// the open price
	Open float64 `json:"open"`
	// the stock symbol
	Symbol string `json:"symbol"`
	// the volume
	Volume int32 `json:"volume"`
}

type Order

type Order struct {
	// the asking price
	AskPrice float64 `json:"askPrice"`
	// the ask size
	AskSize int32 `json:"askSize"`
	// the bidding price
	BidPrice float64 `json:"bidPrice"`
	// the bid size
	BidSize int32 `json:"bidSize"`
	// the UTC timestamp of the quote
	Timestamp string `json:"timestamp"`
}

type OrderBookRequest

type OrderBookRequest struct {
	// the date in format YYYY-MM-dd
	Date string `json:"date"`
	// optional RFC3339Nano end time e.g 2006-01-02T15:04:05.999999999Z07:00
	End string `json:"end"`
	// limit number of prices
	Limit int32 `json:"limit"`
	// optional RFC3339Nano start time e.g 2006-01-02T15:04:05.999999999Z07:00
	Start string `json:"start"`
	// stock to retrieve e.g AAPL
	Stock string `json:"stock"`
}

type OrderBookResponse

type OrderBookResponse struct {
	// date of the request
	Date string `json:"date"`
	// list of orders
	Orders []Order `json:"orders"`
	// the stock symbol
	Symbol string `json:"symbol"`
}

type PriceRequest

type PriceRequest struct {
	// stock symbol e.g AAPL
	Symbol string `json:"symbol"`
}

type PriceResponse

type PriceResponse struct {
	// the last price
	Price float64 `json:"price"`
	// the stock symbol e.g AAPL
	Symbol string `json:"symbol"`
}

type QuoteRequest

type QuoteRequest struct {
	// the stock symbol e.g AAPL
	Symbol string `json:"symbol"`
}

type QuoteResponse

type QuoteResponse struct {
	// the asking price
	AskPrice float64 `json:"askPrice"`
	// the ask size
	AskSize int32 `json:"askSize"`
	// the bidding price
	BidPrice float64 `json:"bidPrice"`
	// the bid size
	BidSize int32 `json:"bidSize"`
	// the stock symbol
	Symbol string `json:"symbol"`
	// the UTC timestamp of the quote
	Timestamp string `json:"timestamp"`
}

type StockService

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

func NewStockService

func NewStockService(token string) *StockService

func (*StockService) History

func (t *StockService) History(request *HistoryRequest) (*HistoryResponse, error)

Get the historic open-close for a given day

func (*StockService) OrderBook

func (t *StockService) OrderBook(request *OrderBookRequest) (*OrderBookResponse, error)

Get the historic order book and each trade by timestamp

func (*StockService) Price

func (t *StockService) Price(request *PriceRequest) (*PriceResponse, error)

Get the last price for a given stock ticker

func (*StockService) Quote

func (t *StockService) Quote(request *QuoteRequest) (*QuoteResponse, error)

Get the last quote for the stock

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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