configfile

package
v0.0.0-...-0f05733 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: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFileToBackup

func CopyFileToBackup() error

Types

type ConfigFile

type ConfigFile struct {
	TestMode bool `yaml:"test_mode"`

	Binance struct {
		APIKey       string `yaml:"api_key,omitempty"`
		APIKeySecret string `yaml:"api_key_secret,omitempty"`
	} `yaml:"binance"`
	Bridge string   `yaml:"bridge"`
	Coins  []string `yaml:"coins"`

	// TODO Do we need it ? we could find the ratio getting better and buy it
	StartCoin *string `yaml:"start_coin"`

	TradeTimeout time.Duration `yaml:"trade_timeout"`

	Jump Jump `yaml:"jump"`

	Order struct {
		Refresh time.Duration `yaml:"refresh"`
	} `yaml:"order"`

	Telegram struct {
		Token     string `yaml:"token,omitempty"`
		ChannelID string `yaml:"channel_id,omitempty"`
		Handlers  struct {
			NbDiffDisplayed int `yaml:"nb_diff_displayed"`
		} `yaml:"handlers"`
	} `yaml:"telegram"`

	NotificationLevel string `yaml:"notification_level"`
}

func ParseConfigFile

func ParseConfigFile() (ConfigFile, error)

func (*ConfigFile) ApplyDefaults

func (cf *ConfigFile) ApplyDefaults()

func (ConfigFile) GenerateAllSymbolsWithBridge

func (cf ConfigFile) GenerateAllSymbolsWithBridge() []string

func (*ConfigFile) RemoveSecrets

func (c *ConfigFile) RemoveSecrets()

func (*ConfigFile) SaveToFile

func (c *ConfigFile) SaveToFile() error

func (*ConfigFile) ValidateChanges

func (nc *ConfigFile) ValidateChanges(pc ConfigFile) error

type Jump

type Jump struct {
	WhenGain   decimal.Decimal `yaml:"when_gain"`
	DecreaseBy decimal.Decimal `yaml:"decrease_by"`
	After      time.Duration   `yaml:"after"`
	Min        decimal.Decimal `yaml:"min"`

	// Will contains bot start time
	DefaultLastJump time.Time `yaml:"-"`
}

func (Jump) GetNeededGain

func (j Jump) GetNeededGain(lastJump time.Time) decimal.Decimal

Return needed ratio (between 0 and 1)

Jump to

Keyboard shortcuts

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