Skip to content

BitColibri/CandlePrintGo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CandlePrintGo

CandlePrintGo is a small package that lets you print candle charts in the terminal.

Features

  • Color profile selection
  • Simple use library

Usage

Create a CandleChart passing an array of Candle and height.

package main

import (
	"fmt"
	
	"github.com/bitcolibri/candlePrintGo"
	"github.com/muesli/termenv"
)

func main() {
	profile := candlePrintGo.NewColorProfile(termenv.ColorProfile(), "#A8CC8C", "#E88388")
	
	data := []candlePrintGo.Candle{
		candlePrintGo.NewCandleBar(255.49, 261.50, 253.42, 260.64),
		candlePrintGo.NewCandleBar(257.89, 261.32, 253.50, 259.61),
		candlePrintGo.NewCandleBar(258.14, 264.57, 257.13, 262.51),
		candlePrintGo.NewCandleBar(262.26, 267.10, 261.42, 265.89),
	}
	chart := candlePrintGo.NewCandleChart(data, 50, candlePrintGo.WithColorProfile(profile))
	fmt.Println(chart.Render())
}

Check the example

To Do

  • Dynamic chart example
  • Develop BubbleTea component

Thanks

Image was created with gopher-stickers.

This repo was inspired by termgraph.

About

Terminal candle chart in Go

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages