Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chartilo

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chartilo

Streaming video data via networks

  • 0.0.3
  • PyPI
  • Socket score

Maintainers
1

Chartilo

Cool chart drawer for pyqt5 with candle support

Chartilo is the open-source library which allow you to draw charts on qtpainter with support for lines, candles, bars or heiken-ashi.

  • install library

  • type 17 lines of python code

  • enjoy result

Features

  • easy installation

  • The ability to create your own drawing based modules on the current

  • The ability to create your own color theme

  • Scalable architecture

Tech

Chartilo uses a number of open source projects to work properly:

  • PyQt5 - app build framework

And of course Chartilo itself is open source with a public repository

on GitHub.

Installation

Chatrilo requires python v3+ to run.

If you didn't install PyQt5...


pip install pyqt5

Install the dependency.


pip install chartilo

Development

Ready to code? Great!

Make a change in your file and instantaneously see your updates!

Open your favorite code editor and paste these code lines.

The base sctructure likes this, you can browse demo version here


import sys



from PyQt5.QtWidgets import QApplication, QBoxLayout, QMainWindow, QVBoxLayout, QWidget

from PyQt5 import uic 

from PyQt5.QtWidgets import QApplication, QMainWindow



from chartilo import Chartilo



from chartilo.drawers import GridDrawer, CandleChartDrawer, LineChartDrawer, LineDrawer, MaxMinValuesDrawer



from ast import literal_eval



from chartilo.models import Line, Candle

from chartilo.themes import Light, Dark





class MyWidget(QMainWindow):

	def __init__(self):

		super().__init__()

		uic.loadUi('untitled.ui', self)



		# adding canvas to frame

		self._chartilo = Chartilo()

		layout = QVBoxLayout()

		layout.addWidget(self._chartilo)

		self.frame.setLayout(layout)



		# setting states

		states = {

			"type" : Candle, 

			"theme": Dark,

			"drawers" : {

				"grid" : GridDrawer,

				"lineChart" : CandleChartDrawer,

				"line" : LineDrawer,

				"maxMinDrawer" : MaxMinValuesDrawer

			},

		}



		# getting data

		file = open("data.txt", "r")

		data = literal_eval(file.read())



		# setting data, states and running library

		self._chartilo.setData(data)

		self._chartilo.setStates(states)

		self._chartilo.updateCanvas()





if __name__ == '__main__':

	app = QApplication(sys.argv)

	ex = MyWidget()

	ex.show()

	sys.exit(app.exec_())





First of all, you must have a qtframe in order to insert a painter there:


class MyWidget(QMainWindow):

	def __init__(self):

		super().__init__()

		uic.loadUi('uifile.ui', self)



		# adding painter to frame

		self._chartilo = Chartilo()

		layout = QVBoxLayout()

		layout.addWidget(self._chartilo)

		self.frame.setLayout(layout)



Second step is to create setting of library:

this is how you can implement drawers, models, themes from chartilo library:


		# setting states

		states = {

			"type" : Candle, # the type of chart(liner or candler)

			"theme": Dark, # theme of chart (light or dark)

			"drawers" : {

				"grid" : GridDrawer, # class is used to draw grid for chart

				"lineChart" : CandleChartDrawer, # class is used to draw candles

				"line" : LineDrawer, # showing curren price line

				"maxMinDrawer" : MaxMinValuesDrawer # showing maximum and minimum of chart

			},

		}

Note: Type of vertexes and type of vertexes darwer should be same for proper work.

Note: you can remove some of the classes to get the functionality you want


# this is how you can import drawers from chartilo library

from chartilo.drawers import GridDrawer, CandleChartDrawer, LineChartDrawer, LineDrawer, MaxMinValuesDrawer, Drawer

Note: Drawer is required if you wanna build your own drawer.


# this is how you can import models from chartilo library:

from chartilo.models import Line, Candle

Note: models is setting the type of vertexes and you can create your own models to draw them in your own drawers using base drawer class for calculation.

this is how line generates


class Line:

	width = 8 



	def __init__(self, data):

		self.closeTime = data[0] # NOT REQUIRED close time

		self.openPrice = float(data[1]) # open price

		self.closePrice = float(data[4]) # close price

this is how candle generates


from . import Line





class Candle(Line):

	width = 8 



	def __init__(self, data):

		super().__init__(data); # open and close price look above

		self.maximalPrice = float(data[2]) # maximal price

		self.minimalPrice = float(data[3]) # minimal price


# this is how you can import themes, the default is Dark

from chartilo.themes import Light, Dark, Theme

Note: Theme is required if you wanna create your own theme.

The last step:


		# setting data, states and running library

		self._chartilo.setData(data)

		self._chartilo.setStates(states)

		self._chartilo.updateCanvas()

Note: data must be a two-dimensional array [[closeTime, openPrice, maximalPrice, minimalPrice, closePrice], [closeTime, openPrice, maximalPrice, minimalPrice, closePrice]] example here another fields are not required yet.

This is all have a nice day

if this is not enougth you can browse crypto-meneger-project here

License

MIT

Free Software, Hell Yeah!

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc