events

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Events []*Event

Events variable is a pointer array to the event structures that will be appended

Functions

func AddEvent

func AddEvent(exchange, item, condition string, currencyPair currency.Pair, asset, action string) (int, error)

AddEvent adds an event to the Events chain and returns an index/eventID and an error

func CheckEvents

func CheckEvents()

CheckEvents is the overarching routine that will iterate through the Events chain

func GetEventCounter

func GetEventCounter() (total, executed int)

GetEventCounter displays the emount of total events on the chain and the events that have been executed.

func IsValidAction

func IsValidAction(action string) bool

IsValidAction validates passed in action

func IsValidCondition

func IsValidCondition(condition string) bool

IsValidCondition validates passed in condition

func IsValidEvent

func IsValidEvent(exchange, item, condition, action string) error

IsValidEvent checks the actions to be taken and returns an error if incorrect

func IsValidExchange

func IsValidExchange(exchange string) bool

IsValidExchange validates the exchange

func IsValidItem

func IsValidItem(item string) bool

IsValidItem validates passed in Item

func RemoveEvent

func RemoveEvent(eventID int) bool

RemoveEvent deletes and event by its ID

func SetComms

func SetComms(commsP *communications.Communications)

SetComms is an interim function that will support a median integration. This sets the current comms package.

Types

type Event

type Event struct {
	ID        int
	Exchange  string
	Item      string
	Condition string
	Pair      currency.Pair
	Asset     string
	Action    string
	Executed  bool
}

Event struct holds the event variables

func (*Event) CheckCondition

func (e *Event) CheckCondition() bool

CheckCondition will check the event structure to see if there is a condition met

func (*Event) ExecuteAction

func (e *Event) ExecuteAction() bool

ExecuteAction will execute the action pending on the chain

func (*Event) String

func (e *Event) String() string

String turns the structure event into a string

Jump to

Keyboard shortcuts

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