Documentation ¶
Index ¶
- func ExecuteTradesAndPrint(title string, initialInvestment float64, ts []*Trade)
- func RenderYieldFarmingPerformanceChart(path string, farm *LPFarm) error
- type EMACrossOverStrategy
- type Forecast
- type Indicator
- type LPFarm
- func (f *LPFarm) AddLP(date string, amount float64, isAdditionalInvestment bool) error
- func (f *LPFarm) GetChangeHistoryAsc() (items []*LPFarmHistoryItem)
- func (f *LPFarm) GetPrices(date string) (priceA, priceB timeseries.ValueAt, err error)
- func (f *LPFarm) Harvest(date string) (yield float64, err error)
- func (f *LPFarm) LogChange(date string, priceA, priceB timeseries.ValueAt)
- func (f *LPFarm) PrintChange(date string)
- func (f *LPFarm) RebalanceLP(priceA, priceB timeseries.ValueAt)
- func (f *LPFarm) SetAPRChangeRateAtHarvest(dailyChange float64)
- type LPFarmHistoryItem
- type PriceChange
- type Side
- type Trade
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteTradesAndPrint ¶
Types ¶
type EMACrossOverStrategy ¶
type EMACrossOverStrategy struct { ShortEMA *Indicator LongEMA *Indicator Track *coingecko.Market Trade *coingecko.Market Trades []*Trade }
func NewEMACrossOverStrategy ¶
func NewEMACrossOverStrategy(shortEMA, longEMA *Indicator, track, trade *coingecko.Market) (*EMACrossOverStrategy, error)
type Forecast ¶
type Forecast struct { Farms []*LPFarm Currency coingecko.Fiat InitialInvestment float64 Balance float64 StartDate string Days int }
func NewForecast ¶
func (*Forecast) CreateMarket ¶
type Indicator ¶
type Indicator struct { Name string `json:"name"` ByTimestamp map[int64]float64 ByDateString map[string]float64 }
func NewEMAIndicator ¶
func NewEMAIndicator(days int, prices timeseries.Series) *Indicator
func (*Indicator) ForTimestamp ¶
type LPFarm ¶
type LPFarm struct { Name string A *coingecko.Market B *coingecko.Market Currency coingecko.Fiat InitialInvestment float64 StartDate string APR float64 APRChangeRateAtHarvest float64 InitialAPR float64 LastHarvestDate string UnitsA float64 UnitsB float64 InitialUnitsA float64 InitialUnitsB float64 AdditionalInvestmentUnitsA float64 AdditionalInvestmentUnitsB float64 TotalValue float64 // Total value of farm in given fiat currency. TotalValueHODL float64 // Total value if we simply HODL:d both assets instead, in given fiat currency. ChangeHistory map[string]*LPFarmHistoryItem // All changes, e.g. when a harvest was performed or more LP was added. }
func (*LPFarm) GetChangeHistoryAsc ¶
func (f *LPFarm) GetChangeHistoryAsc() (items []*LPFarmHistoryItem)
func (*LPFarm) GetPrices ¶
func (f *LPFarm) GetPrices(date string) (priceA, priceB timeseries.ValueAt, err error)
func (*LPFarm) LogChange ¶
func (f *LPFarm) LogChange(date string, priceA, priceB timeseries.ValueAt)
func (*LPFarm) PrintChange ¶
func (*LPFarm) RebalanceLP ¶
func (f *LPFarm) RebalanceLP(priceA, priceB timeseries.ValueAt)
func (*LPFarm) SetAPRChangeRateAtHarvest ¶
type LPFarmHistoryItem ¶
type PriceChange ¶
Click to show internal directories.
Click to hide internal directories.