porttools

package module
v0.0.0-...-b2e716b Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2018 License: MIT Imports: 18 Imported by: 0

README

porttools

Under Development GoDoc License Go Report Card

Usage

import "github.com/jakeschurch/porttools"

TODO

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Oms  *OMS
	Port *portfolio.Portfolio

	// ErrInvalidFileGlob indiciates that no files could be found from given glob
	ErrInvalidFileGlob = errors.New("No files could be found from file glob")

	// ErrInvalidFileDelim is thrown when file delimiter is not able to be parsed
	ErrInvalidFileDelim = errors.New("File delimiter could not be parsed")
)
View Source
var (
	// ErrNegativeVolume indicates that the processed order
	// has too high of a volume to act upon.
	ErrNegativeVolume = errors.New("not enough volume to fill order")
)
View Source
var (
	// ErrOrderNotValid indicates that an order is not valid, and should not be sent to the  pipeline.
	ErrOrderNotValid = errors.New("Order does not meet criteria as a valid order")
)

Functions

This section is empty.

Types

type Algorithm

type Algorithm interface {
	EntryCheck(instrument.Quote) (*order.Order, error)
	ExitCheck(order.Order, instrument.Tick) (*order.Order, error)
}

Algorithm is an interface that needs to be implemented in the pipeline by a user to fill orders based on the conditions that they specify.

type Node

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

Node represents data stored in a container.

func NewNode

func NewNode(data interface{}) *Node

NewNode instantiates a new Node.

type OMS

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

OMS acts as an `Order Management System` to test trading signals and fill orders.

func NewOMS

func NewOMS() *OMS

NewOMS inits a new OMS type.

func (*OMS) Cash

func (oms *OMS) Cash() utils.Amount

func (*OMS) Insert

func (oms *OMS) Insert(o *order.Order) error

Insert checks to see if we can insert a new buy order into the OMS. If it can, order will be inserted into oms, updates cash, and stores new holding in Port.

func (*OMS) Query

func (oms *OMS) Query(t instrument.Tick) error

type Queue

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

Queue is an implementation of a FIFO container type.

func NewQueue

func NewQueue() *Queue

NewQueue instantiates a new Queue.

func (*Queue) Dequeue

func (queue *Queue) Dequeue() (node *Node)

Dequeue removes and returns value from the queue.

func (*Queue) Enqueue

func (queue *Queue) Enqueue(node *Node)

Enqueue stores value in the queue.

type Simulation

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

Simulation embeds all data structs necessary for running a backtest of an algorithmic strategy.

func NewSimulation

func NewSimulation(file string) (*Simulation, error)

NewSimulation is a constructor for the Simulation data type, and a pre-processor function for the embedded types.

func (*Simulation) Run

func (sim *Simulation) Run() error

Run acts as the simulation's primary pipeline function; directing everything to where it needs to go.

type Strategy

type Strategy struct {
	Algorithm Algorithm
}

Strategy ...

func NewStrategy

func NewStrategy(a Algorithm) Strategy

NewStrategy creates a new Strategy instance used in the backtesting process.

func (Strategy) CheckEntryLogic

func (s Strategy) CheckEntryLogic(q instrument.Quote) (entryOrder *order.Order, err error)

CheckEntryLogic ...TODO

func (Strategy) CheckExitLogic

func (s Strategy) CheckExitLogic(o order.Order, t instrument.Tick) (exitOrder *order.Order, err error)

CheckExitLogic ...TODO

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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