https://github.com/iamjinlei/go-tachart
Candlestick chart generator (with event mark and TA indicator) using go-echarts
https://github.com/iamjinlei/go-tachart
candlestick-chart echarts ta-charts technical-analysis
Last synced: 4 months ago
JSON representation
Candlestick chart generator (with event mark and TA indicator) using go-echarts
- Host: GitHub
- URL: https://github.com/iamjinlei/go-tachart
- Owner: iamjinlei
- License: mit
- Created: 2021-06-03T14:19:44.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-07-12T11:09:30.000Z (almost 4 years ago)
- Last Synced: 2024-06-19T00:33:11.809Z (almost 2 years ago)
- Topics: candlestick-chart, echarts, ta-charts, technical-analysis
- Language: Go
- Homepage:
- Size: 5.42 MB
- Stars: 46
- Watchers: 6
- Forks: 6
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
go-tachart
This is a fork and extension to the beautiful [go-echarts](https://github.com/go-echarts/go-echarts) project.
Some of the [go-echarts](https://github.com/go-echarts/go-echarts) code is modified to tailor to the needs of TA charts.
To keep iteration simple, [go-echarts](https://github.com/go-echarts/go-echarts) code is replicated in this repo.
This is still a work-in-progress.
More TA chart and event types will be added to support a wide-range of use cases.
### How It Looks Like
#### Candlestick chart with moving average overlay on top

#### Candlestick chart with moving average overlay on top + additional indicators

### Usage
In this example, a simple chart is created with a few lines of code. A complete code example can be found in the example folder.
```golang
package main
import (
"github.com/iamjinlei/go-tachart/tachart"
)
func main() {
cdls := []tachart.Candle{
{Label: "2018/1/24", O: 2320.26, C: 2320.26, L: 2287.3, H: 2362.94, V: 149092},
{Label: "2018/1/25", O: 2300, C: 2291.3, L: 2288.26, H: 2308.38, V: 189092},
{Label: "2018/1/28", O: 2295.35, C: 2346.5, L: 2295.35, H: 2346.92, V: 159034},
{Label: "2018/1/29", O: 2347.22, C: 2358.98, L: 2337.35, H: 2363.8, V: 249910},
{Label: "2018/1/30", O: 2360.75, C: 2382.48, L: 2347.89, H: 2383.76, V: 119910},
{Label: "2018/1/31", O: 2383.43, C: 2385.42, L: 2371.23, H: 2391.82, V: 89940},
... // To fill more data
{Label: "2018/6/13", O: 2190.1, C: 2148.35, L: 2126.22, H: 2190.1, V: 239510},
}
events := []tachart.Event{
{
Type: tachart.Short,
Label: cdls[40].Label,
Description: "This is a demo event description. Randomly pick this candle to go short on " + cdls[40].Label,
},
}
cfg := tachart.NewConfig().
SetWidth(1080).
SetHeight(800).
AddOverlay(
tachart.NewSMA(5),
tachart.NewSMA(20),
).
AddIndicator(
tachart.NewMACD(12, 26, 9),
).
UseRepoAssets() // serving assets file from current repo, avoid network access
c := tachart.New(*cfg)
c.GenStatic(cdls, events, "/Volumes/tmpfs/tmp/kline.html")
}
```