Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何从Alpha Vantage API中提取数据?_Python_Json_Extract - Fatal编程技术网

Python 如何从Alpha Vantage API中提取数据?

Python 如何从Alpha Vantage API中提取数据?,python,json,extract,Python,Json,Extract,我想对股票进行RSI预警 这是Alpha Vantage API响应我请求的数据。我想在运行代码时提取最新的RSI 在本例中,它是77.0835。由于日期和时间(即2020-01-24 14:30)不断变化,有什么方法可以获得最新的RSI Alpha Vantage的响应摘录: { "Meta Data": { "1: Symbol": "tlt", "2: Indicator": "Relative Strength Index (RSI)",

我想对股票进行RSI预警

这是Alpha Vantage API响应我请求的数据。我想在运行代码时提取最新的RSI

在本例中,它是77.0835。由于日期和时间(即2020-01-24 14:30)不断变化,有什么方法可以获得最新的RSI

Alpha Vantage的响应摘录:

{
    "Meta Data": {
        "1: Symbol": "tlt",
        "2: Indicator": "Relative Strength Index (RSI)",
        "3: Last Refreshed": "2020-01-24 14:30:46",
        "4: Interval": "60min",
        "5: Time Period": 14,
        "6: Series Type": "close",
        "7: Time Zone": "US/Eastern Time"
    },
    "Technical Analysis: RSI": {
        "2020-01-24 14:30": {
            "RSI": "77.0835"
        },
        "2020-01-24 13:30": {
            "RSI": "78.0121"
        },
        "2020-01-24 12:30": {
            "RSI": "75.8201"
        },
        "2020-01-24 11:30": {
            "RSI": "75.7447"
        },
        "2020-01-24 10:30": {
            "RSI": "73.9965"
        },
        "2020-01-24 09:30": {
            "RSI": "73.8768"
        }

这个怎么样

data = {
    "Meta Data": {
        "1: Symbol": "tlt",
        "2: Indicator": "Relative Strength Index (RSI)",
        "3: Last Refreshed": "2020-01-24 14:30:46",
        "4: Interval": "60min",
        "5: Time Period": 14,
        "6: Series Type": "close",
        "7: Time Zone": "US/Eastern Time"
    },
    "Technical Analysis: RSI": {
        "2020-01-24 14:30": {
            "RSI": "77.0835"
        },
        "2020-01-24 13:30": {
            "RSI": "78.0121"
        },
        "2020-01-24 12:30": {
            "RSI": "75.8201"
        },
        "2020-01-24 11:30": {
            "RSI": "75.7447"
        },
        "2020-01-24 10:30": {
            "RSI": "73.9965"
        },
        "2020-01-24 09:30": {
            "RSI": "73.8768"
        }
    }
}

most_recent_rsi = data['Technical Analysis: RSI'][sorted(data['Technical Analysis: RSI'])[-1]]

使用上次刷新的日期时间访问它。