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.2.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: chartilo-0.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 486ccbd14e3a0b0655df841fd0e0ced1049d31cc7a3afb111e95182e5dbedabe
MD5 388508ed19f7202e4a2dec6abbe9636a
BLAKE2b-256 a8cb521261e6ac9dc5e620d164f23e00fc9db1d832cbc8c51722a0e1cc9c35e0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chartilo-0.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 05cddd6562c4ffa0a7a856818e25ab458110e607f006e6b81b7f0d2fe10a810e
MD5 61a074eb7e6f6b07229459672fb0750c
BLAKE2b-256 50d8ae58adb9f459bd45bed51c574e9e25f905d18fd4fb3b45c005444a5bb4c5

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