Metadata-Version: 2.4
Name: stocksimpy
Version: 0.1.0
Summary: A beginner-friendly library for stock market data, backtesting, and strategies.
Author: Suleyman Sade
License: MIT License
        
        Copyright (c) 2025 Suleyman Sade
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/SuleymanSade/stocksimpy
Project-URL: Documentation, https://stocksimpy.readthedocs.io/
Project-URL: Source, https://github.com/SuleymanSade/stocksimpy
Project-URL: Issues, https://github.com/SuleymanSade/stocksimpy/issues
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pandas>=1.5
Requires-Dist: numpy>=1.21
Requires-Dist: yfinance>=0.2
Requires-Dist: matplotlib>=3.5
Provides-Extra: dev
Requires-Dist: black; extra == "dev"
Requires-Dist: isort; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: sphinx; extra == "dev"
Requires-Dist: sphinx-rtd-theme; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Dynamic: license-file

# stocksimpy

#### Easy Python backtesting for stocks — fast and simple

stocksimpy lets you prototype trading ideas with minimal boilerplate. Everything is explicit — load data, define rules, run a backtest. No configuration sprawl, no hidden state, and no magic methods.. Perfect for beginners and anyone who wants results fast.

(Disclaimer: This is an early alpha, API might change in the future updates)

---

## 🎯 Quick Features

- Load stock prices from `yfinance` or your own database in seconds.
- Run fixed or dynamic backtests in just a few lines of code.
- Built-in example strategies like SMA/EMA crossover, RSI, and price action.
- Clear and simple design — no hidden magic, everything is easy to read.
- Beginner-friendly: start experimenting immediately.

---

## ⚡ [Quick Start](https://stocksimpy.readthedocs.io/en/latest/quick_start.html)

### 1. Install `stocksimpy` (and `yfinance` for convenient data input)

```bash
pip install stocksimpy yfinance
```

### 2. Imports

```python
from stocksimpy import StockData, Backtester, Visualize, Performance
```

### 3. Load Data

```python
# If you want to load your own data from .csv, .sqlite or similar, use appropriate functions built into `StockData()`
data = StockData().from_yfinance([your_stock_symbol], your_starting_date, your_end_date)
```

### 4. Define Your Strategy

```python
def sma_crossover(prices):
    short = prices["Close"].rolling(20).mean()
    long = prices["Close"].rolling(50).mean()

    # Buy when short crosses above long, sell when it crosses below
    signal = (short > long).astype(int)
    return signal
```

### 5. Run Backtest

```python
# You can use your own strategy or one of the built-in ones for testing (e.g. Strategy.rsi_momentum_fixed())
bt = Backtester('AAPL', data, sma_crossover)

# Depending on your strategy you may need to run bt.run_backtest_dynamic(), see more on the documentation
bt.run_backtest_fixed()
```

### 6. Evaluate the Results

```python
# View performance metrics like max drawdown and sharpe ratio
perf = Performance(bt)
print(perf.generate_risk_report())
```

### 7. Visualize

```python
# Visualize the graph
graph = Visualize(bt)
graph.visualize_backtest().show() # You can use .savefig(...) instead of .show() to record the graph in disk
```

And thats it, you just ran your first backtest 🚀

---

## 🤝 Contributions

Ideas, strategies, or improvements? We welcome all contributions! Check out [CONTRIBUTING.md](CONTRIBUTING.md) for a more detailed information about contributing
