Metadata-Version: 2.4
Name: hodlvn
Version: 0.1.13
Summary: HODL Lab — indicators, strategies and portfolio backtests for Vietnamese stocks on HODL data (requires a Loyalty API key)
License: Proprietary
Project-URL: Homepage, https://hodl.vn/lab
Project-URL: Documentation, https://hodl.vn/lab/docs
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: pandas>=2.0
Requires-Dist: numpy>=1.24

# hodlvn — HODL Lab SDK

Write indicators, strategies and portfolio backtests for Vietnamese stocks on HODL data. This is the same core that runs in
the browser at [hodl.vn/lab](https://hodl.vn/lab), so SDK and web results match to the dong.

```bash
pip install hodlvn
export HODL_API_KEY=hodl_...        # create one at hodl.vn/tai-khoan/ket-noi-ai (Loyalty membership)
```

```python
import hodl
lab = hodl.Client()
res = lab.run('universe("HX-BANK")\nperiod("5Y")\nrebalance("M")\npick(top(momentum(63), 3))', kind="portfolio")
print(res["summary"])

res = lab.run('ticker("FPT")\nperiod("3Y")\nbuy(crossover(ema(close, 20), ema(close, 50)))\nsell(crossunder(ema(close, 20), ema(close, 50)))',
              kind="strategy")
```

Scripts declare their own symbol and range with `ticker("FPT")` and `period("5Y")` (`"1Y"`, `"3Y"`, `"5Y"`, `"10Y"`, `"max"`
or a date like `"2021-01-01"`); the `symbol` / `start` arguments of `run` override them. `kind="dca"` returns an
accumulation plan (`buy / every / period / months / skip_months`) — simulate it at [hodl.vn/tich-san](https://hodl.vn/tich-san).

Backtests apply Vietnamese market rules out of the box: 100-share lots, per-exchange ceiling / floor bands, T+2.5
settlement, 0.15% fees, 0.1% sell tax, cash dividends (5% tax) and bonus shares on their ex-dates, fills at the next
session's open after a signal, real prices.

Full guide: https://hodl.vn/lab/docs
