storage

package
v0.0.0-...-ab49fd9 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

type Asset struct {
	Symbol string `json:"symbol" mapstructure:"symbol"`
	Name   string `json:"name" mapstructure:"name"`
	Title  string `json:"title" mapstructure:"title"`
	Type   string `json:"type" mapstructure:"type"`
}

Asset Contains details about a single asset

type AssetStorage

type AssetStorage interface {
	List(context.Context) ([]*Asset, error)
	Get(ctx context.Context, symbol string) (*Asset, error)
	Store(context.Context, *Asset) error
	Delete(ctx context.Context, symbol string) error
}

type OHLC

type OHLC struct {
	Time   time.Time `json:"time"`
	Open   float64   `json:"open"`
	High   float64   `json:"high"`
	Low    float64   `json:"low"`
	Close  float64   `json:"close"`
	Volume int       `json:"volume"`
}

OHLC End-of-day information of a stock in a simulation

type OHLCStorage

type OHLCStorage interface {
	Store(ctx context.Context, symbol string, ohlc *OHLC) error
}

type Order

type Order struct {
	ID         string      `json:"id" mapstructure:"id"`
	Symbol     string      `json:"symbol" mapstructure:"symbol"`
	Amount     int         `json:"amount" mapstructure:"amount"`
	LimitPrice int         `json:"limit_price" mapstructure:"limit_price"`
	StopPrice  int         `json:"stop_price" mapstructure:"stop_price"`
	Filled     int         `json:"filled" mapstructure:"filled"`
	Commission int         `json:"commission" mapstructure:"commission"`
	Status     OrderStatus `json:"status" mapstructure:"status"`
}

Order Stock order data

type OrderStatus

type OrderStatus int
const (
	OPEN      OrderStatus = iota
	FILLED    OrderStatus = iota
	CANCELLED OrderStatus = iota
	REJECTED  OrderStatus = iota
	HELD      OrderStatus = iota
)

type OrderStorage

type OrderStorage interface {
	List(ctx context.Context, execution string) ([]*Order, error)
	Store(ctx context.Context, execution string, order *Order) error
}

type Position

type Position struct {
	Symbol    string    `json:"symbol" mapstructure:"symbol"`
	Amount    int       `json:"amount" mapstructure:"amount"`
	CostBasis float64   `json:"cost_basis" mapstructure:"cost_basis"`
	Period    time.Time `json:"period" mapstructure:"period"`
}

type PositionStorage

type PositionStorage interface {
	Store(context.Context, string, *Position) error
	List(context.Context, string, *time.Time) ([]*Position, error)
}

Jump to

Keyboard shortcuts

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