trade

package module
v0.0.0-...-98dbee5 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2020 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-tradesim

A simple trading system simulator

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Strategy

type Strategy struct {
	Price     quote.Quote
	Script    string
	Runtime   time.Duration
	Startbar  int
	Units     float64
	Roundlot  int
	Startcash float64
	Skidfrac  float64
	Trades    []Trade
	Balance   []float64
	Barcount  int
	Bar       int

	Equity []float64
	// contains filtered or unexported fields
}

Strategy - main struct to hold trading system info

func NewStrategy

func NewStrategy(p quote.Quote, script string) Strategy

NewStrategy -

func (*Strategy) Backtest

func (s *Strategy) Backtest(params []float64) float64

Backtest -

func (*Strategy) Bliss

func (s *Strategy) Bliss() float64

Bliss -

func (*Strategy) BuyOpen

func (s *Strategy) BuyOpen()

BuyOpen -

func (*Strategy) BuyStop

func (s *Strategy) BuyStop(price float64)

BuyStop -

func (*Strategy) ClosePosition

func (s *Strategy) ClosePosition()

ClosePosition -

func (*Strategy) CoverOpen

func (s *Strategy) CoverOpen()

CoverOpen -

func (*Strategy) CoverStop

func (s *Strategy) CoverStop(price float64)

CoverStop -

func (*Strategy) DrawDown

func (s *Strategy) DrawDown() float64

DrawDown -

func (*Strategy) EnterTrade

func (s *Strategy) EnterTrade(kind string, symbol string, units float64, entrydate time.Time, entryprice float64)

EnterTrade -

func (*Strategy) EquityLog

func (s *Strategy) EquityLog()

EquityLog -

func (*Strategy) Evaluate

func (s *Strategy) Evaluate()

Evaluate -

func (*Strategy) ExitTrade

func (s *Strategy) ExitTrade(date time.Time, exitprice float64)

ExitTrade -

func (*Strategy) Icagr

func (s *Strategy) Icagr() float64

Icagr -

func (*Strategy) PriceLog

func (s *Strategy) PriceLog()

PriceLog -

func (*Strategy) SellOpen

func (s *Strategy) SellOpen()

SellOpen -

func (*Strategy) SellStop

func (s *Strategy) SellStop(price float64)

SellStop -

func (*Strategy) SetBar

func (s *Strategy) SetBar(bar int)

SetBar -

func (*Strategy) SetUnits

func (s *Strategy) SetUnits(units float64)

SetUnits -

func (*Strategy) ShortOpen

func (s *Strategy) ShortOpen()

ShortOpen -

func (*Strategy) ShortStop

func (s *Strategy) ShortStop(price float64)

ShortStop -

func (*Strategy) Summary

func (s *Strategy) Summary()

Summary -

func (*Strategy) TradeLog

func (s *Strategy) TradeLog()

TradeLog -

type Trade

type Trade struct {
	Symbol     string
	Kind       string
	Units      int
	EntryDate  time.Time
	EntryPrice float64
	ExitDate   time.Time
	ExitPrice  float64
	Profit     float64
}

Trade - info for a single trade

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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