bot

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2021 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InsufficientFunds = errors.New("account has insufficient balance for requested action")
)

Functions

This section is empty.

Types

type Bot

type Bot struct {
	Config Config
	// contains filtered or unexported fields
}

func New

func New() *Bot

func (*Bot) BuyIfDecreaseByPercent

func (b *Bot) BuyIfDecreaseByPercent(symbolPriceChan <-chan string, symbolPriceCloseChan chan<- struct{}, buyCfg BuyConfig) error

func (*Bot) GetAccountBalance

func (b *Bot) GetAccountBalance(holdingSymbol string) (money.Bimoney, error)

func (*Bot) GetCurrentCryptoPrice

func (b *Bot) GetCurrentCryptoPrice(symbol string) (<-chan string, chan<- struct{}, error)

func (*Bot) SellIfIncreaseByPercent

func (b *Bot) SellIfIncreaseByPercent(symbolPriceChan <-chan string, symbolPriceCloseChan chan<- struct{}, sellCfg SellConfig) error

type BuyConfig

type BuyConfig struct {
	BuySymbol               string `json:"buy_symbol"`
	BuyWithHoldingSymbol    string `json:"buy_with_holding_symbol"`
	TargetPriceToBuyAt      string `json:"target_price_to_buy_at"`
	PercentageDiff          int    `json:"percentage_diff"`
	BuyForPercentOfHoldings uint   `json:"buy_for_percent_of_holdings"`
	BuyQuantity             string `json:"buy_quantity"`
}

type Config

type Config struct {
	APIKey    string       `json:"api_key"`
	APISecret string       `json:"api_secret"`
	Sell      []SellConfig `json:"Sell"`
	Buy       []BuyConfig  `json:"Buy"`
}

type SellConfig

type SellConfig struct {
	SellHoldingSymbol      string `json:"sell_holding_symbol"`
	SellForSymbol          string `json:"sell_for_symbol"`
	TargetPriceToSellAt    string `json:"target_price_to_sell_at"`
	PercentageDiff         uint   `json:"percentage_diff"`
	SellPercentOfHoldings  uint   `json:"sell_percent_of_holdings"`
	SellQuantityOfHoldings string `json:"sell_quantity"`
}

Jump to

Keyboard shortcuts

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