Technical RSI
Get Relative Strength Index (RSI) for a specific stock within a specified time range
technical/rsi/{symbol}
Version Info.
Available since v2.2.6
Parameters
| Name | Type | Description |
|---|---|---|
symbol* | string | Stock symbol |
from* | string | Start date (format: yyyy-MM-dd) |
to* | string | End date (format: yyyy-MM-dd) |
timeframe* | string | K-line period, options: 1 1-min K; 5 5-min K; 10 10-min K; 15 15-min K; 30 30-min K; 60 60-min K; D daily K; W weekly K; M monthly K |
period* | number | RSI period |
caution
Currently, minute K-lines cannot specify start date (from) and end date (to), and will always return the most recent 30 days of data.
Response
| Name | Type | Description |
|---|---|---|
symbol* | string | Stock symbol |
from* | string | Start date |
to* | string | End date |
timeframe* | string | K-line period |
period* | string | RSI period |
data | Object | RSI data |
>> data[0].date | string | Data date |
>> data[0].rsi | number | RSI |
info
'*' indicates required fields.
Example
- Python
- Node.js
- C#
from fubon_neo.sdk import FubonSDK, Order
sdk = FubonSDK()
accounts = sdk.login("Your ID", "Your password", "Your cert path", "Your cert password") # Login required to obtain market data permissions
sdk.init_realtime() # Establish market data connection
reststock = sdk.marketdata.rest_client.stock
## Version 2.2.6 and later use simplified approach (using Exception for error handling)
from fubon_neo.sdk import FugleAPIError
try:
reststock.technical.rsi(**{"symbol": "2330", "from": "2024-08-01", "to": "2024-08-10","timeframe":"D", "period": 6})
except FugleAPIError as e:
print(f"Error: {e}")
print("------------")
print(f"Status Code: {e.status_code}") # Example: 429
print(f"Response Text: {e.response_text}") # Example: {"statusCode":429,"message":"Rate limit exceeded"}
const { FubonSDK } = require('fubon-neo');
const sdk = new FubonSDK();
const accounts = sdk.login("Your ID", "Your Password", "Your Cert Path", "Your Cert Password");
sdk.initRealtime(); // Establish market data connection
const client = sdk.marketdata.restClient
client.stock.technical.rsi({ symbol: '2330', from: '2024-08-01', to: '2024-08-10', timeframe: 'D', period: 6 })
.then(data => console.log(data));
using FubonNeo.Sdk;
using FugleMarketData.QueryModels.Stock.History; // Import HistoryTimeFrame
using FugleMarketData.QueryModels; // Import FieldsType
var sdk = new FubonSDK();
var result = sdk.Login("Your ID", "Your Password", "Your Cert Path", "Your Cert Password");
sdk.InitRealtime(); // Establish market data connection
var rest = sdk.MarketData.RestClient.Stock;
DateTime fromDate = new DateTime(2024, 8, 1);
DateTime toDate = new DateTime(2024, 8, 10);
var rsi = await rest.Technical.Rsi("2330" ,new(6, fromDate, toDate, HistoryTimeFrame.Day));
//RsiRequest parameters (period, DateTime, DateTime, HistoryTimeFrame)
var rsi_con = rsi.Content.ReadAsStringAsync().Result;
Console.WriteLine(rsi_con);
Response Body:
{
"symbol": "2330",
"from": "2024-08-01",
"to": "2024-08-10",
"timeframe": "D",
"period": 6,
"data": [
{
"date": "2024-08-01",
"rsi": 41.44144144144145
},
{
"date": "2024-08-02",
"rsi": 25.641025641025635
},
{
"date": "2024-08-05",
"rsi": 15.026786880961723
},
{
"date": "2024-08-06",
"rsi": 37.83577095879935
},
{
"date": "2024-08-07",
"rsi": 48.119604933543954
},
{
"date": "2024-08-08",
"rsi": 42.99811400274545
},
{
"date": "2024-08-09",
"rsi": 52.58621466649552
}
]
}