Browse Source

indicator plot meta

main
strange 9 months ago
parent
commit
4f5e9279f1
  1. 14
      README.md
  2. 4
      config/exchange.toml
  3. 1
      pkg/indicator/indicator.go
  4. 33
      pkg/indicator/indicator_plot.go
  5. 5
      pkg/indicator/super_trend.go

14
README.md

@ -98,5 +98,17 @@ strategy0: 趋势追踪,增长趋势,
- trade strategy
- 自动测试(因子挖掘):
1. 指标分类
2. 指标参数组合迭代 (确定潜在的可调参数)
2. 指标参数组合迭代 (确定潜在的可调参数)!!!
KlineSeries 替换, copy性能消耗
macd dif/dea -> state -> plot
- 金融市场体系
- 高数
- 交易系统
- VWAP/TWAP: 交易分单算法 减少下单对市场冲击
系统终极形态:
- 量化交易
- web3:
- 智能合约 solidity NTF

4
config/exchange.toml

@ -18,8 +18,8 @@ receiveBuffer = 4096
marketSubscribeLimit = 16
consumeBatch = 1024
consumeLater = 2000 # 时间到达later或者数据累计到batch触发consume
httpProxy = ""
# httpProxy = "http://192.168.1.5:7890"
# httpProxy = ""
httpProxy = "http://192.168.1.5:7890"
# httpProxy = "http://10.255.183.209:7890"
# 模拟盘API交易地址如下:

1
pkg/indicator/indicator.go

@ -15,6 +15,7 @@ type IndicatorMeta struct {
Desc string `json:"desc"` // 指标描述
Input []types.InputArg `json:"input"` // 输入参数
State []string `json:"state"` // 向外暴露状态
Plot Plot `json:"plot"` // 指标绘图属性
}
// IIndicator 指标基础计算接口

33
pkg/indicator/indicator_plot.go

@ -0,0 +1,33 @@
package indicator
// 绘图属性
type Plot struct {
Props map[string]any // 长度颜色
Series []PlotSeries // 需要绘图的时间序列列表
}
type PlotSeries struct {
State string `json:"state"` // vector, stateName
Series SeriesType `json:"series"` // 绘图类型 线/柱
Props map[string]any `json:"props"` // 绘图属性
SeriesFn func(vector float64, states map[string]float64) map[string]any
}
// SeriesType 序列值绘图类型
type SeriesType int32
const (
SeriesNone SeriesType = iota
SeriesLine
SeriesHistogram
SeriesArea
)
// Series 绘图颜色
type Color string
const (
ColorRed Color = "red"
ColorGreen Color = "green"
ColorYellow Color = "yellow"
)

5
pkg/indicator/super_trend.go

@ -14,6 +14,11 @@ func (c SuperTrend) Meta() IndicatorMeta {
{Name: "mul", Type: types.InputTypeUInt, Desc: "乘数(建议2-4)"},
},
State: []string{"direction"},
Plot: Plot{
Series: []PlotSeries{
{State: "", Series: SeriesLine, Props: map[string]any{"color": "red"}}, // hist
},
},
}
}

Loading…
Cancel
Save