model

package
v0.0.0-...-cbdeaad Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const BalanceHistoryTableName = "balance_history"
View Source
const BlacklistedSymbolTableName = "blacklisted_symbol"
View Source
const ChartTableName = "chart"
View Source
const (
	ChartTypeCoinPrice = "coin_price"
)
View Source
const CoinPriceTableName = "coin_price_history"
View Source
const CoinTableName = "coins"
View Source
const CurrentCoinTableName = "current_coin_history"
View Source
const DiffTableName = "diff"
View Source
const JumpTableName = "jumps"
View Source
const PairHistoryTableName = "pairs_history"
View Source
const PairTableName = "pairs"

Variables

View Source
var DefaultCoinPriceChartAllCoin1Day = Chart{Type: ChartTypeCoinPrice, Config: `* 1`}
View Source
var DefaultCoinPriceChartAllCoin30Day = Chart{Type: ChartTypeCoinPrice, Config: `* 30`}
View Source
var DefaultCoinPriceChartAllCoin3Day = Chart{Type: ChartTypeCoinPrice, Config: `* 3`}
View Source
var DefaultCoinPriceChartAllCoin7Day = Chart{Type: ChartTypeCoinPrice, Config: `* 7`}

Functions

func CoinIDMapper

func CoinIDMapper() util.Mapper[Coin, string]

func SameCoinPredicate

func SameCoinPredicate(coin Coin) util.Predicate[Coin]

Types

type BalanceHistory

type BalanceHistory struct {
	Timestamp   time.Time `gorm:"primaryKey"`
	BtcBalance  decimal.Decimal
	UsdtBalance decimal.Decimal
}

func (BalanceHistory) TableName

func (BalanceHistory) TableName() string

type BlacklistedSymbol

type BlacklistedSymbol struct {
	Symbol string `gorm:"primaryKey"`
}

func (BlacklistedSymbol) TableName

func (BlacklistedSymbol) TableName() string

type Chart

type Chart struct {
	ID     uint `gorm:"primaryKey;autoIncrement"`
	Type   string
	Config string
}

func (Chart) TableName

func (Chart) TableName() string

type Coin

type Coin struct {
	Coin      string `gorm:"primaryKey"`
	Enabled   bool
	EnabledOn time.Time
}

func (Coin) TableName

func (Coin) TableName() string

type CoinPrice

type CoinPrice struct {
	Coin      string    `gorm:"primaryKey"`
	AltCoin   string    `gorm:"primaryKey"`
	Timestamp time.Time `gorm:"primaryKey"`
	Price     decimal.Decimal
	Averaged  bool

	CoinRef Coin `gorm:"foreignKey:Coin;references:Coin"`
}

func (CoinPrice) TableName

func (CoinPrice) TableName() string

type CurrentCoin

type CurrentCoin struct {
	Coin      string    `gorm:"primaryKey"`
	Timestamp time.Time `gorm:"primaryKey"`
}

func (CurrentCoin) TableName

func (CurrentCoin) TableName() string

type Diff

type Diff struct {
	FromCoin   string    `gorm:"primaryKey"`
	ToCoin     string    `gorm:"primaryKey"`
	Timestamp  time.Time `gorm:"primaryKey"`
	Diff       decimal.Decimal
	NeededDiff decimal.Decimal
}

func (*Diff) LogSymbol

func (d *Diff) LogSymbol() string

func (Diff) TableName

func (Diff) TableName() string

type Jump

type Jump struct {
	FromCoin  string    `gorm:"primaryKey"`
	ToCoin    string    `gorm:"primaryKey"`
	Timestamp time.Time `gorm:"primaryKey"`

	FromQuantity decimal.Decimal
	FromPrice    decimal.Decimal
	ToQuantity   decimal.Decimal
	ToPrice      decimal.Decimal

	FromCoinRef Coin `gorm:"foreignKey:FromCoin;references:Coin"`
	ToCoinRef   Coin `gorm:"foreignKey:ToCoin;references:Coin"`
}

func (Jump) TableName

func (Jump) TableName() string

type Pair

type Pair struct {
	ID       uint `gorm:"primaryKey;autoIncrement"`
	FromCoin string
	ToCoin   string
	Exists   bool

	LastJump             time.Time
	LastJumpRatio        decimal.Decimal
	LastJumpRatioBasedOn time.Time

	FromCoinDetail Coin `gorm:"foreignKey:FromCoin"`
	ToCoinDetail   Coin `gorm:"foreignKey:ToCoin"`
}

func (Pair) LogSymbol

func (p Pair) LogSymbol() string

func (Pair) TableName

func (Pair) TableName() string

type PairHistory

type PairHistory struct {
	PairID    uint      `gorm:"primaryKey"`
	Timestamp time.Time `gorm:"primaryKey"`
	Ratio     decimal.Decimal
	Averaged  bool

	Pair Pair `gorm:"foreignKey:PairID;references:ID"`
}

func (PairHistory) TableName

func (PairHistory) TableName() string

type PairWithTickerRatio

type PairWithTickerRatio struct {
	Pair      Pair
	Ratio     decimal.Decimal
	Timestamp time.Time
}

TODO Why does this struct is not just PairHistory ?

Jump to

Keyboard shortcuts

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