effect

package
v0.0.0-...-9b4e82f Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2019 License: MIT Imports: 15 Imported by: 6

Documentation

Index

Constants

View Source
const BaseBuyFee = 20 * money.One
View Source
const BaseSellFell = 20 * money.One
View Source
const BaseTaxRate = 0.15
View Source
const InsiderTradingEffectType = "insider"
View Source
const TradeEffectType = "trade"

Variables

View Source
var EffectLock = lock.NewLock("EffectLock")

Functions

func DeleteEffect

func DeleteEffect(e *Effect)

func DeleteRequest

func DeleteRequest(uuid string) error

func NewTaxModifier

func NewTaxModifier(portfolioUuid, title string, duration time.Duration, taxMultiplier float64) (*Effect, *Effect, error)

func NewTradeEffect

func NewTradeEffect(portfolioUuid, title, tag string, effect *TradeEffect, duration time.Duration) (*Effect, *Effect, error)

func RunEffectCleaner

func RunEffectCleaner()

func UnmarshalJsonEffect

func UnmarshalJsonEffect(effectType, jsonStr string) (interface{}, error)

func UpdateBaseProfit

func UpdateBaseProfit(portfolioUuid string, profitMultiplier float64) (*Effect, *Effect, error)

Types

type Effect

type Effect struct {
	objects.Effect
}

func GetAllEffects

func GetAllEffects() []*Effect

func MakeEffect

func MakeEffect(effect objects.Effect, lockAcquired bool) (*Effect, error)

func NewBaseTradeEffect

func NewBaseTradeEffect(portfolioUuid string) (*Effect, error)

func (*Effect) MarshalJSON

func (u *Effect) MarshalJSON() ([]byte, error)

type EffectType

type EffectType interface {
	Name() string
}

type InsiderTrading

type InsiderTrading struct {
	Duration  utils.Duration
	StartTime time.Time
}

func (*InsiderTrading) Type

func (*InsiderTrading) Type() EffectType

type InsiderTradingType

type InsiderTradingType struct {
}

func (*InsiderTradingType) Name

func (*InsiderTradingType) Name() string

func (*InsiderTradingType) RequiredLevel

func (*InsiderTradingType) RequiredLevel() int64

type TradeEffect

type TradeEffect struct {
	BuyFeeAmount     *int64   `json:"buy_fee_amount"`     // fee on all trades ex: base fee
	BuyFeeMultiplier *float64 `json:"buy_fee_multiplier"` // fee % of the total fees, ex: double fees

	SellFeeAmount     *int64   `json:"sell_fee_amount"`     // fee on all sales trades ex: base fee
	SellFeeMultiplier *float64 `json:"sell_fee_multiplier"` // fee % of the total fees, ex: double fees on trades

	BonusProfitMultiplier *float64 `json:"profit_multiplier"` // current profit multiplier, ex: bonus

	TaxPercent    *float64 `json:"tax_percent"`    // tax payed on profits, ex:  base tax
	TaxMultiplier *float64 `json:"tax_multiplier"` // percent multiplier, ex: taxless sales

	TradeBlocked *bool `json:"trade_blocked"` // if trade is blocked
	// contains filtered or unexported fields
}

func TotalTradeEffect

func TotalTradeEffect(portfolioUuid string) (*TradeEffect, []string)

Calculate the total bonus for a portfolio

func (*TradeEffect) Add

func (t *TradeEffect) Add(effect *TradeEffect)

type TradingType

type TradingType struct {
}

func (TradingType) Name

func (TradingType) Name() string

Jump to

Keyboard shortcuts

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