Skip to main content

A time-machine style financial backtesting and ratio analysis engine

Project description

📊 Financial Engine

A time-machine for market data — replay and analyze historical financial data for one or more companies across single or multiple dates.

Built to backtest strategies, calculate financial ratios, and accelerate data analysis using a smart caching mechanism.


✨ Features

  • 📈 Calculate financial ratios on-demand
  • 🔁 Perform rolling computations for line items
  • ⚡ Caching mechanism for fast range-date processing

🚀 Installation

pip install financial-engine

Step-by-step

  1. Create and activate a virtual environment:

    python -m venv .venv
    source .venv/bin/activate  # or .venv\Scripts\activate on Windows
    
  2. Create a .env file in the root of your project:

    MONGO_URI=
    MONGO_DATABASE=
    MONGO_COLLECTION=
    AWS_ACCESS_KEY_ID=
    AWS_SECRET_ACCESS_KEY=
    BUCKET_NAME=
    
  3. Install the package:

    pip install financial-engine
    

🐍 Requirements

  • Python ≥ 3.9
  • Compatible with major OS environments (Linux, Windows, Mac)

🛠 Implemented Methods

Method Description
get_ratios() Get financial ratios for a single company on a specific date
get_ratios_range() Fetch financial ratios for a company across a date range

📦 Usage Example

from financial_engine.core.engine import FinancialEngine

fe = FinancialEngine()

ratios_df = await fe.get_ratios_range(
    alpha_code="RELIANCE",
    start_date="2023-01-01",
    end_date="2023-01-15"
)
print(ratios_df)

🧪 Testing

To test in a local project:

  1. Create a .env file with valid AWS and Mongo credentials.
  2. Install development dependencies:
    pip install -r requirements.txt
    
  3. Run your test script using the API.

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

financial_engine-0.1.0.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

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

financial_engine-0.1.0-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: financial_engine-0.1.0.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for financial_engine-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c964ea6b2c961f94dd476fa9dd1553f2e49e078a58313eece04ea446ca5a0333
MD5 49dddf6945621a9a43a83110c385bc7d
BLAKE2b-256 4b1bcf7587ffedfd2c2b4b6eebb36e5870023934093e322edaa97558dbfe3430

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for financial_engine-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a740868adc2d7a70e26b7911bfb5a97a850a78568490ecfa380697a92c8bc812
MD5 9ddc6adfa2ffca78ca954e1b1f36601e
BLAKE2b-256 4309706ade2efe584e43436e0cd91ba6f61628059e477f73a3217666e08fa734

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