Class: DhanHQ::Resources::MarketFeed

Inherits:
BaseAPI
  • Object
show all
Defined in:
lib/DhanHQ/resources/market_feed.rb

Overview

Resource client for fetching on-demand market data snapshots.

Constant Summary collapse

API_TYPE =

Market feed requests hit the data API tier.

:data_api
HTTP_PATH =

Root path for market feed endpoints.

"/v2"

Instance Attribute Summary

Attributes inherited from BaseAPI

#client

Instance Method Summary collapse

Methods inherited from BaseAPI

#delete, #get, #initialize, #post, #put

Methods included from AttributeHelper

#camelize_keys, #inspect, #normalize_keys, #snake_case, #titleize_keys

Methods included from APIHelper

#handle_response

Constructor Details

This class inherits a constructor from DhanHQ::BaseAPI

Instance Method Details

#ltp(params) ⇒ HashWithIndifferentAccess

POST /v2/marketfeed/ltp Returns the LTP (Last Traded Price) of up to 1000 instruments.

Parameters:

  • params (Hash)

    Example: { "NSE_EQ": [11536, 3456], "NSE_FNO": [49081, 49082] }

Returns:

  • (HashWithIndifferentAccess)


22
23
24
# File 'lib/DhanHQ/resources/market_feed.rb', line 22

def ltp(params)
  post("/marketfeed/ltp", params: params)
end

#ohlc(params) ⇒ HashWithIndifferentAccess

POST /v2/marketfeed/ohlc Returns open-high-low-close for up to 1000 instruments.

Parameters:

  • params (Hash)

Returns:

  • (HashWithIndifferentAccess)


32
33
34
# File 'lib/DhanHQ/resources/market_feed.rb', line 32

def ohlc(params)
  post("/marketfeed/ohlc", params: params)
end

#quote(params) ⇒ HashWithIndifferentAccess

POST /v2/marketfeed/quote Returns market depth, OI, and other details for up to 1000 instruments.

Parameters:

  • params (Hash)

Returns:

  • (HashWithIndifferentAccess)


42
43
44
# File 'lib/DhanHQ/resources/market_feed.rb', line 42

def quote(params)
  quote_resource.post("/marketfeed/quote", params: params)
end