Skip to main content

An ultimate DeFi research library for strategy development and fractaling.

Project description

Fractal

Fractal is an ultimate DeFi research library for strategy development and fractaling created by Logarithm Labs.

Docs

Technical docs.

How to install?

pip install fractal-defi

Quick start with ready-to-go strategies

Run MLFlow locally or self-hosted:

pip install mlflow
mlflow io

Than just import pre-built strategies and run the pipeline:

from typing import List

from sklearn.model_selection import ParameterGrid

from fractal.strategies import GMXV2UniswapV3Basis, BasisTradingStrategyHyperparams
from fractal.loaders import BinanceDayPriceLoader, LoaderType

from fractal.core.pipeline import DefaultPipeline, MLFlowConfig, ExperimentConfig
from fractal.core.base import Observation


# Load data and build observations
def build_observations() -> List[Observation]:
  ...


# Build a grid of parameters to search
def build_grid() -> ParameterGrid:
  ...


# Define MLFlow and Experiment configurations
mlflow_config: MLFlowConfig = MLFlowConfig(
    mlflow_uri='http://127.0.01:5000',
    experiment_name='my_strategy'
)
experiment_config: ExperimentConfig = ExperimentConfig(
    strategy=GMXV2UniswapV3Basis,
    backtest_observations=build_observations(),
    window_size=24,
    params_grid=build_grid(),
    debug=True
)
pipeline: DefaultPipeline = DefaultPipeline(
    experiment_config=experiment_config,
    mlflow_config=mlflow_config
)
pipeline.run()

See more detailes examples in /examples directory

Changelog

See our discord dev channel for updates.

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

fractal_defi-1.2.0.tar.gz (39.5 kB view details)

Uploaded Source

Built Distribution

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

fractal_defi-1.2.0-py3-none-any.whl (61.7 kB view details)

Uploaded Python 3

File details

Details for the file fractal_defi-1.2.0.tar.gz.

File metadata

  • Download URL: fractal_defi-1.2.0.tar.gz
  • Upload date:
  • Size: 39.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for fractal_defi-1.2.0.tar.gz
Algorithm Hash digest
SHA256 4417bdfc9723e04fa81539bc16f2755c2f001e2c58f26135ed1b193d261f15bb
MD5 7226e8978e40a8415ca4ab50c2bf0eb3
BLAKE2b-256 530c0e08a8f8e5ad976a3813a61d6d4ce8d58b4bdb119b53b02f4d5f551dc255

See more details on using hashes here.

File details

Details for the file fractal_defi-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: fractal_defi-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 61.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for fractal_defi-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0ec95b24f04a7bc5d0cca505594b4b4d86c9f49c7243c0e3068dcc54acda674
MD5 ed7c5c5c6dfed2a0afb644c5a0c5fe88
BLAKE2b-256 3404bb407765b974c69b28601fd4b0a933ecaef7227ddb36575a4e2436298223

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