DhanHQ 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b583e87aa598f3891e937f44859f9b451fc8f6bcec7a304cc0c33790fe9117ea
4
- data.tar.gz: 1a090fa608fba141da311ba8aaf21d36e750f78e90497f728c5f96d580044c7e
3
+ metadata.gz: 77553eb49e2a23ec764bc3baeebd5426f60054fbdbc4eb4c7c49d7f2c7e87515
4
+ data.tar.gz: 9fc44cb543abbc725cdee1489c66a08bd5d2615772640b454e46d54fb7b139f3
5
5
  SHA512:
6
- metadata.gz: '0966f2a2aa331b675ecc1675510f6ad3dca6b7a987c8dde15dde2efe506ac659157b6e0979d0c23f480d2835fa603bfd37530f33275d422226abb2419e46bfd0'
7
- data.tar.gz: 74ea10d0744fb01324afd4a1768fa6969b07f4d1fcb9da94d7a6caf01fd01c2863d6a3746d288628d10e497bd55c68687e0b54e237bd91736ad4bb8c1decc9f8
6
+ metadata.gz: 47344dfbf5aba9b0c48e05937e3d9ff28d7a43db87442d1e695b84477568d5df02e83c918e884000751f094996e43984000b8f4c32bec235313f64673756b176
7
+ data.tar.gz: f68c7be56db1807c284e01007cf0003f8519f92d57209d4073686f84e35d36db06e36f151c8b3b3df5dbae59bc272010c7e3ce4898e5a23eeddb5d6162f10b2c
data/CHANGELOG.md CHANGED
@@ -1,4 +1,36 @@
1
- ## [Unreleased]
1
+ ## [2.5.0] - 2026-02-21
2
+
3
+ ### Added
4
+
5
+ #### New Endpoints — Full Dhan API v2 Parity
6
+ - **Exit All Positions**: `DhanHQ::Models::Position.exit_all!` — emergency closure of all positions and cancellation of all open orders via `DELETE /v2/positions`. Resource method: `DhanHQ::Resources::Positions#exit_all`.
7
+ - **Kill Switch Status**: `DhanHQ::Models::KillSwitch.status` — query current kill switch state via `GET /v2/killswitch`. Resource method: `DhanHQ::Resources::KillSwitch#status`.
8
+ - **P&L Based Exit**: New `DhanHQ::Models::PnlExit` model and `DhanHQ::Resources::PnlExit` resource for automatic profit/loss-based position exit:
9
+ - `PnlExit.configure(profit_value:, loss_value:, product_type:, enable_kill_switch:)` — `POST /v2/pnlExit`
10
+ - `PnlExit.stop` — `DELETE /v2/pnlExit`
11
+ - `PnlExit.status` — `GET /v2/pnlExit`
12
+ - **Multi-Order Margin Calculator**: `DhanHQ::Models::Margin.calculate_multi` — batch margin calculation with hedge benefit across multiple instruments via `POST /v2/margincalculator/multi`. Resource method: `DhanHQ::Resources::MarginCalculator#calculate_multi`.
13
+ - **EDIS Model**: New `DhanHQ::Models::Edis` wrapping existing `DhanHQ::Resources::Edis` with ORM-style class methods:
14
+ - `Edis.generate_tpin`, `Edis.generate_form`, `Edis.generate_bulk_form`, `Edis.inquire`
15
+ - **Postback Payload Parser**: New `DhanHQ::Models::Postback` utility model for parsing Dhan webhook payloads:
16
+ - `Postback.parse(json_or_hash)` — accepts JSON string or Hash
17
+ - Status predicates: `traded?`, `rejected?`, `pending?`, `cancelled?`
18
+ - **AlertOrder Modify**: Explicit `DhanHQ::Models::AlertOrder.modify(alert_id, params)` class method for updating conditional triggers with better discoverability.
19
+
20
+ #### Tests
21
+ - **28 new specs** across 7 files (442 total, 0 failures):
22
+ - `spec/dhan_hq/models/pnl_exit_spec.rb` — configure, stop, status, defaults, nil handling
23
+ - `spec/dhan_hq/models/edis_spec.rb` — generate_tpin, generate_form, bulk_form, inquire
24
+ - `spec/dhan_hq/models/postback_spec.rb` — JSON/Hash parsing, snake_case support, status predicates
25
+ - Updated: `kill_switch_spec.rb`, `positions_spec.rb`, `margin_spec.rb`, `alert_order_spec.rb`
26
+
27
+ ### Changed
28
+ - **README.md**: Updated Key Features to reflect full API v2 parity including P&L Exit, Postback parser, and EDIS model.
29
+ - **Bundler**: Updated `BUNDLED WITH` to latest version, eliminating platform constant re-definition warnings.
30
+
31
+ ### Notes
32
+ - **Backward Compatible**: All changes are additive — no existing APIs or method signatures changed.
33
+ - **Full API v2 Parity**: The gem now covers every endpoint documented at [dhanhq.co/docs/v2](https://dhanhq.co/docs/v2/).
2
34
 
3
35
  ---
4
36