Documentation ¶
Index ¶
- Variables
- func Color(c drawing.Color) func() drawing.Color
- func EmptyImageWithText(width, height int, text string, w io.Writer) (int, error)
- func LabelLast(c *Curve, rend gochart.Renderer, width, height int)
- func LabelLastMaxMin(c *Curve, rend gochart.Renderer, width, height int)
- func LabelMaxMin(c *Curve, rend gochart.Renderer, width, height int)
- func LabelMinMaxInterval(c *Curve) string
- func Last(c *Curve) string
- func Max(c *Curve) string
- func MaxFloor(c *Curve) string
- func Min(c *Curve) string
- func PnlColor(last float64) drawing.Color
- func PointsAsIs(c *Curve) ([]time.Time, []float64)
- func PointsSquared(c *Curve) ([]time.Time, []float64)
- func RenderMulti(cus []*Curve, width, height int, colors []string, widths []float64, ...) error
- func StyleInstancePnL(c *Curve) gochart.Style
- func StyleLastPrice(c *Curve) gochart.Style
- func StyleMixedPnL(c *Curve) gochart.Style
- func StyleOpeningPrice(color drawing.Color) func(*Curve) gochart.Style
- func StylePnL(c *Curve) gochart.Style
- func StyleThreshold(color drawing.Color) func(*Curve) gochart.Style
- func WriteMultiJSONTo(cus []*Curve, w io.Writer) (int, error)
- func WritePositiveNegativeJSONTo(cu *Curve, from int, w io.Writer) (int, error)
- type Charter
- func (c *Charter) AddCurve(vac *Curve)
- func (c *Charter) AddValue(code string, vat ValueAt) bool
- func (c *Charter) Curve(id string) *Curve
- func (c *Charter) DebugHandler(w http.ResponseWriter, r *http.Request)
- func (c *Charter) DeleteCurve(code string)
- func (c *Charter) DownloadFile(w http.ResponseWriter, r *http.Request)
- func (a *Charter) GroupPnLHandler(w http.ResponseWriter, r *http.Request)
- func (c *Charter) LastValue(code string) (float64, bool)
- func (c *Charter) Len(code string) int
- func (c *Charter) MultiChartImage(w http.ResponseWriter, r *http.Request)
- func (c *Charter) MultiChartJSON(w http.ResponseWriter, r *http.Request)
- func (c *Charter) RedisSetNames(ctx context.Context, prefix string) (map[string]string, error)
- func (c *Charter) RegisterCurve(cu *Curve)
- func (c *Charter) Reset(key, value string)
- func (c *Charter) SingleChartImage(w http.ResponseWriter, r *http.Request)
- func (c *Charter) SingleChartJSON(w http.ResponseWriter, r *http.Request)
- func (c *Charter) Traverse(f func(c *Curve))
- type Curve
- func (vat *Curve) AddSlice(p []ValueAt)
- func (c *Curve) Attr() string
- func (c *Curve) ETag() string
- func (cu *Curve) LastValue() (float64, bool)
- func (c *Curve) Len() int
- func (c *Curve) Max() float64
- func (c *Curve) Min() float64
- func (c *Curve) Push(at int64, val float64)
- func (c *Curve) Reset()
- func (c *Curve) WriteJSONTo(w io.Writer, name string, from int) (int, error)
- func (c *Curve) WriteTo(w io.Writer) (int64, error)
- type GroupPnL
- type LabelFunc
- type LabelGetterFunc
- type PointFunc
- type StyleFunc
- type ValueAt
- type ValueReaderFunc
- func RedisHashAttrReader(zl *zerolog.Logger, rs store.Storer, hashName, attr string, listprefix string) ValueReaderFunc
- func RedisPlatformPnLFiller(zl *zerolog.Logger, rs store.Storer, redisListName string, c *Charter) ValueReaderFunc
- func RedisPnLReader(zl *zerolog.Logger, rs store.Storer, redisListName string) ValueReaderFunc
Constants ¶
This section is empty.
Variables ¶
var HTMLBackgroundColor = drawing.Color{R: 0x1e, G: 0x1e, B: 0x1e, A: 255}
Functions ¶
func EmptyImageWithText ¶
EmptyImageWithText writes PNG picture with text in the center.
func LabelLastMaxMin ¶
LabelLastMaxMin puts last, max and min values in to the top/center, top/left and top/rigt corners.
func LabelMaxMin ¶
LabelMaxMin puts max and min values in to the top/left and top/rigt corners.
func LabelMinMaxInterval ¶
func PointsAsIs ¶
PointsAsIs returns curve points as is without changes.
func PointsSquared ¶
PointsSquared returns points always horizontal or vertical lines.
func RenderMulti ¶
func RenderMulti(cus []*Curve, width, height int, colors []string, widths []float64, pngbuf *bytes.Buffer) error
RenderMulti renders a few Curves at once.
func StyleInstancePnL ¶
func StyleLastPrice ¶
StyleLastPrice returns style for last price curve.
func StyleMixedPnL ¶
func StyleOpeningPrice ¶
StyleOpeningPrice returns style for opening price curve. It's dashed.
func StylePnL ¶
StylePnL returns style for pnl curve. The color changes between Red and Green in accordance to last value (below or above zero).
func StyleThreshold ¶
StyleThreshold returns style for high and low curves.
Types ¶
type Charter ¶
type Charter struct {
// contains filtered or unexported fields
}
func (*Charter) DebugHandler ¶
func (c *Charter) DebugHandler(w http.ResponseWriter, r *http.Request)
func (*Charter) DeleteCurve ¶
func (*Charter) DownloadFile ¶
func (c *Charter) DownloadFile(w http.ResponseWriter, r *http.Request)
DownloadFile
func (*Charter) GroupPnLHandler ¶
func (a *Charter) GroupPnLHandler(w http.ResponseWriter, r *http.Request)
func (*Charter) LastValue ¶
LastValue returns last value related to curve code. Return false if curve not found or there is no values.
func (*Charter) MultiChartImage ¶
func (c *Charter) MultiChartImage(w http.ResponseWriter, r *http.Request)
MultiChartImage returns a chart image representing a single curve.
func (*Charter) MultiChartJSON ¶
func (c *Charter) MultiChartJSON(w http.ResponseWriter, r *http.Request)
func (*Charter) RedisSetNames ¶
RedisSetNames returns map of redis sets starting with prefix. The key of map is set name without prefix. Value is redis set name.
func (*Charter) RegisterCurve ¶
func (*Charter) SingleChartImage ¶
func (c *Charter) SingleChartImage(w http.ResponseWriter, r *http.Request)
func (*Charter) SingleChartJSON ¶
func (c *Charter) SingleChartJSON(w http.ResponseWriter, r *http.Request)
SingleChartJSON returns a chart representing a single curve.
type Curve ¶
type Curve struct { At []time.Time `json:"at"` Value []float64 `json:"v"` // AtP []time.Time `json:"atp"` AtN []time.Time `json:"atn"` // ValueP holds only values above or equal to zero ValueP []float64 `json:"vp,omitempty"` // ValueN holds only values below zero ValueN []float64 `json:"vn,omitempty"` MaxIndex int MinIndex int // contains filtered or unexported fields }
Curve holds values and related timestamps and becomes source for chart.
func (*Curve) WriteJSONTo ¶
type LabelGetterFunc ¶
type ValueReaderFunc ¶
func RedisHashAttrReader ¶
func RedisHashAttrReader(zl *zerolog.Logger, rs store.Storer, hashName, attr string, listprefix string) ValueReaderFunc
RedisHashAttrReader
func RedisPlatformPnLFiller ¶
func RedisPnLReader ¶
RedisPnLReader