Skip to main content

A framework for algorithmic strategy scripts.

Project description

This is a framework for creating/backtesting and running trading algorythms. It is intended to work in a familiar way for those who have used Tradingview's Pinescript, from writing the scripts to visualizing them in lightweight-charts. It doesn't intend to mimic the language, but the structure should be familiar enough to you to feel comfortable.

What does it do: It connects to crypto exchanges using the CCXT library and downloads the historical data[1]. It saves it in cache and keeps updating it every time it's launched. It runs a backtest of your script on it, and then (if ordered to) it continues running it in realtime, casting webhook alerts to a webhook service (Like my own free webhook script).

[1] It does not require an API key and it will take a while to download. Note: Not all exchanges provide historical data. If it fails try another exchange.

Strategies can be multi-timeframe. Trades can be oneway or hedged. It takes into account the fees cost by fetching them from the exchange.

Most typical 'indicators' are already built in, and creating custom ones is relatively easy. By default all series are calculated using Numpy. Talib is used for some of them when it's present in the system. Talib provides a marginal speed increase..

I do think Algorizer offers a very intuitive and simple way of creating, backtesting and running trading bots for those with knowledge of python and/or pinescript.

The project is still a work in progress so you'll most likely find a few nuissances. However, fetching the historical candles, fetching the real time price updates, running the backtest and running your strategy realtime is reliable. Backtest and realtime execution match properly. There are no lookahead nor repainting issues.

Plotting capabilities: As of today it's capable of plots, histograms, lines (point to point) and markers (labels), as it's capable of creating subpanels and targetting these to them. Horizontal lines, boxes and tables remain in the to do list, and will probably stay there for quite some time.

I'm slowly adding documentation in the 'DOC.md' file. It's not complete yet, but it offers a starting point. I also extensively commented the file 'example_misc.py' from which you can obtain a good amount of information and get a sense of how to create a strategy.

Use template.py as base to write scripts.

image

Future plans (aka to do list)

  • Add more indicators and drawing options.
  • Add inputs with ranges and steps for future batch-backtesting
  • Direct broker connection with the exchange for the strategy code to confirm operations
  • Low priority: Make the chart load bars in modular blocks so it doesn't take so long on high bar count (pandas is slow af).

. I will not make much work on the chart window UI. I'll make it able to change timeframe if the lightweight-charts gods allow it and that's it. But I'll gladly accept contributions on it. The script and the chart are in a client/server configuration so even whole new chart replacements other than lightweight-charts could be added
. I'll also be happy to accept contributions in making it work with stocks. Only needs a fetcher file and a way to get the realtime price updates, but I have no idea where one can obtain that information in the world of stocks.


Install the required modules with the usual requirements.txt

pip install -r requirements.txt

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

algorizer-0.1.0.tar.gz (96.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

algorizer-0.1.0-py3-none-any.whl (82.7 kB view details)

Uploaded Python 3

File details

Details for the file algorizer-0.1.0.tar.gz.

File metadata

  • Download URL: algorizer-0.1.0.tar.gz
  • Upload date:
  • Size: 96.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for algorizer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 02a680e37a45d94b7a76d77d9240bbfdb3995aa94e27ab2db4cabe2b8d13939f
MD5 78fc80f7a45a165778b649a7f7d26487
BLAKE2b-256 d55f242f9d621614f1f1288ec8c41c80c71231a26c1ca9589c61e93632bfe1f5

See more details on using hashes here.

File details

Details for the file algorizer-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: algorizer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 82.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for algorizer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1105c9a00774512185032d3bd2464aed511b6644ec8f0027d9fc2fd29fceed0d
MD5 8a555e96071792436502d41a476ebc4b
BLAKE2b-256 67692320b3e48a019f5953ca53a77d65ef6e533fe2c2ff33952d1f387426303e

See more details on using hashes here.

Supported by

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