kline

package
v0.0.0-...-3ae0ecf Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: MIT Imports: 9 Imported by: 11

README

GoCryptoTrader Backtester: Kline package

Build Status Software License GoDoc Coverage Status Go Report Card

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

Kline package overview

When loading data for the kline, it can come from two sources: candles or trades. In the config they are represented as common.CandleStr or common.TradeStr respectively.

Candle data represents the opening, closing, highest, lowest prices of a given timespan (interval) along with the volume (amount traded) during that same period. You can read more about candles here. This data is utilised throughout the GoCryptoTrader Backtester in order to make informed strategic decisions.

Trade data represents the raw trading data on an exchange. Every buy or sell action for the given currency. When trading data is used for the GoCryptoTrader Backtester, it is converted into candle data at the interval you specify. This allows for custom candle intervals not provided by an exchange's API and thus has a greater amount of flexibility in backtesting strategies.

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 DataFromKline

type DataFromKline struct {
	*data.Base
	Item        *gctkline.Item
	RangeHolder *gctkline.IntervalRangeHolder
}

DataFromKline is a struct which implements the data.Streamer interface It holds candle data for a specified range with helper functions

func NewDataFromKline

func NewDataFromKline() *DataFromKline

NewDataFromKline returns a new struct

func (*DataFromKline) AppendResults

func (d *DataFromKline) AppendResults(ki *gctkline.Item) error

AppendResults adds a candle item to the data stream and sorts it to ensure it is all in order

func (*DataFromKline) HasDataAtTime

func (d *DataFromKline) HasDataAtTime(t time.Time) (bool, error)

HasDataAtTime verifies checks the underlying range data To determine whether there is any candle data present at the time provided

func (*DataFromKline) Load

func (d *DataFromKline) Load() error

Load sets the candle data to the stream for processing

func (*DataFromKline) StreamClose

func (d *DataFromKline) StreamClose() ([]decimal.Decimal, error)

StreamClose returns all Close prices from the beginning until the current iteration

func (*DataFromKline) StreamHigh

func (d *DataFromKline) StreamHigh() ([]decimal.Decimal, error)

StreamHigh returns all High prices from the beginning until the current iteration

func (*DataFromKline) StreamLow

func (d *DataFromKline) StreamLow() ([]decimal.Decimal, error)

StreamLow returns all Low prices from the beginning until the current iteration

func (*DataFromKline) StreamOpen

func (d *DataFromKline) StreamOpen() ([]decimal.Decimal, error)

StreamOpen returns all Open prices from the beginning until the current iteration

func (*DataFromKline) StreamVol

func (d *DataFromKline) StreamVol() ([]decimal.Decimal, error)

StreamVol returns all Volume prices from the beginning until the current iteration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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