order

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: MIT Imports: 5 Imported by: 0

README

GoCryptoTrader Backtester: Order package

Build Status Software License GoDoc Coverage Status Go Report Card

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

Order package overview

The Order Event Type is an event type raised after the portfolio manager has passed all its checks and wishes to make an order It is sent to the Exchange to process and if successful, will raise a Fill Event.

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

	SetAmount(float64)
	GetAmount() float64
	IsOrder() bool
	GetStatus() order.Status
	SetID(id string)
	GetID() string
	GetLimit() float64
	IsLeveraged() bool
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.EventHandler
	common.Directioner
	GetBuyLimit() decimal.Decimal
	GetSellLimit() decimal.Decimal
	SetAmount(decimal.Decimal)
	GetAmount() decimal.Decimal
	IsOrder() bool
	GetStatus() order.Status
	SetID(id string)
	GetID() string
	IsLeveraged() bool
	GetAllocatedFunds() decimal.Decimal
}

Event inherits common event interfaces along with extra functions related to handling orders

type Order

type Order struct {
	event.Base
	ID             string
	Direction      order.Side
	Status         order.Status
	Price          decimal.Decimal
	Amount         decimal.Decimal
	OrderType      order.Type
	Leverage       decimal.Decimal
	AllocatedFunds decimal.Decimal
	BuyLimit       decimal.Decimal
	SellLimit      decimal.Decimal
}

Order contains all details for an order event

func (*Order) GetAllocatedFunds

func (o *Order) GetAllocatedFunds() decimal.Decimal

GetAllocatedFunds returns the amount of funds the portfolio manager has allocated to this potential position

func (*Order) GetAmount

func (o *Order) GetAmount() decimal.Decimal

GetAmount returns the amount

func (*Order) GetBuyLimit

func (o *Order) GetBuyLimit() decimal.Decimal

GetBuyLimit returns the buy limit

func (*Order) GetDirection

func (o *Order) GetDirection() order.Side

GetDirection returns the side of the order

func (*Order) GetID

func (o *Order) GetID() string

GetID returns the ID

func (*Order) GetLeverage

func (o *Order) GetLeverage() decimal.Decimal

GetLeverage returns leverage rate

func (*Order) GetSellLimit

func (o *Order) GetSellLimit() decimal.Decimal

GetSellLimit returns the sell limit

func (*Order) GetStatus

func (o *Order) GetStatus() order.Status

GetStatus returns order status

func (*Order) IsLeveraged

func (o *Order) IsLeveraged() bool

IsLeveraged returns if it is leveraged

func (*Order) IsOrder

func (o *Order) IsOrder() bool

IsOrder returns whether the event is an order event

func (*Order) Pair

func (o *Order) Pair() currency.Pair

Pair returns the currency pair

func (*Order) SetAmount

func (o *Order) SetAmount(i decimal.Decimal)

SetAmount sets the amount

func (*Order) SetDirection

func (o *Order) SetDirection(s order.Side)

SetDirection sets the side of the order

func (*Order) SetID

func (o *Order) SetID(id string)

SetID sets the order id

func (*Order) SetLeverage

func (o *Order) SetLeverage(l decimal.Decimal)

SetLeverage sets leverage

Jump to

Keyboard shortcuts

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