Login/Logout Function
Login Function: THS_iFinDLogin
THS_iFinDLogin(username, password)
This command is required to log in before starting the operation.
Parameters:
parameter | name of parameter | parameter type | parametric description |
---|---|---|---|
username | account ID | character string | Account ID of data interface |
password | password | character string | The password corresponding to the data interface account ID. |
Output:
field | field name | field description |
---|---|---|
errorcode | error code | 1. Return 0, indicating successful login; 2. Return-201, indicating repeated login; 3. Return-2, indicating wrong username or password. |
Examples:
THS_iFinDLogin('user888','888888')
This example represents user888 logging in with password 88888
_Note: _
1. Command timeout is 90 seconds.
_2. When different computers log on to the same account at the same time, mutual exclusion will occur.
Logout Function: THS_iFinDLogout
THS_iFinDLogout()
Users can use this function to log out of accounts they have already logged in to.
Output:
field | field name | field description |
---|---|---|
errorcode | error code | 1. Returns 0 to indicate successful logout. |
Examples:
THS_iFinDLogout()
This example indicates that the user is logging out.
Data Function
Basic Data: THS_BD
THS_BD(thsCode, indicatorName, paramOption)
This function is used to obtain basic information, financial statements, profit forecasts, mergers and acquisitions and other index data of corresponding securities varieties. It supports multi-code and multi-index input.
_Note: _ 1 piece of data is 1 EXCEL cell
Parameters:
parameter | name of parameter | parameter type | parametric description |
---|---|---|---|
thsCode | code | character string | Straight flush codes connected by commas, supporting multiple codes, such as: '600004.SH,300330.SZ' |
indicatorName | index | character string | Metric name connected by semicolon. Multiple metrics are supported. Metric name can be queried through SuperCommand Client-> Tools-> Metric Function, or command generated directly through SuperCommand Client. |
paramOption | parameter | character string | Semicolon concatenation of indicator parameters, different parameters of each indicator are concatenated with commas. Corresponding indicator in indicatorName. If there is no parameter, the corresponding indicator is blank, such as: '2019-12-09,100,2019-12-09;;2019-12-09,100,2019-12-09' |
Output:
field | field name | field description |
---|---|---|
errorcode | error ID | Code error code, errorcode=0 indicates that the code is running normally. If it is other, you need to find the cause of the error |
errmsg | error message | If errorcode returns non-zero, a specific error message is returned here. |
indicators | index information | Return all metrics information |
datatype | pointer format | Returns the metric format of the acquired data |
perf | processing time | Total Time to Return Request Command (ms) |
dataVol | data size | Returns the amount of data consumed by the current command |
time | time | Returns a list of times when data values were taken |
thscode | Subject information | Return all subject codes |
data | structural body | The returned content includes data content in specific formats such as dataframe, json, list, table, array, etc. |
Examples:
THS_BD('300033.SZ,600030.SH','ths_open_price_stock;ths_stock_short_name_stock;ths_close_price_stock','2025-01-13,100,2025-01-13;;2025-01-13,100,2025-01-13')
[data, errorcode, indicators, thscode, errmsg, dataVol, datatype, perf] = THS_BD('300033.SZ,600030.SH','ths_open_price_stock;ths_stock_short_name_stock;ths_close_price_stock','2025-01-13,100,2025-01-13;;2025-01-13,100,2025-01-13','format:table')
THS_BasicData('300033.SZ,600030.SH','ths_open_price_stock;ths_stock_short_name_stock;ths_close_price_stock','2025-01-13,100,2025-01-13;;2025-01-13,100,2025-01-13',TRUE)
THS_BasicData("300033.SZ,600030.SH","ths_open_price_stock;ths_stock_short_name_stock;ths_close_price_stock","2025-01-13,100,2025-01-13;;2025-01-13,100,2025-01-13")
THS_BasicData("300033.SZ,600030.SH","ths_open_price_stock;ths_stock_short_name_stock;ths_close_price_stock","2025-01-13,100,2025-01-13;;2025-01-13,100,2025-01-13")
THS_BasicData("300033.SZ,600030.SH","ths_open_price_stock;ths_stock_short_name_stock;ths_close_price_stock","2025-01-13,100,2025-01-13;;2025-01-13,100,2025-01-13")
THS_BasicData("300033.SZ,600030.SH","ths_open_price_stock;ths_stock_short_name_stock;ths_close_price_stock","2025-01-13,100,2025-01-13;;2025-01-13,100,2025-01-13")
requestMethod:POST
requestURL:https://quantapi.51ifind.com/api/v1/basic_data_service
requestHeaders:{"Content-Type":"application/json","access_token":"","ifindlang":"cn"}
formData:{"codes":"300033.SZ,600030.SH","indipara":[{"indicator":"ths_open_price_stock","indiparams":["20250113","100","20250113"]},{"indicator":"ths_stock_short_name_stock"},{"indicator":"ths_close_price_stock","indiparams":["20250113","100","20250113"]}]}
This example returns the opening price, security name and closing price of Tonghuashun and CITIC Securities on January 13, 2025.
Date Sequence: THS_DS
THS_DS(thscode, jsonIndicator, jsonparam, globalparam, begintime, endtime)
Obtain historical data series of selected securities, including daily market data, fundamental data and various technical indicators.
Parameters:
parameter | name of parameter | parameter type | parametric description |
---|---|---|---|
thscode | code | character string | Straight flush codes connected by commas, supporting multiple codes, such as: '600004.SH,300330.SZ' |
jsonIndicator | index | character string | Metric name connected by semicolon. Multiple metrics are supported. Metric name can be queried through SuperCommand Client-> Tools-> Metric Function, or command generated directly through SuperCommand Client. |
jsonparam | parameter | character string | Semicolon concatenation of indicator parameters, different parameters of each indicator are concatenated with commas. Corresponds to the indicator in jsonIndicator. If the corresponding indicator has no parameter, it is empty, such as: '100;;100' |
globalparam | Date Series Output Settings | character string | The setting of date sequence output connected by half angle comma, and the individual setting is separated by colon. You can set the processing of time period, date type, non-transaction interval processing, etc. of date series output. For example 'Interval:W,Fill:Previous,Days: WorkDays'. For parameters of various settings, see Date Sequence Output Setting Table. |
begintime | start date | character string | Time format is Y-MM-DD, e.g.'2025-01-13' |
endtime | expiration date | character string | Time format is Y-MM-DD, e.g.'20125-01-13' |
Date series output settings (globalparam):
field | field name | field description |
---|---|---|
Interval | time period | D-Day W-Week M-Month Q-Season S-Half Year Y-Year |
Days | date type | Tradedays-Trading Days Alldays-Calendar Days |
Fill | Non-transaction interval processing | Previous-Use previous data Blank-null Specific value-custom value |
Output:
field | field name | field description |
---|---|---|
errorcode | error ID | Code error code, errorcode=0 indicates that the code is running normally. If it is other, you need to find the cause of the error |
errmsg | error message | If errorcode returns non-zero, a specific error message is returned here. |
indicators | index information | Return all metrics information |
datatype | pointer format | Returns the metric format of the acquired data |
perf | processing time | Total Time to Return Request Command (ms) |
dataVol | data size | Returns the amount of data consumed by the current command |
time | time | Returns a list of times when data values were taken |
thscode | Subject information | Return all subject codes |
data | structural body | The returned content includes data content in specific formats such as dataframe, json, list, table, array, etc. |
Examples:
THS_DS('AAPL.O','ths_pre_close_uss','100','Days:Alldays,Fill:-1','2025-01-01','2025-01-13')
[data,errorcode,time,indicators,thscode,errmsg,dataVol,datatype,perf]=THS_DS('AAPL.O','ths_pre_close_uss','100','Days:Alldays,Fill:-1','2025-01-01','2025-01-13','format:table')
THS_DateSerial('AAPL.O','ths_pre_close_uss','100','Days:Alldays,Fill:-1','2025-01-01','2025-01-13',TRUE)
THS_DateSerial("AAPL.O","ths_pre_close_uss","100","Days:Alldays,Fill:-1","2025-01-01","2025-01-13")
THS_DateSerial("AAPL.O","ths_pre_close_uss","100","Days:Alldays,Fill:-1","2025-01-01","2025-01-13")
THS_DateSerial("AAPL.O","ths_pre_close_uss","100","Days:Alldays,Fill:-1","2025-01-01","2025-01-13")
THS_DateSerial("AAPL.O","ths_pre_close_uss","100","Days:Alldays,Fill:-1","2025-01-01","2025-01-13")
requestMethod:POST
requestURL:https://quantapi.51ifind.com/api/v1/date_sequence
requestHeaders:{"Content-Type":"application/json","access_token":"","ifindlang":"cn"}
formData:{"codes":"AAPL.O","startdate":"20250101","enddate":"20250113","functionpara":{"Days":"Alldays","Fill":"-1"},"indipara":[{"indicator":"ths_pre_close_uss","indiparams":["","100"]}]}
This example represents taking all previous closing price data of Apple from January 01, 2025 to January 13, 2025.
History: THS_HQ
THS_HQ(thscode, jsonIndicator, jsonparam, begintime, endtime)
Acquire historical market data of various securities, including daily market data, fundamental data and technical index data. There are also specific indicators for bonds, funds and futures. The time period can be selected by the user himself. Currently, the selectable time period includes day, week, month and year. Other optional parameters such as recovery method, quotation type ( Bonds), currency, etc. Users can choose according to their own needs.
Parameters:
parameter | name of parameter | parameter type | parametric description |
---|---|---|---|
thscode | code | character string | Straight flush codes connected by commas, supporting multiple codes, such as: '600004.SH,300330.SZ' |
jsonIndicator | index | character string | Semicolon connected metric name, supports multiple metrics, metric name can be directly generated by SuperCommand client |
jsonparam | Historical Quotes Output Settings | character string | The setting of date sequence output connected by half angle comma, and the individual setting is separated by colon. You can set the time period of the historical market output, the recovery method, and the processing of non-trading intervals. For example 'Interval:W,Fill:Previous,Days: WorkDays'. For the parameters of each setting, see the historical quotation output setting table |
begintime | start date | character string | Time format is Y-MM-DD, e.g.'2016-05-23' |
endtime | expiration date | character string | Time format is Y-MM-DD, e.g.'2016-05-23' |
Historical Quotes Output Settings (jsonparam):
field | field name | field description | default value |
---|---|---|---|
Interval | time period | D-Day W-Week M-Month Q-Season Y-Year Same Sampling Period One out of two, returns period summary statistics | D |
SampleInterval | sampling period | D-Day W-Week M-Month Q-Quarter S-Half Year Y-Year Same Time Cycle Choose one of two, return to the last trading day frequency data of the cycle | D |
fill | Non-transaction interval processing | Previous-Use previous data Blank-Empty specific value-Custom value Omit-Default value | Previous |
CPS | recovery mode | 1-No right recovery 2-Front right recovery (dividend reinvestment) 3-Later right recovery (dividend reinvestment) 4-Full circulation front right recovery (dividend reinvestment) 5-Full circulation rear right recovery (dividend reinvestment) 6-Front right recovery (cash dividend) 7-Later right recovery (cash dividend) | 1 |
baseDate | restoration base | Forward or backward restoration based on restoration base points | 1900-01-01 Retroactive reinstatement based on the first day of listing or forward reinstatement based on the latest date |
PriceType | Bond Quotation Type | 1-Full Price 2-Net Price Bond only valid | 1 |
Currency | currency type | MHB-USD GHB-HKD RMB-CNY YSHB-Original Currency | YSHB |
Output:
field | field name | field description |
---|---|---|
errorcode | error ID | Code error code, errorcode=0 indicates that the code is running normally. If it is other, you need to find the cause of the error |
errmsg | error message | If errorcode returns non-zero, a specific error message is returned here. |
indicators | index information | Return all metrics information |
datatype | pointer format | Returns the metric format of the acquired data |
perf | processing time | Total Time to Return Request Command (ms) |
dataVol | data size | Returns the amount of data consumed by the current command |
time | time | Returns a list of times when data values were taken |
thscode | Subject information | Return all subject codes |
data | structural body | The returned content includes data content in specific formats such as dataframe, json, list, table, array, etc. |
Examples:
THS_HQ('300033.SZ','open,high,low,close','Currency:MHB,fill:Omit','2024-01-13','2025-01-13')
[data,errorcode,time,indicators,thscode,errmsg,dataVol,datatype,perf]=THS_HQ('300033.SZ','open,high,low,close','Currency:MHB,fill:Omit','2024-01-13','2025-01-13','format:table')
THS_HistoryQuotes('300033.SZ','open,high,low,close','Currency:MHB,fill:Omit','2024-01-13','2025-01-13',TRUE)
THS_HistoryQuotes("300033.SZ","open,high,low,close","Currency:MHB,fill:Omit","2024-01-13","2025-01-13")
THS_HistoryQuotes("300033.SZ","open,high,low,close","Currency:MHB,fill:Omit","2024-01-13","2025-01-13")
THS_HistoryQuotes("300033.SZ","open,high,low,close","Currency:MHB,fill:Omit","2024-01-13","2025-01-13")
THS_HistoryQuotes("300033.SZ","open,high,low,close","Currency:MHB,fill:Omit","2024-01-13","2025-01-13")
requestMethod:POST
requestURL:https://quantapi.51ifind.com/api/v1/cmd_history_quotation
requestHeaders:{"Content-Type":"application/json","access_token":"","ifindlang":"cn"}
formData:{"codes":"300033.SZ","indicators":"open,high,low,close","startdate":"2024-01-13","enddate":"2025-01-13","functionpara":{"Currency":"MHB","Fill":"Omit"}}
This example represents a high open and low close of historical data from 2024-01-13 to 2025-01-13, and does not return a date if there is no trade on that date.
HF Sequence: THS_HF
THS_HF(thscode, jsonIndicator, jsonparam, begintime, endtime)
The command is used to obtain minutes of securities history K line market, technical indicators and other data. The cycle of minute line can be selected by yourself. At present, the optional cycles are 1 minute, 3 minutes and 5 minutes. minutes, 10 minutes, 15 minutes, 30 minutes and 60 minutes.
Parameters:
parameter | name of parameter | parameter type | parametric description |
---|---|---|---|
thscode | code | character string | Straight flush codes connected by commas, supporting multiple codes, such as: '600004.SH,300330.SZ' |
jsonIndicator | index | character string | Semicolon connected metric name, supports multiple metrics, metric name can be directly generated by SuperCommand client |
jsonparam | HF Sequence Output Settings | character string | The setting of date sequence output connected by half angle comma, and the individual setting is separated by colon. You can set the processing of time period, date type, non-transaction interval processing, etc. of date series output. For example 'Interval:W,Fill:Previous,Days: WorkDays'. For the parameters of each setting, see HF Sequence Output Settings |
begintime | start time | character string | Start time, time format: Y-MM-DD HH:MM:SS, e.g. 2019-12-10 09:30:00 |
endtime | deadline | character string | Deadline time, time format: Y-MM-DD HH:MM:SS, e.g. 2019-12-10 10:30:00 |
High frequency sequence output settings (jsonparam):
field | field name | field description | default value |
---|---|---|---|
startTime | Daily Data Start Time | startTime and endTime define the start and end times of each trading day's data | |
endTime | Daily Data Cutoff Time | startTime and endTime define the start and end times of each trading day's data | |
timeformat | timestamp format | Empty string-Beijing time LocalTime-Local time | |
Interval | time period | 1-1 min 3-3 min 5-5 min 10-10 min 15-15 min 30-30 min 60-60 min | 1 |
Fill | Non-transaction interval processing | Original-Do not process Previous-Follow previous data Blank-Blank Specific value-Custom value | Previous |
CPS | recovery mode | 1. Stocks: no-no recovery forward1-forward recovery (dividend scheme calculation) backward1-backward recovery (dividend scheme calculation) forward3-forward recovery (exchange price calculation) backward3-backward recovery (exchange price calculation) forward2-full circulation forward recovery (dividend scheme calculation) backward2-full circulation backward recovery (dividend scheme calculation) forward4-full circulation forward recovery (exchange price calculation) backward4-full circulation backward recovery (exchange price calculation) 2. Other objects: no-forward-backward-back-right | no |
baseDate | restoration base | Forward or backward restoration based on restoration base points | 1900-01-01 Retroactive reinstatement based on the first day of listing or forward reinstatement based on the latest date |
Output:
field | field name | field description |
---|---|---|
errorcode | error ID | Code error code, errorcode=0 indicates that the code is running normally. If it is other, you need to find the cause of the error |
errmsg | error message | If errorcode returns non-zero, a specific error message is returned here. |
indicators | index information | Return all metrics information |
datatype | pointer format | Returns the metric format of the acquired data |
perf | processing time | Total Time to Return Request Command (ms) |
dataVol | data size | Returns the amount of data consumed by the current command |
time | time | Returns a list of times when data values were taken |
thscode | Subject information | Return all subject codes |
data | structural body | The returned content includes data content in specific formats such as dataframe, json, list, table, array, etc. |
Examples:
THS_HF('300033.SZ','close','CPS:forward1,Fill:Previous,timeformat:LocalTime,startTime:09:30:00,endTime:09:40:00','2025-01-01 09:15:00','2025-01-13 15:15:00')
[data,errorcode,time,indicators,thscode,errmsg,dataVol,datatype,perf]=THS_HF('300033.SZ','close','CPS:forward1,Fill:Previous,timeformat:LocalTime,startTime:09:30:00,endTime:09:40:00','2025-01-01 09:15:00','2025-01-13 15:15:00','format:table')
THS_HighFrequenceSequence('300033.SZ','close','CPS:forward1,Fill:Previous,timeformat:LocalTime,startTime:09:30:00,endTime:09:40:00','2025-01-01 09:15:00','2025-01-13 15:15:00',TRUE)
THS_HighFrequenceSequence("300033.SZ","close","CPS:forward1,Fill:Previous,timeformat:LocalTime,startTime:09:30:00,endTime:09:40:00","2025-01-01 09:15:00","2025-01-13 15:15:00")
THS_HighFrequenceSequence("300033.SZ","close","CPS:forward1,Fill:Previous,timeformat:LocalTime,startTime:09:30:00,endTime:09:40:00","2025-01-01 09:15:00","2025-01-13 15:15:00")
THS_HighFrequenceSequence("300033.SZ","close","CPS:forward1,Fill:Previous,timeformat:LocalTime,startTime:09:30:00,endTime:09:40:00","2025-01-01 09:15:00","2025-01-13 15:15:00")
THS_HighFrequenceSequence("300033.SZ","close","CPS:forward1,Fill:Previous,timeformat:LocalTime,startTime:09:30:00,endTime:09:40:00","2025-01-01 09:15:00","2025-01-13 15:15:00")
requestMethod:POST
requestURL:https://quantapi.51ifind.com/api/v1/high_frequency
requestHeaders:{"Content-Type":"application/json","access_token":"","ifindlang":"cn"}
formData:{"codes":"300033.SZ","indicators":"close","starttime":"2025-01-01 09:15:00","endtime":"2025-01-13 15:15:00","functionpara":{"CPS":"forward1","Fill":"Previous","Timeformat":"LocalTime","Limitstart":"09:30:00","Limitend":"09:40:00"}}
This example represents taking 1 minute of data from 2025-01-01 9:30 to 2025-01-13 9:40 for a straight flush.
Real-time Quotes: THS_RQ
THS_RQ(thscode, jsonIndicator, jsonparam)
Acquire the latest market data of the corresponding securities. Support multi-code and multi-indicator.
Parameters:
parameter | name of parameter | parameter type | parametric description |
---|---|---|---|
thscode | code | character string | Straight flush codes connected by commas, supporting multiple codes, such as: '600004.SH,300330.SZ' |
jsonIndicator | index | character string | Semicolon connected indicator name, supports multiple indicators, indicator name can be generated directly through SuperCommand client |
jsonparam | parameter | character string | Colons separate the settings for assignment. Currently, only bonds apply pricetype:1 for net price, pricetype:2 for full price, and pricetype:3 for yield. Request other varieties can not pass or empty string |
Output:
field | field name | field description |
---|---|---|
errorcode | error ID | Code error code, errorcode=0 indicates that the code is running normally. If it is other, you need to find the cause of the error |
errmsg | error message | If errorcode returns non-zero, a specific error message is returned here. |
indicators | index information | Return all metrics information |
datatype | pointer format | Returns the metric format of the acquired data |
perf | processing time | Total Time to Return Request Command (ms) |
dataVol | data size | Returns the amount of data consumed by the current command |
time | time | Returns a list of times when data values were taken |
thscode | Subject information | Return all subject codes |
data | structural body | The returned content includes data content in specific formats such as dataframe, json, list, table, array, etc. |
Examples:
THS_RQ('300033.SZ,600030.SH','open;high;low;latest')
[data,errorcode,time,indicators,thscode,errmsg,dataVol,datatype,perf]=THS_RQ('300033.SZ,600030.SH','open;high;low;latest','','format:table')
THS_RealtimeQuotes('300033.SZ,600030.SH','open;high;low;latest','',TRUE)
THS_RealtimeQuotes("300033.SZ,600030.SH","open;high;low;latest")
THS_RealtimeQuotes("300033.SZ,600030.SH","open;high;low;latest","")
THS_RealtimeQuotes("300033.SZ,600030.SH","open;high;low;latest","")
THS_RealtimeQuotes("300033.SZ,600030.SH","open;high;low;latest")
requestMethod:POST
requestURL:https://quantapi.51ifind.com/api/v1/real_time_quotation
requestHeaders:{"Content-Type":"application/json","access_token":"","ifindlang":"cn"}
formData:{"codes":"300033.SZ,600030.SH","indicators":"open,high,low,latest"}
This example represents the high open low current price data of the latest straight flush and CITIC Securities.
Intraday Snapshot: THS_SS
THS_SS(thscode, jsonIndicator, jsonparam, begintime, endtime)
Get intraday and historical snapshots and open data for the corresponding security symbol.
Parameters:
parameter | name of parameter | parameter type | parametric description |
---|---|---|---|
thscode | code | character string | Straight flush codes connected by commas, supporting multiple codes, such as: '600004.SH,300330.SZ' |
jsonIndicator | index | character string | Semicolon connected metric name, supports multiple metrics, metric name can be directly generated by SuperCommand client |
jsonparam | Intraday snapshot output settings | character string | Individual settings are separated by colons. Currently, only data type is supported, i.e. dataType:Original |
begintime | start time | character string | Start time, time format: Y-MM-DD HH:MM:SS, e.g. 2019-12-10 09:30:00 |
endtime | deadline | character string | Deadline time, time format: Y-MM-DD HH:MM:SS, e.g. 2019-12-10 10:30:00 |
Output:
field | field name | field description |
---|---|---|
errorcode | error ID | Code error code, errorcode=0 indicates that the code is running normally. If it is other, you need to find the cause of the error |
errmsg | error message | If errorcode returns non-zero, a specific error message is returned here. |
indicators | index information | Return all metrics information |
datatype | pointer format | Returns the metric format of the acquired data |
perf | processing time | Total Time to Return Request Command (ms) |
dataVol | data size | Returns the amount of data consumed by the current command |
time | time | Returns a list of times when data values were taken |
thscode | Subject information | Return all subject codes |
data | structural body | The returned content includes data content in specific formats such as dataframe, json, list, table, array, etc. |
Examples:
THS_SS('300033.SZ','latest','','2025-01-13 09:15:00','2025-01-17 15:15:00')
[data,errorcode,time,indicators,thscode,errmsg,dataVol,datatype,perf]=THS_SS('300033.SZ','latest','','2025-01-13 09:15:00','2025-01-17 15:15:00','format:table')
THS_Snapshot('300033.SZ','latest','','2025-01-13 09:15:00','2025-01-17 15:15:00',TRUE)
THS_Snapshot("300033.SZ","latest","","2025-01-13 09:15:00","2025-01-17 15:15:00")
THS_Snapshot("300033.SZ","latest","","2025-01-13 09:15:00","2025-01-17 15:15:00")
THS_Snapshot("300033.SZ","latest","","2025-01-13 09:15:00","2025-01-17 15:15:00")
THS_Snapshot("300033.SZ","latest","","2025-01-13 09:15:00","2025-01-17 15:15:00")
requestMethod:POST
requestURL:https://quantapi.51ifind.com/api/v1/snap_shot
requestHeaders:{"Content-Type":"application/json","access_token":"","ifindlang":"cn"}
formData:{"codes":"300033.SZ","indicators":"latest","starttime":"2025-01-13 09:15:00","endtime":"2025-01-17 15:15:00"}
Returns the current price data of Flush on January 13, 2025.
EDB Data: THS_EDB
THS_EDB(indicators, param, begintime, endtime)
Acquire macroeconomic data, including China macro data, regional macro data, global macro data, industry economic data, economic benefit data, interest rate trend data and world economic data.
Parameters:
parameter | name of parameter | parameter type | parametric description |
---|---|---|---|
indicators | Macro Indicator ID | character string | Macro-indicator ID connected by semicolon. Multiple indicators are supported. You can query the indicator name in SuperCommand-> Economic Database Direct Generation Command or SuperCommand-> Tools->EDB Indicator ID Query. |
param | parameter | character string | startrtime-update start time endrtime-update end time mode-index |
begintime | start date | character string | Time format is Y-MM-DD, e.g.'2016-05-23' |
endtime | expiration date | character string | Time format is Y-MM-DD, e.g.'2017-05-23' |
Output:
field | field name | field description |
---|---|---|
errorcode | error ID | Code error code, errorcode=0 indicates that the code is running normally. If it is other, you need to find the cause of the error |
errmsg | error message | If errorcode returns non-zero, a specific error message is returned here. |
indicators | index information | Return all metrics information |
datatype | pointer format | Returns the metric format of the acquired data |
perf | processing time | Total Time to Return Request Command (ms) |
dataVol | data size | Returns the amount of data consumed by the current command |
time | time | Returns a list of times when data values were taken |
thscode | Subject information | Return all subject codes |
data | structural body | The returned content includes data content in specific formats such as dataframe, json, list, table, array, etc. |
Examples:
THS_EDB('M001620253;M002826938','','2024-01-18','2025-01-18')
[data,errorcode,errmsg,dataVol,perf]=THS_EDB('M001620253;M002826938','','2024-01-18','2025-01-18','format:table')
THS_EDB('M001620253;M002826938','','2024-01-18','2025-01-18',TRUE)
THS_EDB("M001620253;M002826938","","2024-01-18","2025-01-18")
THS_EDB("M001620253;M002826938","","2024-01-18","2025-01-18")
THS_EDB("M001620253;M002826938","","2024-01-18","2025-01-18")
THS_EDB("M001620253;M002826938","","2024-01-18","2025-01-18")
requestMethod:POST
requestURL:http://quantapi.51ifind.com/api/v1/edb_service
requestHeaders:{"Content-Type":"application/json","access_token":"","ifindlang":"cn"}
formData:{"indicators":"M001620253,M002826938","startdate":"2024-01-18","enddate":"2025-01-18"}
This example represents all GDP: per capita and GDP: year-on-year data from January 18, 2024 to January 18, 2025.
characteristic Data
Intelligent Stock Selection: THS_WCQuery
THS_WCQuery(query, domain)
Call the interface of asking for wealth and adjust stock selection through semantic recognition.
Parameters:
parameter | name of parameter | parameter type | parametric description |
---|---|---|---|
query | search content | character string | Search content that needs to be entered in Ask Money |
domain | parameter | character string | You can set the scope of the search content |
Output:
field | field name | field description |
---|---|---|
errorcode | error ID | Code error code, errorcode=0 indicates that the code is running normally. If it is other, you need to find the cause of the error |
errmsg | error message | If errorcode returns non-zero, a specific error message is returned here. |
indicators | index information | Return all metrics information |
datatype | pointer format | Returns the metric format of the acquired data |
perf | processing time | Total Time to Return Request Command (ms) |
dataVol | data size | Returns the amount of data consumed by the current command |
time | time | Returns a list of times when data values were taken |
thscode | Subject information | Return all subject codes |
data | structural body | The returned content includes data content in specific formats such as dataframe, json, list, table, array, etc. |
Examples:
THS_WCQuery('低市盈率','stock')
[data,errorcode,errmsg,dataVol,perf]=THS_WCQuery('低市盈率','stock','format:table')
THS_WCQuery('低市盈率','stock',TRUE)
THS_WCQuery("低市盈率","stock")
THS_WCQuery("低市盈率","stock")
THS_WCQuery("低市盈率","stock")
THS_WCQuery("低市盈率","stock")
requestMethod:POST
requestURL:https://quantapi.51ifind.com/api/v1/smart_stock_picking
requestHeaders:{"Content-Type":"application/json","access_token":"","ifindlang":"cn"}
formData:{"searchstring":"低市盈率","searchtype":"stock"}
Acquire the A shares that the financial inquiry system believes have low P/E ratios.
Announcement Query: THS_ReportQuery
THS_ReportQuery(thscode, param, output)
Returns announcement information such as announcement date, release time, security code, announcement title, announcement link, etc. of the selected stock.
Parameters:
parameter | name of parameter | parameter type | parametric description |
---|---|---|---|
thscode | code | character string | Straight flush codes connected by commas, supporting multiple codes, such as: '600004.SH,300330.SZ' |
param | input parameters | character string | Semicolon linked announcement query function parameter settings, single settings separated by colons assigned. You can set whether to extract the plate, set the release start deadline, announcement start deadline, title keywords, announcement type, etc. For example 'mode:allAStock; initirDate:2021-12-09;endrDate:2021-12-09;reportType: 901'. For the parameters of each setting, see the parameter setting table below |
output | output parameter | character string | Comma concatenation, used to control whether a column output, each set to column name and "Y" or "N" separated by a colon assignment. For example,'reportDate:Y,thscode: Y', where' Y 'represents output. reportDate-announcement date thscode-flush code secName-security abbreviation ctime-release time reportTitle-announcement title pdfURL-announcement link seq-unique label |
Parameter setting table (param):
field | field name | field description | omitted logic |
---|---|---|---|
mode | Extract by block or extract by code | mode: allAStock mode: allBond mode: allFund mode: allHKStock | The default is extract by code mode |
begincTime | Release Start Time | Limit release start time | not limited |
endcTime | Release Deadline | Limit publication deadline | not limited |
beginrDate | Announcement Start Date | Limited announcement start date | not limited |
endrDate | Announcement End Date | Limit announcement end date | not limited |
beginseq | Start SEQ | Limit Start SEQ | not limited |
endseq | Closing seq | limit cutoff seq | not limited |
keyword | title keywords | qualified by title keyword | not limited |
reporttype | announcement type | It can be generated according to performance report, IPO announcement, additional issuance announcement, etc. There are too many types, and it is recommended to use super command. | not limited |
Output:
field | field name | field description |
---|---|---|
errorcode | error ID | Code error code, errorcode=0 indicates that the code is running normally. If it is other, you need to find the cause of the error |
errmsg | error message | If errorcode returns non-zero, a specific error message is returned here. |
indicators | index information | Return all metrics information |
datatype | pointer format | Returns the metric format of the acquired data |
perf | processing time | Total Time to Return Request Command (ms) |
dataVol | data size | Returns the amount of data consumed by the current command |
time | time | Returns a list of times when data values were taken |
thscode | Subject information | Return all subject codes |
data | structural body | The returned content includes data content in specific formats such as dataframe, json, list, table, array, etc. |
Examples:
THS_ReportQuery('300033.SZ','beginrDate:2024-01-18;endrDate:2025-01-18;reportType:901','reportDate:Y,thscode:Y,secName:Y,ctime:Y,reportTitle:Y,pdfURL:Y,seq:Y')
[data,errorcode,errmsg,dataVol,datatype,perf]=THS_ReportQuery('300033.SZ','beginrDate:2024-01-18;endrDate:2025-01-18;reportType:901','reportDate:Y,thscode:Y,secName:Y,ctime:Y,reportTitle:Y,pdfURL:Y,seq:Y','format:table')
THS_ReportQuery('300033.SZ','beginrDate:2024-01-18;endrDate:2025-01-18;reportType:901','reportDate:Y,thscode:Y,secName:Y,ctime:Y,reportTitle:Y,pdfURL:Y,seq:Y',TRUE)
THS_ReportQuery("300033.SZ","beginrDate:2024-01-18;endrDate:2025-01-18;reportType:901","reportDate:Y,thscode:Y,secName:Y,ctime:Y,reportTitle:Y,pdfURL:Y,seq:Y")
THS_ReportQuery("300033.SZ","beginrDate:2024-01-18;endrDate:2025-01-18;reportType:901","reportDate:Y,thscode:Y,secName:Y,ctime:Y,reportTitle:Y,pdfURL:Y,seq:Y")
THS_ReportQuery("300033.SZ","beginrDate:2024-01-18;endrDate:2025-01-18;reportType:901","reportDate:Y,thscode:Y,secName:Y,ctime:Y,reportTitle:Y,pdfURL:Y,seq:Y")
THS_ReportQuery("300033.SZ","beginrDate:2024-01-18;endrDate:2025-01-18;reportType:901","reportDate:Y,thscode:Y,secName:Y,ctime:Y,reportTitle:Y,pdfURL:Y,seq:Y")
requestMethod:POST
requestURL:https://quantapi.51ifind.com/api/v1/report_query
requestHeaders:{"Content-Type":"application/json","access_token":"","ifindlang":"cn"}
formData:{"codes":"300033.SZ","functionpara":{"reportType":"901"},"beginrDate":"2024-01-18","endrDate":"2025-01-18","outputpara":"reportDate:Y,thscode:Y,secName:Y,ctime:Y,reportTitle:Y,pdfURL:Y,seq:Y"}
Shape Prediction: THS_Special_ShapePredict
THS_Special_ShapePredict(thscode, param, begintime, endtime)
According to the security code and parameters required by the user, the stock with high matching degree with the stock selected by the user is returned.
Parameters:
parameter | name of parameter | parameter type | parametric description |
---|---|---|---|
thscode | search content | character string | Straight flush codes connected by commas, supporting multiple codes, such as: '600004.SH,300330.SZ' |
param | parameter | character string | Output settings that are half-angle comma concatenated, and single-item settings are assigned colons. You can set the matching market range, matching degree, matching period and prediction period, etc. See parameter correspondence table for parameters of each setting |
begintime | start date | character string | Time format is Y-MM-DD, e.g.'2016-05-23' |
endtime | expiration date | character string | Time format is Y-MM-DD, e.g.'2016-05-23' |
Output:
field | field name | field description |
---|---|---|
errorcode | error ID | Code error code, errorcode=0 indicates that the code is running normally. If it is other, you need to find the cause of the error |
errmsg | error message | If errorcode returns non-zero, a specific error message is returned here. |
tables | structural body | Return content includes ID, time, etc. |
datatype | pointer format | Returns the metric format of the acquired data |
inputParams | input parameters | Returns the parameters entered |
perf | processing time | Total Time to Return Request Command (ms) |
dataVol | data size | Returns the amount of data consumed by the current command |
Examples:
THS_Special_ShapePredict('600000.SH','range=SHSE_A_stock;SZSE_A_stock;SHSE_B_stock,match_level=90.0,match_period=20,predict_period=35','2019-07-19','2019-12-01')
Looking for stocks similar to 60000.SH in Shanghai A shares, Shenzhen A shares and Shanghai B shares, the starting date and deadline for prediction are 2019-07-19 and 2019-07-19 respectively. 2019-12-01。The screening criteria are matching degree 90 and above, matching period 20 and prediction period 35.
THS_Special_StockLink
THS_Special_StockLink(thscode, param)
By commodity name of futures, get all the information about stocks related to that commodity.
Parameters:
parameter | name of parameter | parameter type | parametric description |
---|---|---|---|
thscode | futures varieties | character string | Chinese name of futures variety |
param | parameter | character string | Indicator parameters for semicolon concatenation |
Output:
field | field name | field description |
---|---|---|
errorcode | error ID | Code error code, errorcode=0 indicates that the code is running normally. If it is other, you need to find the cause of the error |
errmsg | error message | If errorcode returns non-zero, a specific error message is returned here. |
tables | structural body | Return content includes ID, time, etc. |
datatype | pointer format | Returns the metric format of the acquired data |
inputParams | input parameters | Returns the parameters entered |
perf | processing time | Total Time to Return Request Command (ms) |
dataVol | data size | Returns the amount of data consumed by the current command |
Examples:
THS_Special_StockLink('商品焦炭','thscode;thsname')
Returns the flush code and stock abbreviation corresponding to the commodity coke.
Fund Real-Time Valuation: THS_realTimeValuation
THS_realTimeValuation(thscode, param, output)
Returns the latest real-time valuation data for a given fund or all real-time valuations for the day.
Parameters:
parameter | name of parameter | parameter type | parametric description |
---|---|---|---|
thscode | fund varieties | character string | Requests for updated estimates are unlimited. The number of funds cannot exceed 500 when requesting historical estimates for all minutes of the day |
param | input parameters | character string | Indicator parameters for semicolon concatenation, such as 'onlyLast:0; initiTime:2020-08-10 09:15:00;endTime:2020-08-10 15:15:00' |
output | output setting | character string | Comma concatenation, used to control whether a column output, each set to column name and "Y" or "N" separated by a colon assignment. For example,'changeRatioValuation:Y,realTimeValuation:Y,Deviation 30TDays: Y', where' Y 'indicates output. |
Output:
field | field name | field description |
---|---|---|
errorcode | error ID | Code error code, errorcode=0 indicates that the code is running normally. If it is other, you need to find the cause of the error |
errmsg | error message | If errorcode returns non-zero, a specific error message is returned here. |
indicators | index information | Return all metrics information |
datatype | pointer format | Returns the metric format of the acquired data |
perf | processing time | Total Time to Return Request Command (ms) |
dataVol | data size | Returns the amount of data consumed by the current command |
time | time | Returns a list of times when data values were taken |
thscode | Subject information | Return all subject codes |
data | structural body | The returned content includes data content in specific formats such as dataframe, json, list, table, array, etc. |
THS_realTimeValuation('512880.SH','onlyLastest:0;beginTime:2024-12-06 09:15:00;endTime:2024-12-06 15:15:00','realTimeValuation:Y')
[data,errorcode,time,indicators,thscode,errmsg,dataVol,datatype,perf]=THS_realTimeValuation('512880.SH','onlyLastest:0;beginTime:2024-12-06 09:15:00;endTime:2024-12-06 15:15:00','realTimeValuation:Y','format:table')
THS_realTimeValuation('512880.SH','onlyLastest:0;beginTime:2024-12-06 09:15:00;endTime:2024-12-06 15:15:00','realTimeValuation:Y',TRUE)
'THS_realTimeValuation("512880.SH","onlyLastest:0;beginTime:2024-12-06 09:15:00;endTime:2024-12-06 15:15:00","realTimeValuation:Y")
THS_realTimeValuation("512880.SH","onlyLastest:0;beginTime:2024-12-06 09:15:00;endTime:2024-12-06 15:15:00","realTimeValuation:Y")
THS_realTimeValuation("512880.SH","onlyLastest:0;beginTime:2024-12-06 09:15:00;endTime:2024-12-06 15:15:00","realTimeValuation:Y")
THS_realTimeValuation("512880.SH","onlyLastest:0;beginTime:2024-12-06 09:15:00;endTime:2024-12-06 15:15:00","realTimeValuation:Y")
requestMethod:POST
requestURL:https://quantapi.51ifind.com/api/v1/fund_valuation
requestHeaders:{"Content-Type":"application/json","access_token":"","ifindlang":"cn"}
formData:{"codes":"512880.SH","functionpara":{"onlyLastest":"0","beginTime":"2024-12-06 09:15:00","endTime":"2024-12-06 15:15:00"},"outputpara":"realTimeValuation:Y"}
Get real-time fund valuation of 512880.SH (Securities ETF) on December 06, 2024.
Performance Function
Data Statistics: THS_DataStatistics
THS_DataStatistics()
Data statistics function does not need input parameters, in the interface language environment directly using THS_DataStatistics() function can be directly queried Use statistics to the corresponding data volume.
Output:
field | field name | field description |
---|---|---|
error ID | errorcode | The return code runs an error code, errorcode=0 indicates that the code runs normally. If it is other, you need to find the cause of the error |
error message | errmsg | If errorcode returns non-zero, a specific error message is returned here. |
structural body | tables | The returned content includes thscode, time, table (specific data content), etc. |
pointer format | datatype | Returns the metric format of the acquired data |
input parameters | inputParams | Returns the parameters entered |
processing time | perf | Total Time to Return Request Command (ms) |
data size | dataVol | Returns the amount of data consumed by the current command |
Examples:
THS_DataStatistics()
Obtain statistics of high frequency data, basic data and EDB data volume of this account.
Date Query: THS_DateQuery
THS_DateQuery(exchange, parameters, startDate, endDate)
This command is a function used to obtain the trading calendar of the exchange based on the entered start date and end date.
Parameters:
parameter | describe |
---|---|
exchange | Exchange English abbreviation, can only be a single input. For example 'SSE'. |
parameters | Parameters can be default parameters or customized according to the description. Parameters and parameters are separated by commas (','), and parameter assignments are colons ('😂. For example 'dateType:0,period:D,dateFormat: 0'. |
startDate | Start time, time format is Y-MM-DD, for example 2015-06-23. |
endDate | Deadline time, time format Y-MM-DD, for example 2016-06-23. |
Description of parameters: (parameters)
Exchange (required): | |||
---|---|---|---|
parameter | parameter values | parameter type | parametric description |
exchange | SSE | character string | Shanghai Stock Exchange |
exchange | SZSE | character string | Shenzhen Stock Exchange |
exchange | HKEX | character string | Hong Kong Exchanges and Clearing Limited |
exchange | YJZHQ | character string | interbank bond market |
exchange | NYSEARCA | character string | NYSE Arca |
exchange | NASDAQ | character string | NASDAQ Stock Exchange |
exchange | NYSE | character string | the New York Stock Exchange |
exchange | AMEX | character string | American Stock Exchange |
exchange | CZCE | character string | Zhengzhou Commodity Exchange |
exchange | SHFE | character string | Shanghai Futures Exchange |
exchange | DCE | character string | Dalian Commodity Exchange |
exchange | BMD | character string | Malaysian Derivatives Exchange |
exchange | NYBOT | character string | New York Futures Exchange |
exchange | COMEX | character string | New York Mercantile Exchange |
exchange | NYMEX | character string | New York Mercantile Exchange |
exchange | CBOT | character string | Chicago Mercantile Exchange |
exchange | ICE | character string | Intercontinental Exchange |
Example:"SSE"
Date Type (optional): | |||
---|---|---|---|
parameter | parameter values | parameter type | parametric description |
dateType | 0 | plastic | trading day |
dateType | 1 | plastic | calendar days |
Example:"dateType:0",Default dateType: 0
Time period (optional): | |||
---|---|---|---|
parameter | parameter values | parameter type | parametric description |
period | D | character string | day |
period | W | character string | week |
period | M | character string | month |
period | Q | character string | season |
period | S | character string | half a year |
period | Y | character string | year |
Example:"period:D", Default period: D
Date output format (optional): | |||
---|---|---|---|
parameter | parameter values | parameter type | parametric description |
dateFormat | 0 | plastic | YYYY-MM-DD |
dateFormat | 1 | plastic | YYYY/MM/DD |
dateFormat | 2 | plastic | YYYYMMDD |
Example:"dateFormat:0",Default dateFormat: 0
Start date (required): | |||
---|---|---|---|
parameter | parameter values | parameter type | parametric description |
StartDate | \ | character string | Start date of date series |
Example:'2024-12-01'
Deadline (required): | |||
---|---|---|---|
parameter | parameter values | parameter type | parametric description |
EndDate | \ | character string | Deadline date of date series. If blank, default to current date of system. |
Example:'2024-12-06'
Output:
field | field name | field description |
---|---|---|
error ID | errorcode | The return code runs an error code, errorcode=0 indicates that the code runs normally. If it is other, you need to find the cause of the error |
error message | errmsg | If errorcode returns non-zero, a specific error message is returned here. |
structural body | tables | The returned content includes thscode, time, table (specific data content), etc. |
pointer format | datatype | Returns the metric format of the acquired data |
input parameters | inputParams | Returns the parameters entered |
processing time | perf | Total Time to Return Request Command (ms) |
data size | dataVol | Returns the amount of data consumed by the current command |
Examples:
THS_DateQuery('SSE','dateType:0,period:D,dateFormat:0','2019-06-01','2019-06-06')
Date Offset: THS_DateOffset
THS_DateOffset(exchange, parameters, startDate, endDate)
This command is used to obtain the date function of the corresponding set parameter according to the input date and offset.
Parameters:
parameter | describe |
---|---|
exchange | The English short name of the exchange can only be entered individually. For example 'SSE'. |
parameters | Parameters can be default parameters or customized according to the description. Parameters and parameters are separated by commas (','), and parameter assignments are colons ('😂. For example 'dateType:0,period:D,dateFormat: 0'. |
startDate | Start time, time format is Y-MM-DD, for example 2015 - 06 - 23. |
endDate | Deadline time, time format Y-MM-DD, for example 2016-06-23. |
Description of parameters: (parameters)
Exchange (required): | |||
---|---|---|---|
parameter | parameter values | parameter type | parametric description |
exchange | SSE | character string | Shanghai Stock Exchange |
exchange | SZSE | character string | Shenzhen Stock Exchange |
exchange | HKEX | character string | Hong Kong Exchanges and Clearing Limited |
exchange | YJZHQ | character string | interbank bond market |
exchange | NYSEARCA | character string | NYSE Arca |
exchange | NASDAQ | character string | NASDAQ Stock Exchange |
exchange | NYSE | character string | the New York Stock Exchange |
exchange | AMEX | character string | American Stock Exchange |
exchange | CZCE | character string | Zhengzhou Commodity Exchange |
exchange | SHFE | character string | Shanghai Futures Exchange |
exchange | DCE | character string | Dalian Commodity Exchange |
exchange | BMD | character string | Malaysian Derivatives Exchange |
exchange | NYBOT | character string | New York Futures Exchange |
exchange | COMEX | character string | New York Mercantile Exchange |
exchange | NYMEX | character string | New York Mercantile Exchange |
exchange | CBOT | character string | Chicago Mercantile Exchange |
exchange | ICE | character string | Intercontinental Exchange |
Example:"SSE"
Date Type (optional): | |||
---|---|---|---|
parameter | parameter values | parameter type | parametric description |
dateType | 0 | plastic | trading day |
dateType | 1 | plastic | calendar days |
Example:"dateType:0",Default dateType: 0
Offset (optional): | |||
---|---|---|---|
parameter | parameter values | parameter type | parametric description |
offset | \ | plastic | The value entered is the offset days, positive for forward offset, negative for backward offset |
Example:"offset:1",Default offset: 1
Time period (optional): | |||
---|---|---|---|
parameter | parameter values | parameter type | parametric description |
period | D | character string | day |
period | W | character string | week |
period | M | character string | month |
period | Q | character string | season |
period | S | character string | half a year |
period | Y | character string | year |
Example:"period:D",Default period: D
Date output format (optional): | |||
---|---|---|---|
parameter | parameter values | parameter type | parametric description |
dateFormat | 0 | plastic | YYYY-MM-DD |
dateFormat | 1 | plastic | YYYY/MM/DD |
dateFormat | 2 | plastic | YYYYMMDD |
Example:"dateFormat:0",Default dateFormat: 0
Reference date (required): | |||
---|---|---|---|
parameter | parameter values | parameter type | parametric description |
sdate | \ | character string | Reference date, default system current date |
Example:"2019-01-01"
Output:
field | field name | field description |
---|---|---|
error ID | errorcode | The return code runs an error code, errorcode=0 indicates that the code runs normally. If it is other, you need to find the cause of the error |
error message | errmsg | If errorcode returns non-zero, a specific error message is returned here. |
structural body | tables | The returned content includes thscode, time, table (specific data content), etc. |
pointer format | datatype | Returns the metric format of the acquired data |
input parameters | inputParams | Returns the parameters entered |
processing time | perf | Total Time to Return Request Command (ms) |
data size | dataVol | Returns the amount of data consumed by the current command |
Examples:
THS_DateOffset('SSE','dateType:0,period:D,offset:-5,dateFormat:0','2019-06-06')
Get the date sequence of all trading days pushed forward 5 days before June 6,2019 on Shanghai Stock Exchange.