alpacaAcc

package
v0.0.0-...-5bb7b8c Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Derivation

func Derivation(lbars []marketdata.Bar, sStart, sEnd int) int

func GetHistData

func GetHistData(Client marketdata.Client, stock string, start time.Time, end time.Time, numBars int) (map[string][]marketdata.Bar, error)

func GetHistDatas

func GetHistDatas(Client marketdata.Client, stock string, startTime, endTime time.Time, numBars int) (map[string][]marketdata.Bar, error)

func GetLiveData

func GetLiveData(stock string)

func GoldenCross

func GoldenCross(lbars []marketdata.Bar, shortAv int) int

func Trader

func Trader(ClientCont AlpacaClientContainer, stock string, strat string, longAv int, shortAv int, ErrorChan chan<- error)

Types

type AlpacaClientContainer

type AlpacaClientContainer struct {
	TradeClient  TradeClient
	DataClient   *marketdata.Client
	StreamClient *stream.StocksClient
	// contains filtered or unexported fields
}

func Init

func Init() AlpacaClientContainer

type KeyNumbers

type KeyNumbers struct {
	Crossover int64 `json:"crossover"`
}

type Position

type Position struct {
	AssetID       string          `json:"asset_id"`
	Symbol        string          `json:"symbol"`
	Exchange      string          `json:"exchange"`
	Qty           decimal.Decimal `json:"qty"`
	QtyAvailable  decimal.Decimal `json:"qty_available"`
	AvgEntryPrice decimal.Decimal `json:"avg_entry_price"`
}

type StockData

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

type TradeClient

type TradeClient interface {
	PlaceOrder(req alpaca.PlaceOrderRequest) (*alpaca.Order, error)
	GetAccount() (*alpaca.Account, error)
	GetAsset(symbol string) (*alpaca.Asset, error)
	GetCalendar(req alpaca.GetCalendarRequest) ([]alpaca.CalendarDay, error)
}

type UserRepo

type UserRepo struct {
	Client *alpaca.Client
}

Jump to

Keyboard shortcuts

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