{
  "service": "tushare",
  "displayName": "Tushare",
  "categories": [
    "Finance",
    "Data"
  ],
  "authTypes": [
    "api_key"
  ],
  "auth": [
    {
      "type": "api_key",
      "label": "Tushare Token",
      "placeholder": "TUSHARE_TOKEN",
      "description": "Tushare token used as the token field in HTTP API requests. Log in, open Personal Center > Account and TOKEN, then copy it as documented at https://tushare.pro/document/1?doc_id=39.",
      "extraFields": []
    }
  ],
  "homepageUrl": "https://tushare.pro",
  "actions": [
    {
      "id": "tushare.get_adjustment_factors",
      "service": "tushare",
      "name": "get_adjustment_factors",
      "description": "Get A-share adjustment factor rows through Tushare adj_factor.",
      "requiredScopes": [],
      "providerPermissions": [],
      "inputSchema": {
        "type": "object",
        "properties": {
          "tsCode": {
            "type": "string",
            "minLength": 1,
            "description": "Tushare security code, such as 000001.SZ."
          },
          "tradeDate": {
            "type": "string",
            "minLength": 8,
            "maxLength": 8,
            "description": "Trade date in YYYYMMDD format.",
            "pattern": "^[0-9]{8}$"
          },
          "startDate": {
            "type": "string",
            "minLength": 8,
            "maxLength": 8,
            "description": "Start date in YYYYMMDD format.",
            "pattern": "^[0-9]{8}$"
          },
          "endDate": {
            "type": "string",
            "minLength": 8,
            "maxLength": 8,
            "description": "End date in YYYYMMDD format.",
            "pattern": "^[0-9]{8}$"
          }
        },
        "additionalProperties": false,
        "description": "Filters for the Tushare get_adjustment_factors API. Provide tsCode, tradeDate, or both startDate and endDate."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "description": "Tushare request identifier returned by the API."
          },
          "message": {
            "anyOf": [
              {
                "type": "string",
                "description": "Tushare response message, or null for successful responses."
              },
              {
                "type": "null"
              }
            ]
          },
          "adjustmentFactors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "tsCode": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "Tushare security code."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "tradeDate": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "Trade date in YYYYMMDD format."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "adjFactor": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Adjustment factor."
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "additionalProperties": false,
              "description": "One adj_factor row."
            },
            "description": "Adjustment factor rows returned by Tushare."
          }
        },
        "additionalProperties": false,
        "required": [
          "requestId",
          "message",
          "adjustmentFactors"
        ],
        "description": "Adjustment factor rows returned by Tushare."
      }
    },
    {
      "id": "tushare.get_daily_basic",
      "service": "tushare",
      "name": "get_daily_basic",
      "description": "Get A-share daily valuation and share indicators through Tushare daily_basic.",
      "requiredScopes": [],
      "providerPermissions": [],
      "inputSchema": {
        "type": "object",
        "properties": {
          "tsCode": {
            "type": "string",
            "minLength": 1,
            "description": "Tushare security code, such as 000001.SZ."
          },
          "tradeDate": {
            "type": "string",
            "minLength": 8,
            "maxLength": 8,
            "description": "Trade date in YYYYMMDD format.",
            "pattern": "^[0-9]{8}$"
          },
          "startDate": {
            "type": "string",
            "minLength": 8,
            "maxLength": 8,
            "description": "Start date in YYYYMMDD format.",
            "pattern": "^[0-9]{8}$"
          },
          "endDate": {
            "type": "string",
            "minLength": 8,
            "maxLength": 8,
            "description": "End date in YYYYMMDD format.",
            "pattern": "^[0-9]{8}$"
          }
        },
        "additionalProperties": false,
        "description": "Filters for the Tushare get_daily_basic API. Provide tsCode, tradeDate, or both startDate and endDate."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "description": "Tushare request identifier returned by the API."
          },
          "message": {
            "anyOf": [
              {
                "type": "string",
                "description": "Tushare response message, or null for successful responses."
              },
              {
                "type": "null"
              }
            ]
          },
          "dailyBasics": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "tsCode": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "Tushare security code."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "tradeDate": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "Trade date in YYYYMMDD format."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "close": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Close price."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "turnoverRate": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Turnover rate."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "turnoverRateF": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Free-float turnover rate."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "volumeRatio": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Volume ratio."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "pe": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Price-to-earnings ratio."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "peTtm": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Trailing price-to-earnings ratio."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "pb": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Price-to-book ratio."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "ps": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Price-to-sales ratio."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "psTtm": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Trailing price-to-sales ratio."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "dvRatio": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Dividend yield ratio."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "dvTtm": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Trailing dividend yield ratio."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "totalShare": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Total shares."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "floatShare": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Floating shares."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "freeShare": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Free-float shares."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "totalMv": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Total market value."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "circMv": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Circulating market value."
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "additionalProperties": false,
              "description": "One daily_basic row."
            },
            "description": "Daily basic indicator rows returned by Tushare."
          }
        },
        "additionalProperties": false,
        "required": [
          "requestId",
          "message",
          "dailyBasics"
        ],
        "description": "Daily basic indicator rows returned by Tushare."
      }
    },
    {
      "id": "tushare.get_daily_quotes",
      "service": "tushare",
      "name": "get_daily_quotes",
      "description": "Get A-share daily quote rows through Tushare daily with normalized rows.",
      "requiredScopes": [],
      "providerPermissions": [],
      "inputSchema": {
        "type": "object",
        "properties": {
          "tsCode": {
            "type": "string",
            "minLength": 1,
            "description": "Tushare security code, such as 000001.SZ."
          },
          "tradeDate": {
            "type": "string",
            "minLength": 8,
            "maxLength": 8,
            "description": "Trade date in YYYYMMDD format.",
            "pattern": "^[0-9]{8}$"
          },
          "startDate": {
            "type": "string",
            "minLength": 8,
            "maxLength": 8,
            "description": "Start date in YYYYMMDD format.",
            "pattern": "^[0-9]{8}$"
          },
          "endDate": {
            "type": "string",
            "minLength": 8,
            "maxLength": 8,
            "description": "End date in YYYYMMDD format.",
            "pattern": "^[0-9]{8}$"
          }
        },
        "additionalProperties": false,
        "description": "Filters for the Tushare get_daily_quotes API. Provide tsCode, tradeDate, or both startDate and endDate."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "description": "Tushare request identifier returned by the API."
          },
          "message": {
            "anyOf": [
              {
                "type": "string",
                "description": "Tushare response message, or null for successful responses."
              },
              {
                "type": "null"
              }
            ]
          },
          "quotes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "tsCode": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "Tushare security code."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "tradeDate": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "Trade date in YYYYMMDD format."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "open": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Open price."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "high": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "High price."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "low": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Low price."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "close": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Close price."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "preClose": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Previous close price."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "change": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Price change."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "pctChg": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Percentage change."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "vol": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Trading volume in lots."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "amount": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Trading amount."
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "additionalProperties": false,
              "description": "One daily quote row."
            },
            "description": "Daily quote rows returned by Tushare."
          }
        },
        "additionalProperties": false,
        "required": [
          "requestId",
          "message",
          "quotes"
        ],
        "description": "Daily quote rows returned by Tushare."
      }
    },
    {
      "id": "tushare.get_trade_calendar",
      "service": "tushare",
      "name": "get_trade_calendar",
      "description": "Get exchange trading calendar rows through Tushare trade_cal with normalized dates.",
      "requiredScopes": [],
      "providerPermissions": [],
      "inputSchema": {
        "type": "object",
        "properties": {
          "exchange": {
            "type": "string",
            "minLength": 1,
            "description": "Exchange code, such as SSE or SZSE."
          },
          "startDate": {
            "type": "string",
            "minLength": 8,
            "maxLength": 8,
            "description": "Start date in YYYYMMDD format.",
            "pattern": "^[0-9]{8}$"
          },
          "endDate": {
            "type": "string",
            "minLength": 8,
            "maxLength": 8,
            "description": "End date in YYYYMMDD format.",
            "pattern": "^[0-9]{8}$"
          },
          "isOpen": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1,
            "description": "Whether to return open days only, where 1 is open and 0 is closed."
          }
        },
        "additionalProperties": false,
        "required": [
          "startDate",
          "endDate"
        ],
        "description": "Filters for the Tushare trade_cal API."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "description": "Tushare request identifier returned by the API."
          },
          "message": {
            "anyOf": [
              {
                "type": "string",
                "description": "Tushare response message, or null for successful responses."
              },
              {
                "type": "null"
              }
            ]
          },
          "calendar": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "exchange": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "Exchange code."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "calDate": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "Calendar date in YYYYMMDD format."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "isOpen": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "description": "Whether the date is an open trading day, where 1 is open."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "pretradeDate": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "Previous trading date in YYYYMMDD format."
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "additionalProperties": false,
              "description": "One trade_cal row."
            },
            "description": "Trade calendar rows returned by Tushare."
          }
        },
        "additionalProperties": false,
        "required": [
          "requestId",
          "message",
          "calendar"
        ],
        "description": "Trade calendar rows returned by Tushare."
      }
    },
    {
      "id": "tushare.list_stocks",
      "service": "tushare",
      "name": "list_stocks",
      "description": "List A-share stock basic information through Tushare stock_basic with normalized rows.",
      "requiredScopes": [],
      "providerPermissions": [],
      "inputSchema": {
        "type": "object",
        "properties": {
          "exchange": {
            "type": "string",
            "minLength": 1,
            "description": "Exchange code, such as SSE, SZSE, or BSE."
          },
          "listStatus": {
            "type": "string",
            "enum": [
              "L",
              "D",
              "P"
            ],
            "description": "Listing status: L listed, D delisted, P paused."
          },
          "isHs": {
            "type": "string",
            "enum": [
              "N",
              "H",
              "S"
            ],
            "description": "Shanghai-Hong Kong or Shenzhen-Hong Kong Stock Connect flag."
          }
        },
        "additionalProperties": false,
        "description": "Filters for the Tushare stock_basic API."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "description": "Tushare request identifier returned by the API."
          },
          "message": {
            "anyOf": [
              {
                "type": "string",
                "description": "Tushare response message, or null for successful responses."
              },
              {
                "type": "null"
              }
            ]
          },
          "stocks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "tsCode": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "Tushare security code."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "symbol": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "Exchange-local security symbol."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "name": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "Chinese security name."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "area": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "Company region."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "industry": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "Company industry."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "market": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "Market board name."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "exchange": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "Exchange code."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "listStatus": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "Listing status."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "listDate": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "Listing date in YYYYMMDD format."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "delistDate": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "Delisting date in YYYYMMDD format when present."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "isHs": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "Stock Connect flag when present."
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "additionalProperties": false,
              "description": "One stock_basic row."
            },
            "description": "Stocks returned by Tushare."
          }
        },
        "additionalProperties": false,
        "required": [
          "requestId",
          "message",
          "stocks"
        ],
        "description": "Stocks returned by Tushare stock_basic."
      }
    },
    {
      "id": "tushare.query_data",
      "service": "tushare",
      "name": "query_data",
      "description": "Call a Tushare data API through the official HTTP interface and return normalized table rows.",
      "requiredScopes": [],
      "providerPermissions": [],
      "inputSchema": {
        "type": "object",
        "properties": {
          "apiName": {
            "type": "string",
            "minLength": 1,
            "description": "Tushare API name, such as stock_basic, trade_cal, or daily."
          },
          "params": {
            "type": "object",
            "additionalProperties": {
              "description": "A JSON-compatible value returned by Tushare."
            },
            "description": "Tushare API parameters passed as the official params object."
          },
          "fields": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "description": "Comma-separated Tushare field list, such as ts_code,name,list_date."
              },
              {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "description": "One Tushare field name."
                },
                "description": "List of Tushare field names to request.",
                "minItems": 1
              }
            ],
            "description": "Fields to request from Tushare, as a comma string or string list."
          }
        },
        "additionalProperties": false,
        "required": [
          "apiName"
        ],
        "description": "Input payload for calling one Tushare HTTP API by name."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "description": "Tushare request identifier returned by the API."
          },
          "message": {
            "anyOf": [
              {
                "type": "string",
                "description": "Tushare response message, or null for successful responses."
              },
              {
                "type": "null"
              }
            ]
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "One Tushare response field name."
            },
            "description": "Field names returned by Tushare in table order."
          },
          "items": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "description": "A JSON-compatible value returned by Tushare."
              },
              "description": "One raw Tushare response row."
            },
            "description": "Raw Tushare row arrays aligned with the fields list."
          },
          "rows": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {
                "description": "A JSON-compatible value returned by Tushare."
              },
              "description": "One projected Tushare row object."
            },
            "description": "Rows projected into objects keyed by Tushare field names."
          }
        },
        "additionalProperties": false,
        "required": [
          "requestId",
          "message",
          "fields",
          "items",
          "rows"
        ],
        "description": "Normalized Tushare tabular response."
      }
    }
  ]
}
