Class: DhanHQ::Resources::GlobalStocks::MarginCalculator
- Defined in:
- lib/DhanHQ/resources/global_stocks/margin_calculator.rb
Overview
Resource client for the Global Stocks pre-trade calculators.
POST /v2/globalstocks/margincalculator
Both endpoints take the same request body. The API documents price and
quantity as strings, so numeric input is stringified before sending.
Constant Summary collapse
- API_TYPE =
:non_trading_api- HTTP_PATH =
"/v2/globalstocks"
Instance Attribute Summary
Attributes inherited from BaseAPI
Instance Method Summary collapse
-
#calculate(params) ⇒ Hash
Calculates the margin required for a Global Stocks order.
-
#estimate(params) ⇒ Hash
Estimates the charges applicable to a Global Stocks order.
Methods inherited from BaseAPI
#delete, #get, #initialize, #post, #put
Methods included from AttributeHelper
#camelize_keys, #deep_camelize_keys, #inspect, #normalize_keys, #snake_case, #titleize_keys
Methods included from APIHelper
Constructor Details
This class inherits a constructor from DhanHQ::BaseAPI
Instance Method Details
#calculate(params) ⇒ Hash
Calculates the margin required for a Global Stocks order.
21 22 23 |
# File 'lib/DhanHQ/resources/global_stocks/margin_calculator.rb', line 21 def calculate(params) post("/margincalculator", params: wire_params(params)) end |
#estimate(params) ⇒ Hash
Estimates the charges applicable to a Global Stocks order.
29 30 31 |
# File 'lib/DhanHQ/resources/global_stocks/margin_calculator.rb', line 29 def estimate(params) post("/transEstimate", params: wire_params(params)) end |