fill

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 5 Imported by: 0

README

GoCryptoTrader Backtester: Fill package

Build Status Software License GoDoc Coverage Status Go Report Card

This fill package is part of the GoCryptoTrader codebase.

This is still in active development

You can track ideas, planned features and what's in progress on this Trello board: https://trello.com/b/ZAhMhpOy/gocryptotrader.

Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack

Fill package overview

The Fill Event type contains details the outcome from attempting to make an order. Any slippage or pricing adjustment or fees are part of the fill event. If an order is placed, it is available to access on the event as well as in the compliance manager

The Fill Event Type is based on common.EventHandler and common.Directioner while also having the following custom functions

SetAmount(float64)
	GetAmount() float64
	GetClosePrice() float64
	GetVolumeAdjustedPrice() float64
	GetSlippageRate() float64
	GetPurchasePrice() float64
	GetExchangeFee() float64
	SetExchangeFee(float64)
	GetOrder() *order.Detail
Please click GoDocs chevron above to view current GoDoc information for this package

Contribution

Please feel free to submit any pull requests or suggest any desired features to be added.

When submitting a PR, please abide by our coding guidelines:

  • Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
  • Code must be documented adhering to the official Go commentary guidelines.
  • Code must adhere to our coding style.
  • Pull requests need to be based on and opened against the master branch.

Donations

If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:

bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event interface {
	common.Event
	common.Directioner

	SetAmount(decimal.Decimal)
	GetAmount() decimal.Decimal
	GetClosePrice() decimal.Decimal
	GetVolumeAdjustedPrice() decimal.Decimal
	GetSlippageRate() decimal.Decimal
	GetPurchasePrice() decimal.Decimal
	GetTotal() decimal.Decimal
	GetExchangeFee() decimal.Decimal
	SetExchangeFee(decimal.Decimal)
	GetOrder() *order.Detail
	GetFillDependentEvent() signal.Event
	IsLiquidated() bool
}

Event holds all functions required to handle a fill event

type Fill

type Fill struct {
	*event.Base
	Direction           order.Side      `json:"side"`
	Amount              decimal.Decimal `json:"amount"`
	ClosePrice          decimal.Decimal `json:"close-price"`
	VolumeAdjustedPrice decimal.Decimal `json:"volume-adjusted-price"`
	PurchasePrice       decimal.Decimal `json:"purchase-price"`
	Total               decimal.Decimal `json:"total"`
	ExchangeFee         decimal.Decimal `json:"exchange-fee"`
	Slippage            decimal.Decimal `json:"slippage"`
	Order               *order.Detail   `json:"-"`
	FillDependentEvent  signal.Event
	Liquidated          bool
}

Fill is an event that details the events from placing an order

func (*Fill) GetAmount

func (f *Fill) GetAmount() decimal.Decimal

GetAmount returns the amount

func (*Fill) GetClosePrice

func (f *Fill) GetClosePrice() decimal.Decimal

GetClosePrice returns the closing price

func (*Fill) GetDirection

func (f *Fill) GetDirection() order.Side

GetDirection returns the direction

func (*Fill) GetExchangeFee

func (f *Fill) GetExchangeFee() decimal.Decimal

GetExchangeFee returns the exchange fee

func (*Fill) GetFillDependentEvent

func (f *Fill) GetFillDependentEvent() signal.Event

GetFillDependentEvent returns the fill dependent event to raise after a prerequisite event has been completed

func (*Fill) GetOrder

func (f *Fill) GetOrder() *order.Detail

GetOrder returns the order

func (*Fill) GetPurchasePrice

func (f *Fill) GetPurchasePrice() decimal.Decimal

GetPurchasePrice returns the purchase price

func (*Fill) GetSlippageRate

func (f *Fill) GetSlippageRate() decimal.Decimal

GetSlippageRate returns the slippage rate

func (*Fill) GetTotal

func (f *Fill) GetTotal() decimal.Decimal

GetTotal returns the total cost

func (*Fill) GetVolumeAdjustedPrice

func (f *Fill) GetVolumeAdjustedPrice() decimal.Decimal

GetVolumeAdjustedPrice returns the volume adjusted price

func (*Fill) IsLiquidated

func (f *Fill) IsLiquidated() bool

IsLiquidated highlights if the fill event was a result of liquidation

func (*Fill) SetAmount

func (f *Fill) SetAmount(i decimal.Decimal)

SetAmount sets the amount

func (*Fill) SetDirection

func (f *Fill) SetDirection(s order.Side)

SetDirection sets the direction

func (*Fill) SetExchangeFee

func (f *Fill) SetExchangeFee(fee decimal.Decimal)

SetExchangeFee sets the exchange fee

Jump to

Keyboard shortcuts

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