Securities Recommendation
Learn about the endpoint that we can use to get a list of recommended securities.
We'll cover the following
Sometimes traders are interested in knowing which securities are performing better in any selected category. For example, we know that the stocks of a tech company are performing well, but we also want to know about other well-performing stocks in a similar category, YH Finance can provide us with our desired information in this case.
Endpoint for securities recommendation
The endpoint that will provide us with this information is https://yfapi.net/v6/finance/recommendationsbysymbol/{symbol}
. When calling this endpoint, {symbol}
needs to be replaced with the symbol of our primary stock.
Request parameters
This endpoint has no request parameters.
Let's look at how we can use this endpoint to get stocks similar to Apple Inc. Click "Run" to make the API call and see the response as the output.
const endpointUrl = new URL('https://yfapi.net/v6/finance/recommendationsbysymbol/AAPL');//AAPL is the symbol for Apple Inc.const headerParameters = {'X-API-KEY': '{{API_KEY}}'}const options = {method: 'GET',headers: headerParameters};async function fetchSimilarStocks() {try {const response = await fetch(endpointUrl, options);printResponse(response);} catch (error) {printError(error);}}fetchSimilarStocks();
Let's look at the code:
Line 1: We set the URL to
https://yfapi.net/v6/finance/recommendationsbysymbol/AAPL
.Lines 13–20: We define a function
fetchSimilarStocks()
that calls this endpoint and prints the response.
We can replace AAPL
in line 1 with the symbol of any other stock to get a different recommendation list.
Note: The table in the Appendix contains some symbols that we can use to test this endpoint.
Response fields
The output fields have been explained in the table below:
Response fields | Description |
| This is the symbol of the recommended security. |
| This is the price-to-book value of the stock. The closer it is to zero, the better the stocks are. Any stock with a score below 3.0 is considered good by the investors. |