{
    "openapi": "3.0.0",
    "info": {
        "title": "原油价格 - API文档",
        "version": "1.0.0",
        "description": "查询国际原油的价格和涨跌情况，请求参数code传递原油代码。wti代表 WTI原油（NYMEX原油），blt代表布伦特原油。"
    },
    "servers": [
        {
            "url": "https:\/\/apis.tianapi.com"
        }
    ],
    "paths": {
        "\/crude\/index": {
            "get": {
                "summary": "原油价格查询",
                "tags": [
                    "原油价格"
                ],
                "description": "根据原油代号查询原油价格信息",
                "parameters": [
                    {
                        "name": "key",
                        "in": "query",
                        "description": "API密钥",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "description": "API密钥"
                        }
                    },
                    {
                        "name": "code",
                        "in": "query",
                        "description": "原油种类代码，wti:WTI原油、blt:布伦特原油",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "example": "wti",
                            "description": "原油种类代码，wti:WTI原油、blt:布伦特原油"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "成功响应",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "name": {
                                            "type": "string",
                                            "example": "WTI原油(NYMEX原油)",
                                            "description": "原油名称"
                                        },
                                        "diffnum": {
                                            "type": "string",
                                            "example": "0.2",
                                            "description": "涨跌额"
                                        },
                                        "diffrate": {
                                            "type": "string",
                                            "example": "0.36%",
                                            "description": "涨跌幅"
                                        },
                                        "nowprice": {
                                            "type": "float",
                                            "example": 57.444,
                                            "description": "当前价格，单位 美元\/桶"
                                        },
                                        "stocknum": {
                                            "type": "string",
                                            "example": "352155.000",
                                            "description": "持仓量，单位千桶"
                                        },
                                        "todaymax": {
                                            "type": "string",
                                            "example": "57.480",
                                            "description": "今日最高价"
                                        },
                                        "todaymin": {
                                            "type": "string",
                                            "example": "今日最低价",
                                            "description": "开盘价"
                                        },
                                        "openprice": {
                                            "type": "string",
                                            "example": "57.080",
                                            "description": "今日开盘价"
                                        },
                                        "closeprice": {
                                            "type": "string",
                                            "example": "57.240",
                                            "description": "昨日结算价"
                                        },
                                        "updatetime": {
                                            "type": "string",
                                            "example": "2019-11-09 05:59:57",
                                            "description": "更新时间"
                                        }
                                    }
                                },
                                "example": {
                                    "msg": "success",
                                    "code": 200,
                                    "result": {
                                        "name": "WTI原油(NYMEX原油)",
                                        "diffnum": "0.2",
                                        "diffrate": "0.36%",
                                        "nowprice": 57.444,
                                        "stocknum": "352155.000",
                                        "todaymax": "57.480",
                                        "todaymin": "55.760",
                                        "openprice": "57.080",
                                        "closeprice": "57.240",
                                        "updatetime": "2019-11-09 05:59:57"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "summary": "原油价格查询",
                "tags": [
                    "原油价格"
                ],
                "description": "根据原油代号查询原油价格信息",
                "requestBody": {
                    "content": {
                        "application\/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "key": {
                                        "type": "string",
                                        "description": "API密钥"
                                    },
                                    "code": {
                                        "type": "string",
                                        "example": "wti",
                                        "description": "原油种类代码，wti:WTI原油、blt:布伦特原油"
                                    }
                                },
                                "required": [
                                    "key",
                                    "code"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "成功响应",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "name": {
                                            "type": "string",
                                            "example": "WTI原油(NYMEX原油)",
                                            "description": "原油名称"
                                        },
                                        "diffnum": {
                                            "type": "string",
                                            "example": "0.2",
                                            "description": "涨跌额"
                                        },
                                        "diffrate": {
                                            "type": "string",
                                            "example": "0.36%",
                                            "description": "涨跌幅"
                                        },
                                        "nowprice": {
                                            "type": "float",
                                            "example": 57.444,
                                            "description": "当前价格，单位 美元\/桶"
                                        },
                                        "stocknum": {
                                            "type": "string",
                                            "example": "352155.000",
                                            "description": "持仓量，单位千桶"
                                        },
                                        "todaymax": {
                                            "type": "string",
                                            "example": "57.480",
                                            "description": "今日最高价"
                                        },
                                        "todaymin": {
                                            "type": "string",
                                            "example": "今日最低价",
                                            "description": "开盘价"
                                        },
                                        "openprice": {
                                            "type": "string",
                                            "example": "57.080",
                                            "description": "今日开盘价"
                                        },
                                        "closeprice": {
                                            "type": "string",
                                            "example": "57.240",
                                            "description": "昨日结算价"
                                        },
                                        "updatetime": {
                                            "type": "string",
                                            "example": "2019-11-09 05:59:57",
                                            "description": "更新时间"
                                        }
                                    }
                                },
                                "example": {
                                    "msg": "success",
                                    "code": 200,
                                    "result": {
                                        "name": "WTI原油(NYMEX原油)",
                                        "diffnum": "0.2",
                                        "diffrate": "0.36%",
                                        "nowprice": 57.444,
                                        "stocknum": "352155.000",
                                        "todaymax": "57.480",
                                        "todaymin": "55.760",
                                        "openprice": "57.080",
                                        "closeprice": "57.240",
                                        "updatetime": "2019-11-09 05:59:57"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}