Technical KDJ
Get Stochastic Indicator (KDJ) for a specific stock within a specified time range
technical/kdj/{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 |
rPeriod* | number | KDJ period |
kPeriod* | number | %K period |
dPeriod* | number | %D 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 |
rPeriod* | number | KDJ period |
kPeriod* | number | %K period |
dPeriod* | number | %D period |
data* | Object | KDJ data |
>> data[0].date | string | Data date |
>> data[0].k | number | K |
>> data[0].d | number | D |
>> data[0].j | number | J |
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.kdj(**{"symbol": "2330", "from": "2024-08-01", "to": "2024-08-10","timeframe":"D", "rPeriod": 9, "kPeriod":3, "dPeriod":3})
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.kdj({ symbol: '2330', from: '2024-08-01', to: '2024-08-10', timeframe: 'D', rPeriod: 9, kPeriod: 3, dPeriod: 3 })
.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 kdj = await rest.Technical.Kdj("2330" ,new(9,3,3, fromDate, toDate, HistoryTimeFrame.Day));
//Kdj parameters (rPeriod, kPeriod, dPeriod, DateTime, DateTime, HistoryTimeFrame)
var kdj_con = kdj.Content.ReadAsStringAsync().Result;
Console.WriteLine(kdj_con);
Response Body:
{
"symbol": "2330",
"from": "2024-08-01",
"to": "2024-08-10",
"timeframe": "D",
"rPeriod": 9,
"kPeriod": 3,
"dPeriod": 3,
"data": [
{
"date": "2024-08-01",
"k": 32.96296296296297,
"d": 27.77777777777779,
"j": 43.333333333333336
},
{
"date": "2024-08-02",
"k": 23.703703703703713,
"d": 27.901234567901245,
"j": 15.308641975308653
},
{
"date": "2024-08-05",
"k": 17.068273092369484,
"d": 24.578313253012055,
"j": 2.048192771084345
},
{
"date": "2024-08-06",
"k": 13.855421686746999,
"d": 18.20913282760673,
"j": 5.147999405027534
},
{
"date": "2024-08-07",
"k": 36.718669549994864,
"d": 22.547454776370447,
"j": 65.0610990972437
},
{
"date": "2024-08-08",
"k": 54.05210585933478,
"d": 34.87539903202555,
"j": 92.40551951395325
},
{
"date": "2024-08-09",
"k": 66.45299145299147,
"d": 52.40792228744038,
"j": 94.54312978409367
}
]
}