Metadata-Version: 2.4
Name: kite_order
Version: 0.1.3
Summary: A Python module for placing bracket orders with Zerodha's KiteConnect API, featuring authentication, dashboard, Google Sheets integration, and customizable logging.
Author: Prasad
Author-email: mr.xprasadx@gmail.com
License: MIT
Keywords: zerodha kiteconnect trading bracket-orders api google-sheets
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: kiteconnect>=3.0.0
Requires-Dist: gspread>=5.0.0
Requires-Dist: oauth2client>=4.0.0
Requires-Dist: colorama>=0.4.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: keywords
Dynamic: license
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# Kite Bracket Orders

A Python module for placing bracket orders with Zerodha's KiteConnect API. It includes features like automated authentication, a dashboard for viewing margins/holdings/positions/orders, Google Sheets integration for trade plans, customizable logging, and market hour checks with AMO (After Market Order) support.

## Features
- **Bracket Order Placement**: Place entry orders with target and stop-loss, including monitoring and modification.
- **Authentication**: Automatic login with dependency installation, config management, and session token handling.
- **Dashboard**: View account margins, holdings, positions, and recent orders in a clean terminal format.
- **Google Sheets Integration**: Load trade plans from a specified sheet for easy data-driven trading.
- **Logging Toggle**: Enable/disable logging to file with a simple flag (no impact on terminal output when disabled).
- **Market Checks**: Detects closed markets/weekends and prompts for AMO orders.


### Dependencies
- kiteconnect
- gspread
- oauth2client
- colorama

These are automatically installed via pip.

## Usage

1. **Setup Credentials**:
   - Create `credentials/config.json` with your Kite API details.
   - Create `credentials/credentials.json` with your Google Service Account key.

2. **Run the Script** (example in order.py):

        from kite_bracket_orders import BracketOrderPlacer, run_login, KiteDashboard
        # Define your order data here (edit as needed for easy order placement - used when choice "1" is selected)
        order_data = {
            "segment": "NSE",                  # "NSE" or "NFO"
            "product_type": "MIS",             # "MIS" or "CNC" or "NRML"
            "side": "SELL",                    # "BUY" or "SELL"
            "entry_order_type": "LIMIT",       # "LIMIT" or "MARKET"
            "sl_type": "SL-M",                 # choose: "SL" or "SL-M"

            "symbol": "IDEA",                  # e.g. "IDEA", "RELIANCE", or "NIFTY24JUL20000CE"
            "quantity": 1,                     # Must match lot size for options; 1+ for stocks
            "entry_price": 7.60,               # Only used if LIMIT order
            "target_price": 7.80,
            "stop_loss_trigger": 7.50,
            "stop_loss_limit": 0               # only used if SL (not SL-M)
        }
        if __name__ == "__main__":
            
            enable_logging = True  # Toggle logging

            run_login() # Handle authentication

            # Show dashboard
            dash = KiteDashboard()
            dash.show_all()

            # Proceed to bracket order
            placer = BracketOrderPlacer(code_data=order_data, enable_logging=enable_logging)  
            placer.load_kite_login_name_show()
            placer.place_bracket_order()


3. **Run**:
python order.py

## Configuration
- **config.json**: Stores Kite API_KEY and ACCESS_TOKEN.
- **credentials.json**: Google Sheets auth.
- **Logging**: Set `enable_logging=False` to disable log files.

## License
MIT License. See LICENSE for details.

## Contributing
Fork the repo and submit a pull request. Issues and feature requests are welcome!
