DhanHQ 3.0.1 → 3.2.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 +4 -4
- data/ARCHITECTURE.md +47 -1
- data/CHANGELOG.md +98 -0
- data/README.md +392 -6
- data/docs/AUTHENTICATION.md +3 -5
- data/docs/CONFIGURATION.md +3 -2
- data/docs/CONSTANTS_REFERENCE.md +8 -6
- data/docs/ENDPOINTS_AND_SANDBOX.md +1 -0
- data/docs/LIVE_ORDER_UPDATES.md +5 -10
- data/docs/RAILS_INTEGRATION.md +1 -1
- data/docs/RELEASE_GUIDE.md +13 -2
- data/docs/STANDALONE_RUBY_WEBSOCKET_INTEGRATION.md +2 -2
- data/docs/WEBSOCKET_INTEGRATION.md +13 -20
- data/docs/WEBSOCKET_PROTOCOL.md +7 -3
- data/exe/dhanhq-mcp +7 -0
- data/lib/DhanHQ/agent/key_coercion.rb +36 -0
- data/lib/DhanHQ/agent/tool.rb +37 -0
- data/lib/DhanHQ/agent/tool_catalogue.rb +180 -0
- data/lib/DhanHQ/agent/tool_handlers.rb +116 -0
- data/lib/DhanHQ/agent/tool_registry.rb +17 -212
- data/lib/DhanHQ/agent/tool_schemas.rb +160 -0
- data/lib/DhanHQ/client.rb +58 -2
- data/lib/DhanHQ/concerns/order_audit.rb +74 -1
- data/lib/DhanHQ/configuration.rb +70 -1
- data/lib/DhanHQ/constants.rb +104 -2
- data/lib/DhanHQ/contracts/expired_options_data_contract.rb +1 -9
- data/lib/DhanHQ/contracts/forever_order_contract.rb +1 -1
- data/lib/DhanHQ/contracts/global_stocks_estimator_contract.rb +28 -0
- data/lib/DhanHQ/contracts/global_stocks_modify_order_contract.rb +26 -0
- data/lib/DhanHQ/contracts/global_stocks_order_contract.rb +33 -0
- data/lib/DhanHQ/contracts/global_stocks_place_order_contract.rb +75 -0
- data/lib/DhanHQ/contracts/historical_data_contract.rb +1 -21
- data/lib/DhanHQ/contracts/iceberg_order_contract.rb +1 -1
- data/lib/DhanHQ/contracts/multi_order_contract.rb +74 -0
- data/lib/DhanHQ/contracts/place_order_contract.rb +1 -1
- data/lib/DhanHQ/contracts/trade_history_contract.rb +1 -8
- data/lib/DhanHQ/contracts/twap_order_contract.rb +1 -1
- data/lib/DhanHQ/dry_run/ledger.rb +71 -0
- data/lib/DhanHQ/dry_run/simulator.rb +140 -0
- data/lib/DhanHQ/helpers/attribute_helper.rb +23 -0
- data/lib/DhanHQ/mcp/server.rb +172 -9
- data/lib/DhanHQ/models/alert_order.rb +5 -2
- data/lib/DhanHQ/models/global_stocks/funds.rb +56 -0
- data/lib/DhanHQ/models/global_stocks/holding.rb +101 -0
- data/lib/DhanHQ/models/global_stocks/margin.rb +54 -0
- data/lib/DhanHQ/models/global_stocks/market_status.rb +63 -0
- data/lib/DhanHQ/models/global_stocks/order.rb +189 -0
- data/lib/DhanHQ/models/global_stocks/order_estimate.rb +61 -0
- data/lib/DhanHQ/models/global_stocks/trade.rb +74 -0
- data/lib/DhanHQ/models/instrument.rb +44 -14
- data/lib/DhanHQ/models/margin.rb +5 -1
- data/lib/DhanHQ/models/multi_order.rb +130 -0
- data/lib/DhanHQ/rate_limiter.rb +5 -3
- data/lib/DhanHQ/resources/alert_orders.rb +1 -0
- data/lib/DhanHQ/resources/forever_orders.rb +1 -0
- data/lib/DhanHQ/resources/global_stocks/funds.rb +25 -0
- data/lib/DhanHQ/resources/global_stocks/holdings.rb +22 -0
- data/lib/DhanHQ/resources/global_stocks/margin_calculator.rb +70 -0
- data/lib/DhanHQ/resources/global_stocks/market_status.rb +22 -0
- data/lib/DhanHQ/resources/global_stocks/orders.rb +112 -0
- data/lib/DhanHQ/resources/global_stocks/trades.rb +31 -0
- data/lib/DhanHQ/resources/iceberg_orders.rb +1 -0
- data/lib/DhanHQ/resources/multi_orders.rb +58 -0
- data/lib/DhanHQ/resources/orders.rb +2 -0
- data/lib/DhanHQ/resources/pnl_exit.rb +1 -0
- data/lib/DhanHQ/resources/super_orders.rb +1 -0
- data/lib/DhanHQ/resources/twap_orders.rb +1 -0
- data/lib/DhanHQ/risk/checks/concentration.rb +37 -0
- data/lib/DhanHQ/risk/checks/max_loss.rb +24 -0
- data/lib/DhanHQ/risk/checks/position_limits.rb +24 -0
- data/lib/DhanHQ/risk/pipeline.rb +8 -1
- data/lib/DhanHQ/skills/base.rb +54 -3
- data/lib/DhanHQ/skills/builtin/bear_call_spread.rb +87 -0
- data/lib/DhanHQ/skills/builtin/bull_put_spread.rb +87 -0
- data/lib/DhanHQ/skills/builtin/buy_atm_call.rb +10 -13
- data/lib/DhanHQ/skills/builtin/covered_call.rb +85 -0
- data/lib/DhanHQ/skills/builtin/iron_condor.rb +15 -19
- data/lib/DhanHQ/skills/builtin/market_data_summarizer.rb +195 -0
- data/lib/DhanHQ/skills/builtin/protective_put.rb +90 -0
- data/lib/DhanHQ/skills/builtin/square_off_all.rb +5 -8
- data/lib/DhanHQ/skills/builtin/square_off_position.rb +8 -6
- data/lib/DhanHQ/skills/builtin/straddle.rb +88 -0
- data/lib/DhanHQ/skills/builtin/strangle.rb +13 -13
- data/lib/DhanHQ/version.rb +1 -1
- data/lib/DhanHQ/write_paths.rb +57 -0
- data/lib/DhanHQ/ws/client.rb +117 -2
- data/lib/DhanHQ/ws/connection.rb +40 -11
- data/lib/DhanHQ/ws/sub_state.rb +14 -0
- data/lib/dhan_hq.rb +47 -0
- data/lib/dhanhq/analysis/options_buying_advisor.rb +11 -10
- metadata +41 -15
- data/.rspec +0 -3
- data/.rubocop.yml +0 -48
- data/.rubocop_todo.yml +0 -217
- data/AGENTS.md +0 -23
- data/CODE_OF_CONDUCT.md +0 -132
- data/Rakefile +0 -14
- data/TAGS +0 -10
- data/core +0 -0
- data/diagram.html +0 -184
- data/skills/dhanhq-ruby/SKILL.md +0 -74
- data/skills/dhanhq-ruby/references/market_data.md +0 -3
- data/skills/dhanhq-ruby/references/orders.md +0 -7
- data/watchlist.csv +0 -3
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.0
|
|
4
|
+
version: 3.2.0
|
|
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-
|
|
11
|
+
date: 2026-07-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -172,24 +172,16 @@ email:
|
|
|
172
172
|
- shubhamtaywade82@gmail.com
|
|
173
173
|
executables:
|
|
174
174
|
- DhanHQ
|
|
175
|
+
- dhanhq-mcp
|
|
175
176
|
extensions: []
|
|
176
177
|
extra_rdoc_files: []
|
|
177
178
|
files:
|
|
178
|
-
- ".rspec"
|
|
179
|
-
- ".rubocop.yml"
|
|
180
|
-
- ".rubocop_todo.yml"
|
|
181
|
-
- AGENTS.md
|
|
182
179
|
- ARCHITECTURE.md
|
|
183
180
|
- CHANGELOG.md
|
|
184
|
-
- CODE_OF_CONDUCT.md
|
|
185
181
|
- GUIDE.md
|
|
186
182
|
- LICENSE.txt
|
|
187
183
|
- README.md
|
|
188
|
-
- Rakefile
|
|
189
|
-
- TAGS
|
|
190
184
|
- config/initializers/order_update_hub.rb
|
|
191
|
-
- core
|
|
192
|
-
- diagram.html
|
|
193
185
|
- docs/API_DOCS_GAPS.md
|
|
194
186
|
- docs/API_VERIFICATION.md
|
|
195
187
|
- docs/AUTHENTICATION.md
|
|
@@ -216,11 +208,17 @@ files:
|
|
|
216
208
|
- docs/WEBSOCKET_PROTOCOL.md
|
|
217
209
|
- docs/architecture-overview.svg
|
|
218
210
|
- exe/DhanHQ
|
|
211
|
+
- exe/dhanhq-mcp
|
|
219
212
|
- lib/DhanHQ.rb
|
|
220
213
|
- lib/DhanHQ/agent.rb
|
|
214
|
+
- lib/DhanHQ/agent/key_coercion.rb
|
|
221
215
|
- lib/DhanHQ/agent/order_preview.rb
|
|
222
216
|
- lib/DhanHQ/agent/policy.rb
|
|
217
|
+
- lib/DhanHQ/agent/tool.rb
|
|
218
|
+
- lib/DhanHQ/agent/tool_catalogue.rb
|
|
219
|
+
- lib/DhanHQ/agent/tool_handlers.rb
|
|
223
220
|
- lib/DhanHQ/agent/tool_registry.rb
|
|
221
|
+
- lib/DhanHQ/agent/tool_schemas.rb
|
|
224
222
|
- lib/DhanHQ/ai.rb
|
|
225
223
|
- lib/DhanHQ/ai/context_builder.rb
|
|
226
224
|
- lib/DhanHQ/ai/prompt_helpers.rb
|
|
@@ -237,6 +235,10 @@ files:
|
|
|
237
235
|
- lib/DhanHQ/contracts/edis_contract.rb
|
|
238
236
|
- lib/DhanHQ/contracts/expired_options_data_contract.rb
|
|
239
237
|
- lib/DhanHQ/contracts/forever_order_contract.rb
|
|
238
|
+
- lib/DhanHQ/contracts/global_stocks_estimator_contract.rb
|
|
239
|
+
- lib/DhanHQ/contracts/global_stocks_modify_order_contract.rb
|
|
240
|
+
- lib/DhanHQ/contracts/global_stocks_order_contract.rb
|
|
241
|
+
- lib/DhanHQ/contracts/global_stocks_place_order_contract.rb
|
|
240
242
|
- lib/DhanHQ/contracts/historical_data_contract.rb
|
|
241
243
|
- lib/DhanHQ/contracts/iceberg_order_contract.rb
|
|
242
244
|
- lib/DhanHQ/contracts/instrument_list_contract.rb
|
|
@@ -244,6 +246,7 @@ files:
|
|
|
244
246
|
- lib/DhanHQ/contracts/margin_calculator_contract.rb
|
|
245
247
|
- lib/DhanHQ/contracts/market_feed_contract.rb
|
|
246
248
|
- lib/DhanHQ/contracts/modify_order_contract.rb
|
|
249
|
+
- lib/DhanHQ/contracts/multi_order_contract.rb
|
|
247
250
|
- lib/DhanHQ/contracts/multi_scrip_margin_calc_request_contract.rb
|
|
248
251
|
- lib/DhanHQ/contracts/option_chain_contract.rb
|
|
249
252
|
- lib/DhanHQ/contracts/order_contract.rb
|
|
@@ -261,6 +264,8 @@ files:
|
|
|
261
264
|
- lib/DhanHQ/core/base_model.rb
|
|
262
265
|
- lib/DhanHQ/core/base_resource.rb
|
|
263
266
|
- lib/DhanHQ/core/error_handler.rb
|
|
267
|
+
- lib/DhanHQ/dry_run/ledger.rb
|
|
268
|
+
- lib/DhanHQ/dry_run/simulator.rb
|
|
264
269
|
- lib/DhanHQ/error_object.rb
|
|
265
270
|
- lib/DhanHQ/errors.rb
|
|
266
271
|
- lib/DhanHQ/events.rb
|
|
@@ -286,6 +291,13 @@ files:
|
|
|
286
291
|
- lib/DhanHQ/models/expired_options_data.rb
|
|
287
292
|
- lib/DhanHQ/models/forever_order.rb
|
|
288
293
|
- lib/DhanHQ/models/funds.rb
|
|
294
|
+
- lib/DhanHQ/models/global_stocks/funds.rb
|
|
295
|
+
- lib/DhanHQ/models/global_stocks/holding.rb
|
|
296
|
+
- lib/DhanHQ/models/global_stocks/margin.rb
|
|
297
|
+
- lib/DhanHQ/models/global_stocks/market_status.rb
|
|
298
|
+
- lib/DhanHQ/models/global_stocks/order.rb
|
|
299
|
+
- lib/DhanHQ/models/global_stocks/order_estimate.rb
|
|
300
|
+
- lib/DhanHQ/models/global_stocks/trade.rb
|
|
289
301
|
- lib/DhanHQ/models/historical_data.rb
|
|
290
302
|
- lib/DhanHQ/models/holding.rb
|
|
291
303
|
- lib/DhanHQ/models/iceberg_order.rb
|
|
@@ -295,6 +307,7 @@ files:
|
|
|
295
307
|
- lib/DhanHQ/models/ledger_entry.rb
|
|
296
308
|
- lib/DhanHQ/models/margin.rb
|
|
297
309
|
- lib/DhanHQ/models/market_feed.rb
|
|
310
|
+
- lib/DhanHQ/models/multi_order.rb
|
|
298
311
|
- lib/DhanHQ/models/option_chain.rb
|
|
299
312
|
- lib/DhanHQ/models/order.rb
|
|
300
313
|
- lib/DhanHQ/models/order_update.rb
|
|
@@ -319,6 +332,12 @@ files:
|
|
|
319
332
|
- lib/DhanHQ/resources/expired_options_data.rb
|
|
320
333
|
- lib/DhanHQ/resources/forever_orders.rb
|
|
321
334
|
- lib/DhanHQ/resources/funds.rb
|
|
335
|
+
- lib/DhanHQ/resources/global_stocks/funds.rb
|
|
336
|
+
- lib/DhanHQ/resources/global_stocks/holdings.rb
|
|
337
|
+
- lib/DhanHQ/resources/global_stocks/margin_calculator.rb
|
|
338
|
+
- lib/DhanHQ/resources/global_stocks/market_status.rb
|
|
339
|
+
- lib/DhanHQ/resources/global_stocks/orders.rb
|
|
340
|
+
- lib/DhanHQ/resources/global_stocks/trades.rb
|
|
322
341
|
- lib/DhanHQ/resources/historical_data.rb
|
|
323
342
|
- lib/DhanHQ/resources/holdings.rb
|
|
324
343
|
- lib/DhanHQ/resources/iceberg_orders.rb
|
|
@@ -327,6 +346,7 @@ files:
|
|
|
327
346
|
- lib/DhanHQ/resources/kill_switch.rb
|
|
328
347
|
- lib/DhanHQ/resources/margin_calculator.rb
|
|
329
348
|
- lib/DhanHQ/resources/market_feed.rb
|
|
349
|
+
- lib/DhanHQ/resources/multi_orders.rb
|
|
330
350
|
- lib/DhanHQ/resources/option_chain.rb
|
|
331
351
|
- lib/DhanHQ/resources/orders.rb
|
|
332
352
|
- lib/DhanHQ/resources/pnl_exit.rb
|
|
@@ -339,19 +359,28 @@ files:
|
|
|
339
359
|
- lib/DhanHQ/resources/twap_orders.rb
|
|
340
360
|
- lib/DhanHQ/risk.rb
|
|
341
361
|
- lib/DhanHQ/risk/checks/asm_gsm.rb
|
|
362
|
+
- lib/DhanHQ/risk/checks/concentration.rb
|
|
342
363
|
- lib/DhanHQ/risk/checks/market_hours.rb
|
|
364
|
+
- lib/DhanHQ/risk/checks/max_loss.rb
|
|
343
365
|
- lib/DhanHQ/risk/checks/options.rb
|
|
344
366
|
- lib/DhanHQ/risk/checks/order_type.rb
|
|
367
|
+
- lib/DhanHQ/risk/checks/position_limits.rb
|
|
345
368
|
- lib/DhanHQ/risk/checks/product_support.rb
|
|
346
369
|
- lib/DhanHQ/risk/checks/quantity.rb
|
|
347
370
|
- lib/DhanHQ/risk/checks/trading_permission.rb
|
|
348
371
|
- lib/DhanHQ/risk/pipeline.rb
|
|
349
372
|
- lib/DhanHQ/skills.rb
|
|
350
373
|
- lib/DhanHQ/skills/base.rb
|
|
374
|
+
- lib/DhanHQ/skills/builtin/bear_call_spread.rb
|
|
375
|
+
- lib/DhanHQ/skills/builtin/bull_put_spread.rb
|
|
351
376
|
- lib/DhanHQ/skills/builtin/buy_atm_call.rb
|
|
377
|
+
- lib/DhanHQ/skills/builtin/covered_call.rb
|
|
352
378
|
- lib/DhanHQ/skills/builtin/iron_condor.rb
|
|
379
|
+
- lib/DhanHQ/skills/builtin/market_data_summarizer.rb
|
|
380
|
+
- lib/DhanHQ/skills/builtin/protective_put.rb
|
|
353
381
|
- lib/DhanHQ/skills/builtin/square_off_all.rb
|
|
354
382
|
- lib/DhanHQ/skills/builtin/square_off_position.rb
|
|
383
|
+
- lib/DhanHQ/skills/builtin/straddle.rb
|
|
355
384
|
- lib/DhanHQ/skills/builtin/strangle.rb
|
|
356
385
|
- lib/DhanHQ/skills/registry.rb
|
|
357
386
|
- lib/DhanHQ/skills/workflow.rb
|
|
@@ -359,6 +388,7 @@ files:
|
|
|
359
388
|
- lib/DhanHQ/strategy/base.rb
|
|
360
389
|
- lib/DhanHQ/utils/network_inspector.rb
|
|
361
390
|
- lib/DhanHQ/version.rb
|
|
391
|
+
- lib/DhanHQ/write_paths.rb
|
|
362
392
|
- lib/DhanHQ/ws.rb
|
|
363
393
|
- lib/DhanHQ/ws/base_connection.rb
|
|
364
394
|
- lib/DhanHQ/ws/client.rb
|
|
@@ -405,10 +435,6 @@ files:
|
|
|
405
435
|
- lib/ta/market_calendar.rb
|
|
406
436
|
- lib/ta/technical_analysis.rb
|
|
407
437
|
- sig/DhanHQ.rbs
|
|
408
|
-
- skills/dhanhq-ruby/SKILL.md
|
|
409
|
-
- skills/dhanhq-ruby/references/market_data.md
|
|
410
|
-
- skills/dhanhq-ruby/references/orders.md
|
|
411
|
-
- watchlist.csv
|
|
412
438
|
homepage: https://github.com/shubhamtaywade82/dhanhq-client
|
|
413
439
|
licenses:
|
|
414
440
|
- MIT
|
data/.rspec
DELETED
data/.rubocop.yml
DELETED
|
@@ -1,48 +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
|
-
|
|
15
|
-
Style/StringLiterals:
|
|
16
|
-
EnforcedStyle: double_quotes
|
|
17
|
-
|
|
18
|
-
Style/StringLiteralsInInterpolation:
|
|
19
|
-
EnforcedStyle: double_quotes
|
|
20
|
-
|
|
21
|
-
# RSpec
|
|
22
|
-
RSpec/MultipleExpectations:
|
|
23
|
-
Max: 5
|
|
24
|
-
|
|
25
|
-
RSpec/ExampleLength:
|
|
26
|
-
Max: 15
|
|
27
|
-
|
|
28
|
-
RSpec/MultipleMemoizedHelpers:
|
|
29
|
-
Max: 10
|
|
30
|
-
|
|
31
|
-
Lint/ScriptPermission:
|
|
32
|
-
Exclude:
|
|
33
|
-
- "bin/**/*"
|
|
34
|
-
|
|
35
|
-
Metrics/AbcSize:
|
|
36
|
-
Exclude:
|
|
37
|
-
- "bin/call_all_endpoints.rb"
|
|
38
|
-
|
|
39
|
-
Layout/LineLength:
|
|
40
|
-
Exclude:
|
|
41
|
-
- "bin/call_all_endpoints.rb"
|
|
42
|
-
|
|
43
|
-
DhanHQ/UseConstants:
|
|
44
|
-
Enabled: true
|
|
45
|
-
Exclude:
|
|
46
|
-
- "lib/DhanHQ/constants.rb"
|
|
47
|
-
- "lib/DhanHQ/ws/segments.rb"
|
|
48
|
-
- "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/AGENTS.md
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# AGENTS.md
|
|
2
|
-
|
|
3
|
-
## Cursor Cloud specific instructions
|
|
4
|
-
|
|
5
|
-
This is a pure-Ruby gem (no Rails, no running servers). Development commands are documented in `CLAUDE.md`.
|
|
6
|
-
|
|
7
|
-
### Quick reference
|
|
8
|
-
|
|
9
|
-
| Task | Command |
|
|
10
|
-
|------|---------|
|
|
11
|
-
| Install deps | `bundle install` |
|
|
12
|
-
| Tests | `bundle exec rspec` |
|
|
13
|
-
| Lint | `bundle exec rubocop` |
|
|
14
|
-
| Both | `bundle exec rake` |
|
|
15
|
-
| Single spec | `bundle exec rspec spec/path/to_spec.rb` |
|
|
16
|
-
|
|
17
|
-
### Non-obvious caveats
|
|
18
|
-
|
|
19
|
-
- **Bundler 4.x required**: The lockfile was bundled with Bundler 4.0.6. Install with `sudo gem install bundler -v 4.0.6` if missing.
|
|
20
|
-
- **`libyaml-dev` must be installed**: The `psych` gem (transitive dep) needs `yaml.h`. Without `libyaml-dev`, `bundle install` fails on native extension build.
|
|
21
|
-
- **`vendor/bundle` path**: Gems are installed to `./vendor/bundle` via `.bundle/config` to avoid needing root write access to `/var/lib/gems`.
|
|
22
|
-
- **No real API calls in tests**: All HTTP interactions are stubbed with WebMock/VCR. No `DHAN_CLIENT_ID` or `DHAN_ACCESS_TOKEN` secrets are needed to run the test suite.
|
|
23
|
-
- **No services to start**: This is a library gem. There is no web server, database, or background worker. Testing is purely `bundle exec rspec` / `bundle exec rubocop`.
|
data/CODE_OF_CONDUCT.md
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
|
2
|
-
|
|
3
|
-
## Our Pledge
|
|
4
|
-
|
|
5
|
-
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
-
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
-
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
-
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
-
nationality, personal appearance, race, caste, color, religion, or sexual
|
|
10
|
-
identity and orientation.
|
|
11
|
-
|
|
12
|
-
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
-
diverse, inclusive, and healthy community.
|
|
14
|
-
|
|
15
|
-
## Our Standards
|
|
16
|
-
|
|
17
|
-
Examples of behavior that contributes to a positive environment for our
|
|
18
|
-
community include:
|
|
19
|
-
|
|
20
|
-
* Demonstrating empathy and kindness toward other people
|
|
21
|
-
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
-
* Giving and gracefully accepting constructive feedback
|
|
23
|
-
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
-
and learning from the experience
|
|
25
|
-
* Focusing on what is best not just for us as individuals, but for the overall
|
|
26
|
-
community
|
|
27
|
-
|
|
28
|
-
Examples of unacceptable behavior include:
|
|
29
|
-
|
|
30
|
-
* The use of sexualized language or imagery, and sexual attention or advances of
|
|
31
|
-
any kind
|
|
32
|
-
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
-
* Public or private harassment
|
|
34
|
-
* Publishing others' private information, such as a physical or email address,
|
|
35
|
-
without their explicit permission
|
|
36
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
-
professional setting
|
|
38
|
-
|
|
39
|
-
## Enforcement Responsibilities
|
|
40
|
-
|
|
41
|
-
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
-
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
-
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
-
or harmful.
|
|
45
|
-
|
|
46
|
-
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
-
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
-
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
-
decisions when appropriate.
|
|
50
|
-
|
|
51
|
-
## Scope
|
|
52
|
-
|
|
53
|
-
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
-
an individual is officially representing the community in public spaces.
|
|
55
|
-
Examples of representing our community include using an official email address,
|
|
56
|
-
posting via an official social media account, or acting as an appointed
|
|
57
|
-
representative at an online or offline event.
|
|
58
|
-
|
|
59
|
-
## Enforcement
|
|
60
|
-
|
|
61
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
-
reported to the community leaders responsible for enforcement at
|
|
63
|
-
[INSERT CONTACT METHOD].
|
|
64
|
-
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
|
-
|
|
66
|
-
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
-
reporter of any incident.
|
|
68
|
-
|
|
69
|
-
## Enforcement Guidelines
|
|
70
|
-
|
|
71
|
-
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
-
the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
|
-
|
|
74
|
-
### 1. Correction
|
|
75
|
-
|
|
76
|
-
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
77
|
-
unprofessional or unwelcome in the community.
|
|
78
|
-
|
|
79
|
-
**Consequence**: A private, written warning from community leaders, providing
|
|
80
|
-
clarity around the nature of the violation and an explanation of why the
|
|
81
|
-
behavior was inappropriate. A public apology may be requested.
|
|
82
|
-
|
|
83
|
-
### 2. Warning
|
|
84
|
-
|
|
85
|
-
**Community Impact**: A violation through a single incident or series of
|
|
86
|
-
actions.
|
|
87
|
-
|
|
88
|
-
**Consequence**: A warning with consequences for continued behavior. No
|
|
89
|
-
interaction with the people involved, including unsolicited interaction with
|
|
90
|
-
those enforcing the Code of Conduct, for a specified period of time. This
|
|
91
|
-
includes avoiding interactions in community spaces as well as external channels
|
|
92
|
-
like social media. Violating these terms may lead to a temporary or permanent
|
|
93
|
-
ban.
|
|
94
|
-
|
|
95
|
-
### 3. Temporary Ban
|
|
96
|
-
|
|
97
|
-
**Community Impact**: A serious violation of community standards, including
|
|
98
|
-
sustained inappropriate behavior.
|
|
99
|
-
|
|
100
|
-
**Consequence**: A temporary ban from any sort of interaction or public
|
|
101
|
-
communication with the community for a specified period of time. No public or
|
|
102
|
-
private interaction with the people involved, including unsolicited interaction
|
|
103
|
-
with those enforcing the Code of Conduct, is allowed during this period.
|
|
104
|
-
Violating these terms may lead to a permanent ban.
|
|
105
|
-
|
|
106
|
-
### 4. Permanent Ban
|
|
107
|
-
|
|
108
|
-
**Community Impact**: Demonstrating a pattern of violation of community
|
|
109
|
-
standards, including sustained inappropriate behavior, harassment of an
|
|
110
|
-
individual, or aggression toward or disparagement of classes of individuals.
|
|
111
|
-
|
|
112
|
-
**Consequence**: A permanent ban from any sort of public interaction within the
|
|
113
|
-
community.
|
|
114
|
-
|
|
115
|
-
## Attribution
|
|
116
|
-
|
|
117
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
118
|
-
version 2.1, available at
|
|
119
|
-
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
120
|
-
|
|
121
|
-
Community Impact Guidelines were inspired by
|
|
122
|
-
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
123
|
-
|
|
124
|
-
For answers to common questions about this code of conduct, see the FAQ at
|
|
125
|
-
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
|
126
|
-
[https://www.contributor-covenant.org/translations][translations].
|
|
127
|
-
|
|
128
|
-
[homepage]: https://www.contributor-covenant.org
|
|
129
|
-
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
130
|
-
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
131
|
-
[FAQ]: https://www.contributor-covenant.org/faq
|
|
132
|
-
[translations]: https://www.contributor-covenant.org/translations
|
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
|