DhanHQ 3.1.0 → 3.2.1

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.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/ARCHITECTURE.md +47 -1
  3. data/CHANGELOG.md +73 -0
  4. data/README.md +241 -3
  5. data/docs/AUTHENTICATION.md +3 -5
  6. data/docs/CONFIGURATION.md +3 -2
  7. data/docs/CONSTANTS_REFERENCE.md +5 -4
  8. data/docs/ENDPOINTS_AND_SANDBOX.md +1 -0
  9. data/docs/LIVE_ORDER_UPDATES.md +5 -10
  10. data/docs/RAILS_INTEGRATION.md +1 -1
  11. data/docs/RELEASE_GUIDE.md +13 -2
  12. data/docs/STANDALONE_RUBY_WEBSOCKET_INTEGRATION.md +2 -2
  13. data/docs/WEBSOCKET_INTEGRATION.md +13 -20
  14. data/docs/WEBSOCKET_PROTOCOL.md +7 -3
  15. data/lib/DhanHQ/agent/key_coercion.rb +36 -0
  16. data/lib/DhanHQ/agent/tool.rb +37 -0
  17. data/lib/DhanHQ/agent/tool_catalogue.rb +180 -0
  18. data/lib/DhanHQ/agent/tool_handlers.rb +116 -0
  19. data/lib/DhanHQ/agent/tool_registry.rb +17 -261
  20. data/lib/DhanHQ/agent/tool_schemas.rb +160 -0
  21. data/lib/DhanHQ/ai/prompt_helpers.rb +17 -7
  22. data/lib/DhanHQ/client.rb +105 -30
  23. data/lib/DhanHQ/concerns/order_audit.rb +35 -4
  24. data/lib/DhanHQ/configuration.rb +70 -1
  25. data/lib/DhanHQ/constants.rb +101 -0
  26. data/lib/DhanHQ/contracts/expired_options_data_contract.rb +1 -9
  27. data/lib/DhanHQ/contracts/global_stocks_estimator_contract.rb +28 -0
  28. data/lib/DhanHQ/contracts/global_stocks_modify_order_contract.rb +26 -0
  29. data/lib/DhanHQ/contracts/global_stocks_order_contract.rb +33 -0
  30. data/lib/DhanHQ/contracts/global_stocks_place_order_contract.rb +75 -0
  31. data/lib/DhanHQ/contracts/historical_data_contract.rb +1 -21
  32. data/lib/DhanHQ/contracts/multi_order_contract.rb +74 -0
  33. data/lib/DhanHQ/contracts/trade_history_contract.rb +1 -8
  34. data/lib/DhanHQ/dry_run/ledger.rb +71 -0
  35. data/lib/DhanHQ/dry_run/simulator.rb +140 -0
  36. data/lib/DhanHQ/helpers/attribute_helper.rb +23 -0
  37. data/lib/DhanHQ/models/alert_order.rb +6 -3
  38. data/lib/DhanHQ/models/global_stocks/funds.rb +56 -0
  39. data/lib/DhanHQ/models/global_stocks/holding.rb +101 -0
  40. data/lib/DhanHQ/models/global_stocks/margin.rb +54 -0
  41. data/lib/DhanHQ/models/global_stocks/market_status.rb +63 -0
  42. data/lib/DhanHQ/models/global_stocks/order.rb +189 -0
  43. data/lib/DhanHQ/models/global_stocks/order_estimate.rb +61 -0
  44. data/lib/DhanHQ/models/global_stocks/trade.rb +74 -0
  45. data/lib/DhanHQ/models/margin.rb +5 -1
  46. data/lib/DhanHQ/models/multi_order.rb +130 -0
  47. data/lib/DhanHQ/resources/global_stocks/funds.rb +25 -0
  48. data/lib/DhanHQ/resources/global_stocks/holdings.rb +22 -0
  49. data/lib/DhanHQ/resources/global_stocks/margin_calculator.rb +70 -0
  50. data/lib/DhanHQ/resources/global_stocks/market_status.rb +22 -0
  51. data/lib/DhanHQ/resources/global_stocks/orders.rb +112 -0
  52. data/lib/DhanHQ/resources/global_stocks/trades.rb +31 -0
  53. data/lib/DhanHQ/resources/multi_orders.rb +58 -0
  54. data/lib/DhanHQ/risk/pipeline.rb +0 -2
  55. data/lib/DhanHQ/version.rb +1 -1
  56. data/lib/DhanHQ/write_paths.rb +57 -0
  57. data/lib/DhanHQ/ws/client.rb +117 -2
  58. data/lib/DhanHQ/ws/connection.rb +40 -11
  59. data/lib/DhanHQ/ws/sub_state.rb +14 -0
  60. data/lib/dhan_hq.rb +4 -0
  61. data/lib/dhanhq/analysis/options_buying_advisor.rb +11 -10
  62. data/skills/dhanhq-ruby/SKILL.md +2 -1
  63. data/skills/dhanhq-ruby/examples/order_management.rb +7 -0
  64. data/skills/dhanhq-ruby/references/common-workflows.md +8 -8
  65. data/skills/dhanhq-ruby/references/instruments.md +7 -1
  66. data/skills/dhanhq-ruby/references/orders.md +2 -0
  67. metadata +30 -10
  68. data/.rspec +0 -3
  69. data/.rubocop.yml +0 -50
  70. data/.rubocop_todo.yml +0 -217
  71. data/Rakefile +0 -14
  72. data/TAGS +0 -10
  73. data/core +0 -0
  74. data/diagram.html +0 -184
  75. data/watchlist.csv +0 -3
@@ -100,13 +100,13 @@ module DhanHQ
100
100
  # Choose the nearest expiry (first element); adjust selection if API returns sorted differently
101
101
  expiry = expiries.first
102
102
  raw = DhanHQ::Models::OptionChain.fetch(underlying_scrip: sid.to_i, underlying_seg: seg, expiry: expiry)
103
- oc = raw[:oc] || {}
104
- # Transform OC structure into advisor-friendly array [{ strike:, ce: {...}, pe: {...} }]
105
- @data[:option_chain] = oc.map do |strike, strike_data|
103
+ strikes = raw[:strikes] || []
104
+ # Transform normalized strikes into advisor-friendly array [{ strike:, ce: {...}, pe: {...} }]
105
+ @data[:option_chain] = strikes.map do |entry|
106
106
  {
107
- strike: strike.to_f,
108
- ce: normalize_leg(strike_data["ce"] || {}),
109
- pe: normalize_leg(strike_data["pe"] || {})
107
+ strike: entry[:strike].to_f,
108
+ ce: normalize_leg(entry[:call] || {}),
109
+ pe: normalize_leg(entry[:put] || {})
110
110
  }
111
111
  end
112
112
  rescue StandardError
@@ -114,11 +114,12 @@ module DhanHQ
114
114
  end
115
115
 
116
116
  def normalize_leg(cepe)
117
+ greeks = cepe[:greeks] || {}
117
118
  {
118
- ltp: cepe["last_price"], bid: cepe["best_bid_price"], ask: cepe["best_ask_price"],
119
- iv: cepe["iv"], oi: cepe["oi"], volume: cepe["volume"],
120
- delta: cepe["delta"], gamma: cepe["gamma"], vega: cepe["vega"], theta: cepe["theta"],
121
- lot_size: cepe["lot_size"], tradable: true
119
+ ltp: cepe[:last_price], bid: cepe[:top_bid_price], ask: cepe[:top_ask_price],
120
+ iv: cepe[:implied_volatility], oi: cepe[:oi], volume: cepe[:volume],
121
+ delta: greeks[:delta], gamma: greeks[:gamma], vega: greeks[:vega], theta: greeks[:theta],
122
+ security_id: cepe[:security_id], tradable: true
122
123
  }
123
124
  end
124
125
 
@@ -104,7 +104,8 @@ Use constants from the `DhanHQ::Constants` module for segments, order types, val
104
104
  | Option chain | `DhanHQ::Models::OptionChain.fetch(params)` |
105
105
  | Expiry list | `DhanHQ::Models::OptionChain.fetch_expiry_list(params)` |
106
106
  | Search instruments | `DhanHQ::Models::Instrument.search(query, options)` |
107
- | Find specific instrument | `DhanHQ::Models::Instrument.find(exchange_segment, symbol, options)` |
107
+ | Find specific instrument by symbol | `DhanHQ::Models::Instrument.find(exchange_segment, symbol, options)` |
108
+ | Find specific instrument by security ID | `DhanHQ::Models::Instrument.find_by_security_id(exchange_segment, security_id)` |
108
109
  | Find instrument anywhere | `DhanHQ::Models::Instrument.find_anywhere(symbol, options)` |
109
110
  | Super orders | `DhanHQ::Models::SuperOrder.create(params)` |
110
111
  | Forever orders | `DhanHQ::Models::ForeverOrder.create(params)` |
@@ -27,6 +27,13 @@ if ENV["RUN_LIVE_EXAMPLE"] != "1"
27
27
  exit 0
28
28
  end
29
29
 
30
+ # The gem has its own independent safety gate: Order.place/modify/cancel raise
31
+ # DhanHQ::LiveTradingDisabledError unless ENV["LIVE_TRADING"]="true" is also set.
32
+ if ENV["LIVE_TRADING"] != "true"
33
+ puts "Also set ENV['LIVE_TRADING']='true' — the SDK blocks order placement without it."
34
+ exit 0
35
+ end
36
+
30
37
  # Step 1: Place a limit order (well below market for demo — won't fill)
31
38
  puts "Step 1: Placing limit buy order for RELIANCE..."
32
39
  order = DhanHQ::Models::Order.place(
@@ -23,20 +23,20 @@ end
23
23
 
24
24
  Use this flow for selling demat holdings:
25
25
  1. Fetch holdings and identify ISIN.
26
- 2. Generate TPIN: `DhanHQ::Models::EDIS.generate_tpin`
27
- 3. Open authorization form: `DhanHQ::Models::EDIS.open_browser_for_tpin(isin: "...", qty: 5, exchange: "NSE")`
28
- 4. Check inquiry: `DhanHQ::Models::EDIS.inquiry(isin: "...")`
26
+ 2. Generate TPIN: `DhanHQ::Models::Edis.generate_tpin`
27
+ 3. Generate the authorization form: `DhanHQ::Models::Edis.generate_form(isin: "...", qty: 5, exchange: "NSE", segment: "EQ")`
28
+ 4. Check status: `DhanHQ::Models::Edis.inquire(isin: "...")`
29
29
  5. Place the sell order.
30
30
 
31
31
  ```ruby
32
32
  # Generate TPIN
33
- DhanHQ::Models::EDIS.generate_tpin
33
+ DhanHQ::Models::Edis.generate_tpin
34
34
 
35
- # Open authorization portal
36
- DhanHQ::Models::EDIS.open_browser_for_tpin(isin: "INE002A01018", qty: 5, exchange: "NSE")
35
+ # Generate authorization form
36
+ DhanHQ::Models::Edis.generate_form(isin: "INE002A01018", qty: 5, exchange: "NSE", segment: "EQ")
37
37
 
38
- # Inquiry
39
- status = DhanHQ::Models::EDIS.inquiry(isin: "INE002A01018")
38
+ # Check status
39
+ status = DhanHQ::Models::Edis.inquire(isin: "INE002A01018")
40
40
  ```
41
41
 
42
42
  ## Single-Leg F&O Execution
@@ -39,9 +39,13 @@ Official instrument sources (managed by the SDK internally):
39
39
  Use the SDK's built-in helper methods on the `Instrument` class:
40
40
 
41
41
  ```ruby
42
- # Find specific instrument in a segment (exact match)
42
+ # Find specific instrument in a segment by symbol name (exact match)
43
43
  inst = DhanHQ::Models::Instrument.find("NSE_EQ", "RELIANCE")
44
44
 
45
+ # Find by security ID instead of symbol name — use this, not `.find`, when you
46
+ # already have a security_id (e.g. from an order, position, or option chain leg)
47
+ inst = DhanHQ::Models::Instrument.find_by_security_id("NSE_EQ", "2885")
48
+
45
49
  # Search across multiple segments (finds any match)
46
50
  inst = DhanHQ::Models::Instrument.find_anywhere("RELIANCE")
47
51
 
@@ -49,6 +53,8 @@ inst = DhanHQ::Models::Instrument.find_anywhere("RELIANCE")
49
53
  results = DhanHQ::Models::Instrument.search("RELIANCE")
50
54
  ```
51
55
 
56
+ `.find`'s second argument is always a **symbol name**, never a security ID — passing a security ID there silently returns `nil` (it searches symbol/underlying-symbol text, doesn't match on ID). Use `.find_by_security_id` when resolving by ID.
57
+
52
58
  Or leverage the helper layer in `scripts/dhan_helpers.rb`:
53
59
 
54
60
  ```ruby
@@ -3,6 +3,8 @@
3
3
  Critical API rules:
4
4
  - Order placement, modification, cancellation, super orders, and forever orders require static IP whitelisting.
5
5
  - Dhan's current order docs say API market orders are converted to limit orders with MPP.
6
+ - **`ENV["LIVE_TRADING"]="true"` is required for `place`/`create`/`modify`/`cancel` to actually submit anything** — the gem raises `DhanHQ::LiveTradingDisabledError` otherwise, as a safety gate against accidental order placement from a dev machine.
7
+ - **`correlation_id` must be 25 characters or fewer.** Dhan's real API rejects the entire order with a generic `DH-905` error if exceeded — it doesn't say which field was wrong.
6
8
 
7
9
  ## Regular Orders
8
10
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: DhanHQ
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shubham Taywade
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-07-20 00:00:00.000000000 Z
11
+ date: 2026-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -176,9 +176,6 @@ executables:
176
176
  extensions: []
177
177
  extra_rdoc_files: []
178
178
  files:
179
- - ".rspec"
180
- - ".rubocop.yml"
181
- - ".rubocop_todo.yml"
182
179
  - AGENTS.md
183
180
  - ARCHITECTURE.md
184
181
  - CHANGELOG.md
@@ -186,11 +183,7 @@ files:
186
183
  - GUIDE.md
187
184
  - LICENSE.txt
188
185
  - README.md
189
- - Rakefile
190
- - TAGS
191
186
  - config/initializers/order_update_hub.rb
192
- - core
193
- - diagram.html
194
187
  - docs/API_DOCS_GAPS.md
195
188
  - docs/API_VERIFICATION.md
196
189
  - docs/AUTHENTICATION.md
@@ -220,9 +213,14 @@ files:
220
213
  - exe/dhanhq-mcp
221
214
  - lib/DhanHQ.rb
222
215
  - lib/DhanHQ/agent.rb
216
+ - lib/DhanHQ/agent/key_coercion.rb
223
217
  - lib/DhanHQ/agent/order_preview.rb
224
218
  - lib/DhanHQ/agent/policy.rb
219
+ - lib/DhanHQ/agent/tool.rb
220
+ - lib/DhanHQ/agent/tool_catalogue.rb
221
+ - lib/DhanHQ/agent/tool_handlers.rb
225
222
  - lib/DhanHQ/agent/tool_registry.rb
223
+ - lib/DhanHQ/agent/tool_schemas.rb
226
224
  - lib/DhanHQ/ai.rb
227
225
  - lib/DhanHQ/ai/context_builder.rb
228
226
  - lib/DhanHQ/ai/prompt_helpers.rb
@@ -239,6 +237,10 @@ files:
239
237
  - lib/DhanHQ/contracts/edis_contract.rb
240
238
  - lib/DhanHQ/contracts/expired_options_data_contract.rb
241
239
  - lib/DhanHQ/contracts/forever_order_contract.rb
240
+ - lib/DhanHQ/contracts/global_stocks_estimator_contract.rb
241
+ - lib/DhanHQ/contracts/global_stocks_modify_order_contract.rb
242
+ - lib/DhanHQ/contracts/global_stocks_order_contract.rb
243
+ - lib/DhanHQ/contracts/global_stocks_place_order_contract.rb
242
244
  - lib/DhanHQ/contracts/historical_data_contract.rb
243
245
  - lib/DhanHQ/contracts/iceberg_order_contract.rb
244
246
  - lib/DhanHQ/contracts/instrument_list_contract.rb
@@ -246,6 +248,7 @@ files:
246
248
  - lib/DhanHQ/contracts/margin_calculator_contract.rb
247
249
  - lib/DhanHQ/contracts/market_feed_contract.rb
248
250
  - lib/DhanHQ/contracts/modify_order_contract.rb
251
+ - lib/DhanHQ/contracts/multi_order_contract.rb
249
252
  - lib/DhanHQ/contracts/multi_scrip_margin_calc_request_contract.rb
250
253
  - lib/DhanHQ/contracts/option_chain_contract.rb
251
254
  - lib/DhanHQ/contracts/order_contract.rb
@@ -263,6 +266,8 @@ files:
263
266
  - lib/DhanHQ/core/base_model.rb
264
267
  - lib/DhanHQ/core/base_resource.rb
265
268
  - lib/DhanHQ/core/error_handler.rb
269
+ - lib/DhanHQ/dry_run/ledger.rb
270
+ - lib/DhanHQ/dry_run/simulator.rb
266
271
  - lib/DhanHQ/error_object.rb
267
272
  - lib/DhanHQ/errors.rb
268
273
  - lib/DhanHQ/events.rb
@@ -288,6 +293,13 @@ files:
288
293
  - lib/DhanHQ/models/expired_options_data.rb
289
294
  - lib/DhanHQ/models/forever_order.rb
290
295
  - lib/DhanHQ/models/funds.rb
296
+ - lib/DhanHQ/models/global_stocks/funds.rb
297
+ - lib/DhanHQ/models/global_stocks/holding.rb
298
+ - lib/DhanHQ/models/global_stocks/margin.rb
299
+ - lib/DhanHQ/models/global_stocks/market_status.rb
300
+ - lib/DhanHQ/models/global_stocks/order.rb
301
+ - lib/DhanHQ/models/global_stocks/order_estimate.rb
302
+ - lib/DhanHQ/models/global_stocks/trade.rb
291
303
  - lib/DhanHQ/models/historical_data.rb
292
304
  - lib/DhanHQ/models/holding.rb
293
305
  - lib/DhanHQ/models/iceberg_order.rb
@@ -297,6 +309,7 @@ files:
297
309
  - lib/DhanHQ/models/ledger_entry.rb
298
310
  - lib/DhanHQ/models/margin.rb
299
311
  - lib/DhanHQ/models/market_feed.rb
312
+ - lib/DhanHQ/models/multi_order.rb
300
313
  - lib/DhanHQ/models/option_chain.rb
301
314
  - lib/DhanHQ/models/order.rb
302
315
  - lib/DhanHQ/models/order_update.rb
@@ -321,6 +334,12 @@ files:
321
334
  - lib/DhanHQ/resources/expired_options_data.rb
322
335
  - lib/DhanHQ/resources/forever_orders.rb
323
336
  - lib/DhanHQ/resources/funds.rb
337
+ - lib/DhanHQ/resources/global_stocks/funds.rb
338
+ - lib/DhanHQ/resources/global_stocks/holdings.rb
339
+ - lib/DhanHQ/resources/global_stocks/margin_calculator.rb
340
+ - lib/DhanHQ/resources/global_stocks/market_status.rb
341
+ - lib/DhanHQ/resources/global_stocks/orders.rb
342
+ - lib/DhanHQ/resources/global_stocks/trades.rb
324
343
  - lib/DhanHQ/resources/historical_data.rb
325
344
  - lib/DhanHQ/resources/holdings.rb
326
345
  - lib/DhanHQ/resources/iceberg_orders.rb
@@ -329,6 +348,7 @@ files:
329
348
  - lib/DhanHQ/resources/kill_switch.rb
330
349
  - lib/DhanHQ/resources/margin_calculator.rb
331
350
  - lib/DhanHQ/resources/market_feed.rb
351
+ - lib/DhanHQ/resources/multi_orders.rb
332
352
  - lib/DhanHQ/resources/option_chain.rb
333
353
  - lib/DhanHQ/resources/orders.rb
334
354
  - lib/DhanHQ/resources/pnl_exit.rb
@@ -370,6 +390,7 @@ files:
370
390
  - lib/DhanHQ/strategy/base.rb
371
391
  - lib/DhanHQ/utils/network_inspector.rb
372
392
  - lib/DhanHQ/version.rb
393
+ - lib/DhanHQ/write_paths.rb
373
394
  - lib/DhanHQ/ws.rb
374
395
  - lib/DhanHQ/ws/base_connection.rb
375
396
  - lib/DhanHQ/ws/client.rb
@@ -444,7 +465,6 @@ files:
444
465
  - skills/dhanhq-ruby/scripts/resolve_security.rb
445
466
  - skills/dhanhq-ruby/scripts/trade_logger.rb
446
467
  - skills/dhanhq-ruby/scripts/validate_order.rb
447
- - watchlist.csv
448
468
  homepage: https://github.com/shubhamtaywade82/dhanhq-client
449
469
  licenses:
450
470
  - MIT
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,50 +0,0 @@
1
- inherit_from: .rubocop_todo.yml
2
-
3
- plugins:
4
- - rubocop-rspec
5
- - rubocop-performance
6
-
7
- require:
8
- - rubocop-rake
9
- - ./lib/rubocop/cop/dhanhq/use_constants.rb
10
-
11
- AllCops:
12
- TargetRubyVersion: 3.2
13
- NewCops: enable
14
- Exclude:
15
- - "skills/**/*"
16
-
17
- Style/StringLiterals:
18
- EnforcedStyle: double_quotes
19
-
20
- Style/StringLiteralsInInterpolation:
21
- EnforcedStyle: double_quotes
22
-
23
- # RSpec
24
- RSpec/MultipleExpectations:
25
- Max: 5
26
-
27
- RSpec/ExampleLength:
28
- Max: 15
29
-
30
- RSpec/MultipleMemoizedHelpers:
31
- Max: 10
32
-
33
- Lint/ScriptPermission:
34
- Exclude:
35
- - "bin/**/*"
36
-
37
- Metrics/AbcSize:
38
- Exclude:
39
- - "bin/call_all_endpoints.rb"
40
-
41
- Layout/LineLength:
42
- Exclude:
43
- - "bin/call_all_endpoints.rb"
44
-
45
- DhanHQ/UseConstants:
46
- Enabled: true
47
- Exclude:
48
- - "lib/DhanHQ/constants.rb"
49
- - "lib/DhanHQ/ws/segments.rb"
50
- - "spec/**/*"
data/.rubocop_todo.yml DELETED
@@ -1,217 +0,0 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config --exclude-limit 9999`
3
- # on 2026-01-19 19:18:55 UTC using RuboCop version 1.82.1.
4
- # The point is for the user to remove these configuration records
5
- # one by one as the offenses are removed from the code base.
6
- # Note that changes in the inspected code, or installation of new
7
- # versions of RuboCop, may require this file to be generated again.
8
-
9
- # Offense count: 3
10
- # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
11
- Lint/DuplicateBranch:
12
- Exclude:
13
- - 'bin/ta_strategy.rb'
14
- - 'lib/DhanHQ/helpers/response_helper.rb'
15
- - 'lib/dhanhq/analysis/helpers/bias_aggregator.rb'
16
-
17
- # Offense count: 1
18
- # Configuration parameters: AllowComments, AllowEmptyLambdas.
19
- Lint/EmptyBlock:
20
- Exclude:
21
- - 'spec/support/script_data_helper.rb'
22
-
23
- # Offense count: 1
24
- # This cop supports safe autocorrection (--autocorrect).
25
- Lint/RedundantCopDisableDirective:
26
- Exclude:
27
- - 'spec/dhan_hq/models/order_spec.rb'
28
-
29
- # Offense count: 3
30
- # Configuration parameters: AllowComments, AllowNil.
31
- Lint/SuppressedException:
32
- Exclude:
33
- - 'lib/DhanHQ/ws/connection.rb'
34
- - 'lib/DhanHQ/ws/registry.rb'
35
-
36
- # Offense count: 72
37
- # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
38
- Metrics/AbcSize:
39
- Max: 100
40
-
41
- # Offense count: 2
42
- # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
43
- # AllowedMethods: refine
44
- Metrics/BlockLength:
45
- Max: 32
46
-
47
- # Offense count: 11
48
- # Configuration parameters: CountComments, CountAsOne.
49
- Metrics/ClassLength:
50
- Max: 631
51
-
52
- # Offense count: 40
53
- # Configuration parameters: AllowedMethods, AllowedPatterns.
54
- Metrics/CyclomaticComplexity:
55
- Max: 33
56
-
57
- # Offense count: 101
58
- # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
59
- Metrics/MethodLength:
60
- Max: 88
61
-
62
- # Offense count: 5
63
- # Configuration parameters: CountComments, CountAsOne.
64
- Metrics/ModuleLength:
65
- Max: 158
66
-
67
- # Offense count: 1
68
- # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
69
- Metrics/ParameterLists:
70
- Max: 7
71
-
72
- # Offense count: 31
73
- # Configuration parameters: AllowedMethods, AllowedPatterns.
74
- Metrics/PerceivedComplexity:
75
- Max: 28
76
-
77
- # Offense count: 5
78
- # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
79
- # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
80
- Naming/MethodParameterName:
81
- Exclude:
82
- - 'lib/DhanHQ/ws/base_connection.rb'
83
- - 'lib/DhanHQ/ws/connection.rb'
84
- - 'lib/DhanHQ/ws/orders/connection.rb'
85
-
86
- # Offense count: 7
87
- # Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
88
- # AllowedMethods: call
89
- # WaywardPredicates: nonzero?
90
- Naming/PredicateMethod:
91
- Exclude:
92
- - 'lib/DhanHQ/models/forever_order.rb'
93
- - 'lib/DhanHQ/models/iceberg_order.rb'
94
- - 'lib/DhanHQ/models/order.rb'
95
- - 'lib/DhanHQ/models/super_order.rb'
96
- - 'lib/DhanHQ/models/twap_order.rb'
97
- - 'lib/DhanHQ/ws/singleton_lock.rb'
98
-
99
- # Offense count: 13
100
- # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
101
- # SupportedStyles: snake_case, normalcase, non_integer
102
- # AllowedIdentifiers: TLS1_1, TLS1_2, capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
103
- Naming/VariableNumber:
104
- Exclude:
105
- - 'lib/DhanHQ/ws/base_connection.rb'
106
- - 'lib/DhanHQ/ws/connection.rb'
107
- - 'lib/DhanHQ/ws/market_depth/client.rb'
108
- - 'lib/DhanHQ/ws/orders/connection.rb'
109
-
110
- # Offense count: 1
111
- Naming/FileName:
112
- Exclude:
113
- - 'lib/DhanHQ.rb'
114
-
115
- # Offense count: 4
116
- # Configuration parameters: MinSize.
117
- Performance/CollectionLiteralInLoop:
118
- Exclude:
119
- - 'lib/DhanHQ/ws/base_connection.rb'
120
- - 'lib/dhanhq/analysis/multi_timeframe_analyzer.rb'
121
- - 'lib/ta/fetcher.rb'
122
-
123
- # Offense count: 1
124
- Performance/MapMethodChain:
125
- Exclude:
126
- - 'lib/DhanHQ/ws/market_depth/client.rb'
127
-
128
- # Offense count: 1
129
- RSpec/BeforeAfterAll:
130
- Exclude:
131
- - '**/spec/spec_helper.rb'
132
- - '**/spec/rails_helper.rb'
133
- - '**/spec/support/**/*.rb'
134
- - 'spec/dhan_hq/configuration_spec.rb'
135
-
136
- # Offense count: 4
137
- # Configuration parameters: AssignmentOnly.
138
- RSpec/InstanceVariable:
139
- Exclude:
140
- - 'spec/dhan_hq/configuration_spec.rb'
141
-
142
- # Offense count: 6
143
- # Configuration parameters: EnforcedStyle.
144
- # SupportedStyles: have_received, receive
145
- RSpec/MessageSpies:
146
- Exclude:
147
- - 'spec/dhan_hq/base_model_spec.rb'
148
- - 'spec/dhan_hq/helpers/response_helper_spec.rb'
149
- - 'spec/dhan_hq/ws/orders/client_spec.rb'
150
-
151
- # Offense count: 2
152
- RSpec/RepeatedExample:
153
- Exclude:
154
- - 'spec/dhan_hq/contracts/expired_options_data_contract_spec.rb'
155
-
156
- # Offense count: 1
157
- # Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
158
- # SupportedInflectors: default, active_support
159
- RSpec/SpecFilePathFormat:
160
- Exclude:
161
- - '**/spec/routing/**/*'
162
- - 'spec/dhan_hq/helpers/response_helper_spec.rb'
163
-
164
- # Offense count: 1
165
- # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
166
- RSpec/VerifiedDoubles:
167
- Exclude:
168
- - 'spec/dhan_hq/ws/orders/client_spec.rb'
169
-
170
- # Offense count: 3
171
- # Configuration parameters: AllowedConstants.
172
- Style/Documentation:
173
- Exclude:
174
- - 'spec/**/*'
175
- - 'test/**/*'
176
- - 'bin/comprehensive_test.rb'
177
- - 'bin/test_helpers.rb'
178
- - 'lib/DhanHQ/ws/market_depth.rb'
179
-
180
- # Offense count: 1
181
- # This cop supports safe autocorrection (--autocorrect).
182
- # Configuration parameters: EnforcedStyle, AllowComments.
183
- # SupportedStyles: empty, nil, both
184
- Style/EmptyElse:
185
- Exclude:
186
- - 'lib/DhanHQ/ws/market_depth/decoder.rb'
187
-
188
- # Offense count: 30
189
- # This cop supports safe autocorrection (--autocorrect).
190
- Style/IfUnlessModifier:
191
- Exclude:
192
- - 'bin/ta_strategy.rb'
193
- - 'lib/DhanHQ/contracts/order_contract.rb'
194
- - 'lib/DhanHQ/contracts/place_order_contract.rb'
195
- - 'lib/DhanHQ/contracts/slice_order_contract.rb'
196
- - 'lib/DhanHQ/helpers/response_helper.rb'
197
- - 'lib/DhanHQ/models/expired_options_data.rb'
198
- - 'lib/DhanHQ/models/funds.rb'
199
- - 'lib/DhanHQ/models/trade.rb'
200
- - 'lib/DhanHQ/rate_limiter.rb'
201
- - 'lib/DhanHQ/ws/orders/client.rb'
202
- - 'lib/dhanhq/analysis/options_buying_advisor.rb'
203
- - 'lib/ta/indicators.rb'
204
- - 'spec/spec_helper.rb'
205
-
206
- # Offense count: 1
207
- # Configuration parameters: Max.
208
- Style/SafeNavigationChainLength:
209
- Exclude:
210
- - 'lib/DhanHQ/ws/market_depth/client.rb'
211
-
212
- # Offense count: 31
213
- # This cop supports safe autocorrection (--autocorrect).
214
- # Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
215
- # URISchemes: http, https
216
- Layout/LineLength:
217
- Max: 181
data/Rakefile DELETED
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- require "rspec/core/rake_task"
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- require "rubocop/rake_task"
9
-
10
- # Single RuboCop task; the gem also registers rubocop:autocorrect and rubocop:autocorrect_all.
11
- desc "Run RuboCop"
12
- RuboCop::RakeTask.new(:rubocop)
13
-
14
- task default: %i[spec rubocop]
data/TAGS DELETED
@@ -1,10 +0,0 @@
1
-
2
- lib/DhanHQ/version.rb,97
3
- module DhanHQDhanHQ3,0
4
- VERSION = "0.1.0"VERSION4,0
5
- VERSION = "0.1.0"DhanHQ::VERSION4,0
6
-
7
- lib/DhanHQ.rb,123
8
- module DhanHQDhanHQ5,0
9
- class Error < StandardError; endError6,0
10
- class Error < StandardError; endDhanHQ::Error6,0
data/core DELETED
Binary file