Utils

package
v0.0.0-...-63bcbcd Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ApiKeys map[string]([]string)
View Source
var Client *luno.Client

Global Variables

View Source
var PairName string
View Source
var User string

Functions

func ClosePrevFile

func ClosePrevFile(fileName string)

func CreateClient

func CreateClient() *luno.Client

func Ema

func Ema(oldVal decimal.Decimal, newData decimal.Decimal, period int64) decimal.Decimal

function to calculate exponentially smoothed moving average

func Email

func Email(action string, yield decimal.Decimal)

func GetCurrAsk

func GetCurrAsk() decimal.Decimal

func GetRsi

func GetRsi(PrevAsk decimal.Decimal, currAsk decimal.Decimal, UpEma decimal.Decimal, DownEma decimal.Decimal, period int64) (decimal.Decimal, decimal.Decimal, decimal.Decimal)

function to calculate the Relative Strength Index

func GetTickerRes

func GetTickerRes() luno.GetTickerResponse

func Hammer

func Hammer(stick Candlestick) bool

func InitialSma

func InitialSma(array []decimal.Decimal, length int64) decimal.Decimal

InitialSma function to calculate the simple moving average of a given set of data

func InitialiseKeys

func InitialiseKeys()

Please replace <NAME>, <KEY_ID> and <SECRET> with your respective values

func InverseHammer

func InverseHammer(stick Candlestick) bool

func LoadScreen

func LoadScreen()

func MorningStar

func MorningStar(stick1 Candlestick, stick2 Candlestick, stick3 Candlestick) bool

func PopulateFile

func PopulateFile(b *RsiBot, ask decimal.Decimal, bid decimal.Decimal, rsi decimal.Decimal)

func PrintStatus

func PrintStatus(b *RsiBot, currAsk decimal.Decimal, currBid decimal.Decimal, status string, values []([]decimal.Decimal))

func Rev123

func Rev123(stick1 Candlestick, stick2 Candlestick, stick3 Candlestick) bool

func SetUpNewFile

func SetUpNewFile()

func Sma

func Sma(array []decimal.Decimal) decimal.Decimal

Sma function to calculate the simple moving average of a given set of data

func TradeLive

func TradeLive(b *RsiBot)

TradeLive function to execute trades using the RSI bot

func WhiteSlaves

func WhiteSlaves(stick1 Candlestick, stick2 Candlestick, stick3 Candlestick) bool

Types

type Candlestick

type Candlestick struct {
	OpenAsk  decimal.Decimal
	CloseAsk decimal.Decimal
	MaxAsk   decimal.Decimal
	MinAsk   decimal.Decimal
	OpenBid  decimal.Decimal
	CloseBid decimal.Decimal
	MaxBid   decimal.Decimal
	MinBid   decimal.Decimal
}

func GetCandleStick

func GetCandleStick(tradinginterval int64) Candlestick

type RsiBot

type RsiBot struct {
	TradesMade           int64             // total number of trades executed
	NumOfDecisions       int64             // number of times the bot calculates
	StopLoss             decimal.Decimal   // variable stop loss
	StopLossMult         decimal.Decimal   // multiplier for stop loss
	OverSold             decimal.Decimal   // bound to tell the bot when to buy
	ReadyToBuy           bool              // false means ready to sell
	BuyPrice             decimal.Decimal   // stores most recent price we bought at
	SellPrice            decimal.Decimal   // stores most recent price we sold at
	UpEma                decimal.Decimal   // exponentially smoothed Wilder's MMA for upward change
	DownEma              decimal.Decimal   // exponentially smoothed Wilder's MMA for downward change
	PrevAsk              decimal.Decimal   // the previous recorded ask price
	PrevOrder            string            // stores order ID of most recent order
	RSITradingPeriod     int64             // No of past asks used to calculate RSI
	MACDTradingPeriodLR  int64             // Long term MACD period
	MACDTradingPeriodSR  int64             // Short term MACD period
	CandleTradingPeriod  int64             //candlestick period
	LongestTradingPeriod int64             // Longest of the trading periods
	MACDlongperiodavg    decimal.Decimal   // MACD long period average
	PastAsks             []decimal.Decimal // array of previous ask prices
	MACDshortperiodavg   decimal.Decimal   // MACD short period average
	TimeInterval         int64             //time between each test
	Stack                []Candlestick     //stack of candlesticks
	Offset               decimal.Decimal   //for offset bot
	OffsetTraingPeriod   int64             // trading period for offset bot
	BotString            string            //string to determine which bots are being usde
}

struct for the rsiBot

Jump to

Keyboard shortcuts

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