core

package
v0.0.0-...-a52a137 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// "https://datafeed.dukascopy.com/datafeed/{currency}/{year}/{month:02d}/{day:02d}/{hour:02d}h_ticks.bi5"
	DukaTmplURL = "https://datafeed.dukascopy.com/datafeed/%s/%04d/%02d/%02d/%02dh_ticks.bi5"
)

Variables

View Source
var (
	TimeframeRegx = regexp.MustCompile(`(M|H|D|W|MN)(\d+)`)
)

Functions

func ParseTimeframe

func ParseTimeframe(period string) (uint32, string)

ParseTimeframe from input string

Types

type Converter

type Converter interface {
	// PackTicks by timeframe M1,M5...
	// `barTimestamp` is the timeframe in seconds
	// `ticks` is all the ticks data within timeframe
	PackTicks(barTimestamp uint32, ticks []*tickdata.TickData) error
	// Finish current timeframe
	Finish() error
}

Converter convert raw tick data into different file format such as fxt, hst, csv

func NewTimeframe

func NewTimeframe(period string, instrument *instrument.Metadata, out Converter) Converter

NewTimeframe create an new timeframe

type Downloader

type Downloader interface {
	Download(URL string, toFilePath string) (httpStatusCode int, filesize int64, err error)
}

Downloader interface...

func NewDownloader

func NewDownloader() Downloader

type HTTPDownload

type HTTPDownload struct {
	// contains filtered or unexported fields
}

func (HTTPDownload) Download

func (h HTTPDownload) Download(URL string, toFilePath string) (httpStatusCode int, filesize int64, err error)

type Parser

type Parser interface {
	Parse(r io.Reader) error
}

Parser interface used to parse data

type Saver

type Saver interface {
	Save(r io.Reader) error
}

Saver interface used to save data

type Timeframe

type Timeframe struct {
	// contains filtered or unexported fields
}

Timeframe wrapper of tick data in timeframe like: M1, M5, M15, M30, H1, H4, D1, W1, MN

func (*Timeframe) Finish

func (tf *Timeframe) Finish() error

Finish wait convert finish

func (*Timeframe) PackTicks

func (tf *Timeframe) PackTicks(barTimestamp uint32, ticks []*tickdata.TickData) error

PackTicks receive original tick data

Jump to

Keyboard shortcuts

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