Get required details
To extract data in filtered way, certain details are necessary. E.g. to extract the listed instruments for an exchange in a filtered way, you have to pass certain optional parameters.
In this section, the guidelines to extract the valid values for optional parameters is described.
The instruments listed in an exchange might have **instrument type ** associated with it.E.g. OPTIDX, FUTIDX. To get the list of valid instrument types call the following method:
public InstrumentTypesResponse getInstumentTypes(String exchange) {
......
}
The necessary parameter:
-
exchange
: The value must be from the list of exchanges which you can get by calling the getSubscribedExchanges() method.
Example(A)
GfeedClient gc=new GfeedClient("WEB_SOCKET_ENDPOINT_URL","API_KEY");
...................................................
InstrumentTypesResponse response=gc.getInstumentTypes("NFO");
System.out.println(response.instrumentTypes.get(0).instrumentType);
The getInstumentTypes(<exchange>)
method returns InstrumentTypesResponse
. It contains the following information:
-
InstrumentTypeRequest instrumentsTypeRequest
-
List<InstrumentTypes> instrumentTypes
It is the collection of items ofInstrumentTypes
type. Each item in the collection may contain the following fields.
Variable Name | Type |
---|---|
instrumentType | String |
-
String message
For a valid response the message must be equal toConstants.INSTRUMENT_TYPES_RESULT_MESSAGE
.
[Go to Top]
To get the products for an exchange(e.g NIFTY) use the following methods:
** To get all the products:
public ProductResponse getProducts(String exchange) {
..............
}
The necessary parameter:
-
exchange
: The value must be from the list of exchanges which you can get by calling the getSubscribedExchanges() method.
** To get the product filtered by instrument type:
public ProductResponse getProducts(String exchange,Map<String,String> optionalParams) {
....
}
The necessary parameter:
-
exchange
: The value must be from the list of exchanges which you can get by calling the getSubscribedExchanges() method.
-
params
:
For the map which has to be passed as argument, the Keys of the <key,value> pairs are constants and predefined.
The list of supported <key,value> pair:
<Constants.INSTRUMENT_TYPE_KEY,instrumentType>
The value of instrumentType must be from the list of exchanges which you can get by calling the getInstrumentTypes(..) method.
Example(B)
GfeedClient gc=new GfeedClient("WEB_SOCKET_ENDPOINT_URL","API_KEY");
...................................................
ProductResponse response1=gc.getProducts("NFO");
System.out.println(response1.products.get(0).product);
..................................................
Map<String,String> op=new HashMap<String,String>();
op.put(Constants.INSTRUMENT_TYPE_KEY,"FUTIDX");
ProductResponse response2=gc.getProducts("NFO",op);
System.out.println(response2.products.get(0).product);
The getProducts(...)
methods returns ProductResponse
. It contains the following information:
-
ProductRequest request
-
List<Products> products
It is the collection of items ofProducts
type. Each item in the collection may contain the following fields.
Variable Name | Type |
---|---|
product | String |
-
String message
For a valid response the message must be equal toConstants.PRODUCT_RESULT_MESSAGE
.
[Go to Top]
To get the expiry dates for different products of an exchange use the following methods:
** To get the expiry dates of all the products:
public ExpiryDateResponse getExpiryDates(String exchange) {
.................
}
The necessary parameter:
-
exchange
: The value must be from the list of exchanges which you can get by calling the getSubscribedExchanges() method.
** To get the filtered expiry dates:
public ExpiryDateResponse getExpiryDates(String exchange,Map<String,String> optionalParams) {
....
}
The necessary parameter:
-
exchange
: The value must be from the list of exchanges which you can get by calling the getSubscribedExchanges() method.
-
optionalParams
:
For the map which has to be passed as argument, the Keys of the <key,value> pairs are constants and predefined.
The list of supported <key,value> pair:
<Constants.INSTRUMENT_TYPE_KEY,instrumentType>
The value of instrumentType must be from the list of instrumentTypes which you can get by calling the getInstrumentTypes(..) method.
<Constants.PRODUCT_TYPE_KEY,product>
The value of product must be from the list of products which you can get by calling the getProducts(..) method.
Example(C)
GfeedClient gc=new GfeedClient("WEB_SOCKET_ENDPOINT_URL","API_KEY");
...................................................
ExpiryDateResponse response1=gc.getExpiryDates("NFO");
System.out.println(response2.dates.get(0).expirydate);
..................................................
Map<String,String> op=new HashMap<String,String>();
op.put(Constants.INSTRUMENT_TYPE_KEY,"FUTIDX");
ProductResponse response2=gc.getProducts("NFO",op);
System.out.println(response2.dates.get(0).expirydate);
The getExpiryDates(...)
methods returns ExpiryDateResponse
. It contains the following information:
-
ExpiryDateRequest request
-
List<ExpiryDate> dates
It is the collection of items ofExpiryDate
type. Each item in the collection may contain the following fields.
Variable Name | Type |
---|---|
expirydate | String |
-
String message
For a valid response the message must be equal toConstants.EXPIRY_DATE_RESULT_MESSAGE
.
[Go to Top]
To get the option types available use the following methods:
** To get all the option types for an exchange:
public OptionTypeResponse getOptionTypes(String exchange) {
...........................
}
The necessary parameter:
-
exchange
: The value must be from the list of exchanges which you can get by calling the getSubscribedExchanges() method.
** To get the filtered option types:
public OptionTypeResponse getOptionTypes(String exchange,Map<String,String> optionalParams) {
..................
}
The necessary parameter:
-
exchange
: The value must be from the list of exchanges which you can get by calling the getSubscribedExchanges() method.
-
optionalParams
:
For the map which has to be passed as argument, the Keys of the <key,value> pairs are constants and predefined.
The list of supported <key,value> pair:
<Constants.INSTRUMENT_TYPE_KEY,instrumentType>
The value of instrumentType must be from the list of instrumentTypes which you can get by calling the getInstrumentTypes(..) method.
<Constants.PRODUCT_TYPE_KEY,product>
The value of product must be from the list of products which you can get by calling the getProducts(..) method.
<Constants.EXPIRY_DATE_KEY,expirydate>
The value of expirydate must be from the list of expirydates which you can get by calling the getExpiryDates(..) method.
Example(D)
GfeedClient gc=new GfeedClient("WEB_SOCKET_ENDPOINT_URL","API_KEY");
...................................................
OptionTypeResponse response1=gc.getOptionTypes("NFO");
System.out.println(response1.optionType.get(0).type);
..................................................
Map<String,String> op=new HashMap<String,String>();
op.put(Constants.INSTRUMENT_TYPE_KEY,"FUTIDX");
op.put(Constants.PRODUCT_KEY,"BANKNIFTY");
op.put(Constants.EXPIRY_DATE_KEY,"30AUG2018");
OptionTypeResponse response2=gc.getOptionTypes("NFO",op);
System.out.println(response1.optionType.get(0).type);
The getOptionTypes(...)
methods returns OptionTypeResponse
. It contains the following information:
-
OptionTypeRequest request
-
List<OptionType> optionType
It is the collection of items ofOptionType
type. Each item in the collection may contain the following fields.
Variable Name | Type |
---|---|
type | String |
-
String message
For a valid response the message must be equal toConstants.OPTION_TYPE_RESULT_MESSAGE
.
[Go to Top]
To get all the strike prices use the following methods:
** To get all the option types for an exchange:
public StrikePriceResponse getStrikePrices(String exchange) {
..............................
}
The necessary parameter:
-
exchange
: The value must be from the list of exchanges which you can get by calling the getSubscribedExchanges() method.
** To get the filtered option types:
public StrikePriceResponse getStrikePrices(String exchange,Map<String,String> optionalParams) {
...................
}
The necessary parameter:
-
exchange
: The value must be from the list of exchanges which you can get by calling the getSubscribedExchanges() method.
-
optionalParams
:
For the map which has to be passed as argument, the Keys of the <key,value> pairs are constants and predefined.
The list of supported <key,value> pair:
<Constants.INSTRUMENT_TYPE_KEY,instrumentType>
The value of instrumentType must be from the list of instrumentTypes which you can get by calling the getInstrumentTypes(..) method.
<Constants.PRODUCT_TYPE_KEY,product>
The value of product must be from the list of products which you can get by calling the getProducts(..) method.
<Constants.EXPIRY_DATE_KEY,expirydate>
The value of expirydate must be from the list of expirydates which you can get by calling the getExpiryDates(..) method.
<Constants.OPTION_TYPE_KEY,optiontype>
The value of optiontype must be from the list of option types which you can get by calling the getOptionTypes(..) method.
Example(E)
GfeedClient gc=new GfeedClient("WEB_SOCKET_ENDPOINT_URL","API_KEY");
...................................................
StrikePriceResponse response1=gc.getStrikePrices("NFO");
System.out.println(response1.prices.get(0).strikeprice);
..................................................
Map<String,String> op=new HashMap<String,String>();
op.put(Constants.INSTRUMENT_TYPE_KEY,"FUTIDX");
op.put(Constants.PRODUCT_KEY,"BANKNIFTY");
op.put(Constants.EXPIRY_DATE_KEY,"30AUG2018");
op.put(Constants.OPTION_TYPE_KEY,"CE");
StrikePriceResponse response2=gc.getStrikePrices("NFO",op);
System.out.println(response1.prices.get(0).strikeprice);
The getStrikePrices(...)
methods returns StrikePriceResponse
. It contains the following information:
-
StrikePriceRequest request
-
List<StrikePrice> prices
It is the collection of items ofStrikePrice
type. Each item in the collection may contain the following fields.
Variable Name | Type |
---|---|
strikeprice | String |
-
String message
For a valid response the message must be equal toConstants.STRIKE_PRICES_RESULT_MESSAGE
.
[Go to Top]
Dhelm® is a trademark of the KNC Solutions Private Limited.
For any query email at developer@kncsolutions.in
- Home
- Initialization and connection to web socket api
- Getting the list for subscribed exchanges
- Get instruments listed in an exchange
- Search instruments with keyword
- Get Last Quote
- Get snapshot data
- Get historical data
- Get required details
- Get account details
- Get market messages
- Get exchange messages
- Subscribe to realtime data
- Subscribe to realtime snapshot data
- Glossary of Methods
- Conclusion