Skip to main content

A high-performance algorithmic trading and data inspection library.

Project description

📈 mtrader

mtrader is a professional-grade Python library for quantitative traders and data scientists.
It works like a Swiss Army Knife for data inspection, letting you debug complex financial datasets with a single command.


🛠 Feature: inspect()

inspect() is a Universal Data Explorer.

Instead of multiple debugging calls like:

  • print()
  • type()
  • .info()
  • .describe()

You run:

mt.inspect(data)

and get a high-density statistical report.


💎 Key Capabilities

Deep Statistics
For each column:

  • Count, Max, Min
  • Mean, Std
  • Median, Mode
  • NaN count

Intelligent Headers

Displays:

  • Exact Python <class>
  • Data shape
  • Object structure

Auto-Flattening for Tensors

3D tensors like:

(Tickers, Time, Features)

are flattened automatically for global statistical analysis.

Smart Dictionary Pivot

Dictionaries with equal-length lists are automatically converted into column tables.

Perfect for:

  • Exchange APIs
  • JSON feeds
  • Trading signals

Auto Loader

Inspect files directly:

  • CSV
  • Excel
  • JSON strings

Example:

mt.inspect("historical_prices.csv")

Stress‑Proof Logic

Safe statistical handling prevents crashes when:

  • Data types are mixed
  • Columns are empty
  • Strings appear with numbers

📊 Example Output

Running:

mt.inspect(df)

Produces:

Data type: <class 'pandas.DataFrame'>
It is a pandas DataFrame. Total rows: 5. Total columns: 2. Summary:

column:      price      volume
 dtype:    float64       int64
     -      -----       -----
 Row 0:      100.5        1000
 Row 1:      101.2        1500
 Row 2:      100.8        1200
----------  -----       -----
 count:          5           5
   max:      102.1      2000.0
   min:      100.5      1000.0
  mean:     101.22      1500.0
   std:   0.622093  412.310563
median:      101.2      1500.0
  mode:      100.5      1000.0
   nan:          0           0

🚀 Usage Examples

1. Pandas DataFrame

import mtrader as mt
import pandas as pd

df = pd.DataFrame({
    'price': [100.5, 101.2, 100.8, 102.1, 101.5],
    'volume': [1000, 1500, 1200, 1800, 2000]
})

mt.inspect(df)

2. Pandas Series

series = pd.Series([10, 20, 30, 40, 50], name="RSI_Indicator")
mt.inspect(series)

3. Smart Dictionary Pivot

data = {
    "Ticker": ["BTC", "ETH", "SOL"],
    "Price": [62000.5, 3400.2, 145.1],
    "Signal": ["Buy", "Hold", "Buy"]
}

mt.inspect(data)

4. 3D NumPy Tensor

import numpy as np

# Shape: (2 Tickers, 100 Days, 5 Features)
tensor_data = np.random.randn(2, 100, 5)

mt.inspect(tensor_data)

5. Auto‑Loading Files

mt.inspect("historical_prices.csv")

6. JSON API Responses

json_response = '{"Symbol": ["AAPL", "TSLA"], "Price": [150.2, 700.5]}'

mt.inspect(json_response)

⚙️ Parameters

Parameter Type Default Description


df Any Required Data object, file path, or JSON string count int 3 Rows shown from top & bottom silent bool False Hide headers and show only table


📦 Installation

Clone:

git clone https://github.com/yourusername/mtrader_lib.git

Install dependencies:

pip install pandas numpy openpyxl

⭐ Why mtrader

Financial datasets are often:

  • Large
  • Messy
  • Multi‑dimensional

mtrader provides instant visibility so you can:

  • Debug faster
  • Validate datasets
  • Build trading models quicker

📜 License

MIT License

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

mtrader-0.1.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

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

mtrader-0.1.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mtrader-0.1.0.tar.gz
Algorithm Hash digest
SHA256 81444c97caf6699ccc9e702a48120e7a2e2b1684249027ec82f5a9814ae5285c
MD5 475d145d5b7dc93b4aa887c80f724218
BLAKE2b-256 2bd76c7c747847148eb7b937a363d4901a3e751bb98319bd40515e089a4e3609

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for mtrader-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0e2e8563ce6f1f2f743b9c8d870c0fac593db518c22322965705205398b5a5e8
MD5 9b96eee535b7aa45c65fdfc70300c57d
BLAKE2b-256 d11fb22b737e33cc341d61b8cb6fc909211588ff981d0745792eae4a1758e22c

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