Skip to main content

Streaming video data via networks

Project description

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!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chartilo-0.0.3.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

chartilo-0.0.3-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file chartilo-0.0.3.tar.gz.

File metadata

  • Download URL: chartilo-0.0.3.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for chartilo-0.0.3.tar.gz
Algorithm Hash digest
SHA256 d9ba22446b7cad9e165be1b27a18c82bac65995dd2e48531bf8c8e069ee1890b
MD5 6cfac092717498b8dec4a22b91937f41
BLAKE2b-256 cfaa72e507bd0cbd3878c98695fb1af139cf9dc6ad4d6bf100758e0178b9ab10

See more details on using hashes here.

File details

Details for the file chartilo-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: chartilo-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for chartilo-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e28529a3826c58d82aee8ddffb05adb30bf8c24b742c2ce4d7d30cb5d698c92f
MD5 511b8917072e77a25e36b01de2bf3039
BLAKE2b-256 25c3e523d185c21768802429df3e0257cf776463a75c6e748c876c7bee9b19c1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page