events

package
v0.0.0-...-4ab53fc Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2021 License: MIT Imports: 10 Imported by: 0

README

GoCryptoTrader package Events

Build Status Software License GoDoc Coverage Status Go Report Card

This events package is part of the GoCryptoTrader codebase.

This is still in active development

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

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

Current Features for events

  • The events package handles events from GoCryptoTrader bot.
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:

1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB

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