risk

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: 10 Imported by: 0

README

GoCryptoTrader Backtester: Risk package

Build Status Software License GoDoc Coverage Status Go Report Card

This risk 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

Risk package overview

The risk manager is responsible for ensuring that no order can be made if it is deemed too risky. Risk is currently defined by ensuring that orders cannot have too much leverage for the individual order, overall with all orders in the portfolio as well as whether there are too many orders for an individual currency

See config package readme to view the risk related fields to customise

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 CurrencySettings

type CurrencySettings struct {
	MaximumOrdersWithLeverageRatio decimal.Decimal
	MaxLeverageRate                decimal.Decimal
	MaximumHoldingRatio            decimal.Decimal
}

CurrencySettings contains relevant limits to assess risk

type Handler

type Handler interface {
	EvaluateOrder(order.Event, []holdings.Holding, compliance.Snapshot) (*order.Order, error)
}

Handler defines what is expected to be able to assess risk of an order

type Risk

type Risk struct {
	CurrencySettings map[key.ExchangePairAsset]*CurrencySettings
	CanUseLeverage   bool
	MaximumLeverage  decimal.Decimal
}

Risk contains all currency settings in order to evaluate potential orders

func (*Risk) EvaluateOrder

func (r *Risk) EvaluateOrder(o order.Event, latestHoldings []holdings.Holding, s compliance.Snapshot) (*order.Order, error)

EvaluateOrder goes through a standard list of evaluations to make to ensure that we are in a position to follow through with an order

Jump to

Keyboard shortcuts

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