order

package
v0.0.0-...-3338124 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2016 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Overview

Package order allows to calculate future price projections, broker fees and risk figures

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StopLoss

func StopLoss(actual, stop float64) error

StopLoss returns nil when it is valid.

Types

type HigherLowerError

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

HigherLowerError represents an error for values (a & b) where a cannot be lower than b

func (*HigherLowerError) Error

func (e *HigherLowerError) Error() string

type Order

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

Order contains data to calculate order figures

func (*Order) Amount

func (o *Order) Amount() (amount int64)

Amount returns the actual amount of stocks that can be bought for an order

func (*Order) Even

func (o *Order) Even(broker string) (even decimal.Decimal, err error)

Even returns the exact break even point for an order

func (*Order) Gain

func (o *Order) Gain(broker string) (gain decimal.Decimal, err error)

Gain returns the highest possible gain for an order

func (*Order) Loss

func (o *Order) Loss(broker string) (loss decimal.Decimal, err error)

Loss returns the highest possible loss for an order

func (*Order) RiskRewardRatio

func (o *Order) RiskRewardRatio() (rrr decimal.Decimal)

RiskRewardRatio returns a risk reward ratio value for an order

func (*Order) TotalCommission

func (o *Order) TotalCommission(brokerAlias string) (commission decimal.Decimal, err error)

TotalCommission returns the total broker commission fee for an order

Jump to

Keyboard shortcuts

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