Skip to main content

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

NameTypeDescription
symbol*stringStock symbol
from*stringStart date (format: yyyy-MM-dd)
to*stringEnd date (format: yyyy-MM-dd)
timeframe*stringK-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*numberKDJ 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

NameTypeDescription
symbol*stringStock symbol
from*stringStart date
to*stringEnd date
timeframe*stringK-line period
rPeriod*numberKDJ period
kPeriod*number%K period
dPeriod*number%D period
data*ObjectKDJ data
>> data[0].datestringData date
>> data[0].knumberK
>> data[0].dnumberD
>> data[0].jnumberJ
info

'*' indicates required fields.

Example

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"}

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
}
]
}