Metadata-Version: 2.1
Name: Tradehull-Delta-Exchange
Version: 0.0.5
Summary: TradeHull Delta Exchange API wrapper for market data, option chain, and order placement.
Author: TradeHull, Jigyanshu Sharma
Maintainer: Jigyanshu Sharma
License: MIT
Project-URL: Homepage, https://tradehull.com
Project-URL: Documentation, https://tradehull.com
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Topic :: Office/Business :: Financial
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: aiohttp
Requires-Dist: pandas
Requires-Dist: requests

# Tradehull Delta Exchange

Tradehull Delta Exchange is a Python wrapper for Delta Exchange India API.

It supports market data, LTP, OHLC historical candles, option-chain data, account information, wallet balance, open positions, order placement, bracket orders, order cancellation, and position closing.

## Installation from TestPyPI

For testing installation from TestPyPI, use:

```bash
python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple Tradehull-Delta-Exchange==0.0.5
```

Note: `--extra-index-url https://pypi.org/simple` is required because dependencies like `aiohttp`, `pandas`, and `requests` are downloaded from real PyPI.


## Upgrade

```bash
pip install --upgrade Tradehull-Delta-Exchange
```

## Import

```python
from tradehull_delta_exchange import Tradehull
```

## Authentication

```python
from tradehull_delta_exchange import Tradehull

api_key = "YOUR_API_KEY"
api_secret = "YOUR_API_SECRET"

tdx = Tradehull(
    api_key=api_key,
    api_secret=api_secret
)
```

You can also use environment variables:

```bash
set DELTA_API_KEY=YOUR_API_KEY
set DELTA_API_SECRET=YOUR_API_SECRET
```

Then:

```python
from tradehull_delta_exchange import Tradehull

tdx = Tradehull()
```

## Get LTP

```python
from tradehull_delta_exchange import Tradehull

tdx = Tradehull(
    api_key="YOUR_API_KEY",
    api_secret="YOUR_API_SECRET"
)

ltp = tdx.get_ltp("BTCUSD")
print(ltp)
```

## Get Full Quote

```python
quote = tdx.get_quote("BTCUSD")
print(quote)
```

## Get OHLC Historical Data

```python
df = tdx.get_chart(
    name="BTCUSD",
    timeframe="15minute",
    days=7
)

print(df.tail())
```

Supported timeframe examples:

```text
1minute
3minute
5minute
15minute
30minute
60minute
day
week
```

## Get Option Chain

```python
option_chain = tdx.get_option_chain(
    underlying="BTC",
    expiry_date=0,
    limit=20,
    view="broker"
)

print(option_chain)
```

## Get Call Option Chain

```python
call_df = tdx.get_option_chain(
    underlying="BTC",
    expiry_date=0,
    limit=20,
    view="call"
)

print(call_df)
```

## Get Put Option Chain

```python
put_df = tdx.get_option_chain(
    underlying="BTC",
    expiry_date=0,
    limit=20,
    view="put"
)

print(put_df)
```

## Get Combined Option Chain

```python
combined_df = tdx.get_option_chain(
    underlying="BTC",
    expiry_date=0,
    limit=20,
    view="combine"
)

print(combined_df)
```

## Get ATM Option Name

```python
option_name = tdx.get_option_name(
    symbolname="BTC",
    moneyness=0,
    right="CE",
    expiry=0
)

print(option_name)
```

## Get ITM Option

```python
itm_option = tdx.get_itm_option(
    underlying="BTC",
    itm_level=1,
    expiry_date=0
)

print(itm_option)
```

## Account Information

```python
profile = tdx.get_profile()
print(profile)

wallet = tdx.get_wallet_balance()
print(wallet)

positions = tdx.get_open_positions()
print(positions)
```

## Place Market Order

Live order placement is disabled by default in the safe wrapper.

To place a real order, you must intentionally pass:

Example:

```python
order = tdx.place_order(
    symbol="BTCUSD",
    side="buy",
    order_type="market_order",
    quantity=1,price=None)

print(order)
```

## Place Bracket Order

```python
result = tdx.place_bracket_order(
    symbol="BTCUSD",
    side="buy",
    quantity=1,
    entry_price=None,
    target_price=72000,
    sl_price=61000,
    sl_limit_price=60950,
    target_limit_price=72000
)

print(result)
```

## Cancel Order

```python

cancel_status = tdx.cancel_order(
    order_id=123456,
    product_id=27,
)

print(cancel_status)
```


## Close All Orders and Positions

```python
result = tdx.close_all_orders()

print(result)
```

## Safety Warning

This package can place real orders on Delta Exchange.

Use live trading functions carefully.

Always test with small quantity first.

Do not publish your API key or API secret in code, GitHub, PyPI, screenshots, or shared files.

## Main Features

* Get LTP
* Get full quote
* Get OHLC historical candles
* Get option chain
* Get call option chain
* Get put option chain
* Get combined option chain
* Get ATM option
* Get ITM option
* Get profile
* Get wallet balance
* Get open positions
* Place plain order
* Place bracket order
* Cancel order
* Cancel all orders
* Close open position
* Close all orders and positions

## Basic Usage

```python
from tradehull_delta_exchange import Tradehull

tdx = Tradehull(
    api_key="YOUR_API_KEY",
    api_secret="YOUR_API_SECRET"
)

ltp = tdx.get_ltp("BTCUSD")
print("BTCUSD LTP:", ltp)
```

## License

MIT License
