semvec/pypi-packages huggingface dataset:
anomalyarmor-cli 0.2.1
AnomalyArmor SDK and CLI for data observability
Requires Python: >=3.9
Keywords: cli, data-observability, data-quality, monitoring, sdk

# AnomalyArmor Python SDK

Python SDK and CLI for AnomalyArmor data observability platform.

## Installation

```bash
pip install anomalyarmor-cli
```

## Quick Start

```python
from anomalyarmor import Client

client = Client(
    api_key="your-api-key",
    api_url="https://api.anomalyarmor.com"
)

# List assets
assets = client.assets.list()
```

## CLI Usage

```bash
# Configure credentials
anomalyarmor auth login

# List assets
anomalyarmor assets list

# Check freshness
anomalyarmor freshness summary
```

## Data Quality

### Metrics

Track quantitative metrics like row counts, null percentages, and distinct counts.

```python
# Get metrics summary
summary = client.metrics.summary("asset-uuid")
print(f"Active metrics: {summary.active_metrics}")

# Create a row count metric
metric = client.metrics.create(
    "asset-uuid",
    metric_type="row_count",
    table_path="catalog.schema.orders",
)

# Trigger capture
client.metrics.capture("asset-uuid", metric.id)
```

CLI:
```bash
anomalyarmor metrics summary <asset-uuid>
anomalyarmor metrics list <asset-uuid>
anomalyarmor metrics capture <asset-uuid> <metric-uuid>
```

### Validity Rules

Define and monitor data quality rules like NOT_NULL, UNIQUE, REGEX, and RANGE checks.

```python
# Get validity summary
summary = client.validity.summary("asset-uuid")
print(f"Failing rules: {summary.failing_rules}")

# Create a NOT NULL rule
rule = client.validity.create(
    "asset-uuid",
    rule_type="NOT_NULL",
    table_path="catalog.schema.orders",
    column_name="order_id",
    severity="critical",
)

# Run a check
result = client.validity.check("asset-uuid", rule.id)
print(f"Status: {result.status}, Invalid: {result.invalid_count}")
```

CLI:
```bash
anomalyarmor validity summary <asset-uuid>
anomalyarmor validity list <asset-uuid>
anomalyarmor validity check <asset-uuid> <rule-uuid>
```

### Referential Integrity

Monitor foreign key relationships and detect orphan records.

```python
# List referential checks
checks = client.referential.list("asset-uuid")

# Create a referential check
check = client.referential.create(
    "asset-uuid",
    child_table_path="catalog.schema.orders",
    child_column_name="customer_id",
    parent_table_path="catalog.schema.customers",
    parent_column_name="id",
)

# Execute check
result = client.referential.execute("asset-uuid", check.id)
print(f"Orphan count: {result.orphan_count}")
```

CLI:
```bash
anomalyarmor referential list <asset-uuid>
anomalyarmor referential execute <asset-uuid> <check-uuid>
```

## Documentation

See [docs.anomalyarmor.com](https://docs.anomalyarmor.com) for full documentation.
ncBacktester 0.1.1
A simple backtesting engine for trading strategies
Requires Python: >=3.8
Keywords: backtesting, trading, finance, strategy, quantitative

## ncBacktester

ncBacktester is a small, opinionated Python package for backtesting simple long-only strategies driven by a `Hold_Signal` column on OHLCV data. It is designed for clarity and education rather than exhaustive feature coverage.

**Quick summary:** feed time-series OHLCV data with a `Hold_Signal` (1 = hold, 0 = not hold), instantiate `Backtest`, call `.run()` and examine metrics and plots.

**Install (development)**

```bash
pip install ncBacktester
```

**Minimal Quick Start**

```python
import pandas as pd
from ncBacktester.backtest import Backtest

# data must include: Open, High, Low, Close, Volume, Hold_Signal
data = pd.read_csv('your_data.csv', parse_dates=['Date'], index_col='Date')

bt = Backtest(data=data, initial_capital=10000.0, stop_loss_pct=0.05, commission=0.001)
results = bt.run()

print(results['metrics'])          # key performance metrics
results['equity_curve'].plot()     # equity curve
bt.plot(save_path='backtest.png')  # static plots
```

**Required data format**
- Columns: `Open`, `High`, `Low`, `Close`, `Volume`, `Hold_Signal`.
- `Hold_Signal` should be 0 or 1; changes 0→1 trigger buys, 1→0 trigger sells.

**Main components**
- `Backtest` ([ncBacktester/ncBacktester/backtest.py](ncBacktester/ncBacktester/backtest.py)): orchestrates the workflow — validate data, initialize components, execute strategy, compute metrics, and prepare plots.
- `StrategyExecutor` ([ncBacktester/ncBacktester/strategy_executor.py](ncBacktester/ncBacktester/strategy_executor.py)): implements trade sizing and execution logic (uses `Close` prices and accounts for `commission`).
- `MetricsCalculator` ([ncBacktester/ncBacktester/metrics.py](ncBacktester/ncBacktester/metrics.py)): computes performance statistics (Sharpe, Sortino, CAGR, drawdowns, etc.) from trades and the equity curve.
- `StopLossManager` ([ncBacktester/ncBacktester/stop_loss.py](ncBacktester/ncBacktester/stop_loss.py)): supports fixed and trailing stop loss behaviour during the backtest.
- `Plotter` ([ncBacktester/ncBacktester/plotter.py](ncBacktester/ncBacktester/plotter.py)): generates static plots showing price, trades, equity curve and drawdowns.

**Behavior & assumptions**
- Buys and sells are executed at the bar `Close` where the `Hold_Signal` changes.
- On a buy the framework purchases as many shares as possible with available capital; on sell it liquidates the full position.
- Stop loss (fixed or trailing) is optional and configured via `Backtest(stop_loss_pct=..., trailing_stop_pct=...)`.

**Advanced usage**
- If you want to reuse `StrategyExecutor` or `StopLossManager` directly, import them from their modules and instantiate with the same parameters used by `Backtest`.



**Contributing & license**
- This project is intended for learning; contributions and issues are welcome.
- Licensed under the MIT License.