期货量化001:获取玉米主连的数据到execel表中

用efinance库:

import efinance as ef
import pandas as pd

# 获取期货基本信息
futures_info = ef.futures.get_futures_base_info()

# 根据名称找到玉米主力的行情ID
corn_quote_id = futures_info[futures_info['期货名称'] == '玉米主连']['行情ID'].values[0]

# 获取玉米的日K线数据
corn_history = ef.futures.get_quote_history(corn_quote_id)

# 将数据保存到Excel文件
corn_history.to_excel('corn_kline_data.xlsx', index=False)

效果:

相关推荐

  1. python-pandas获取excel每个sheet名称

    2024-02-23 17:28:10       36 阅读
  2. C#winform点击按钮下载数据库字段Excel

    2024-02-23 17:28:10       59 阅读
  3. pgsql 多个模式相同获取

    2024-02-23 17:28:10       29 阅读
  4. 输出数据excel

    2024-02-23 17:28:10       25 阅读
  5. 如何统计EXCEL数据透视信息?

    2024-02-23 17:28:10       33 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-02-23 17:28:10       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-02-23 17:28:10       106 阅读
  3. 在Django里面运行非项目文件

    2024-02-23 17:28:10       87 阅读
  4. Python语言-面向对象

    2024-02-23 17:28:10       96 阅读

热门阅读

  1. Redis实现去重任务队列

    2024-02-23 17:28:10       64 阅读
  2. SpringBoot事务传播机制

    2024-02-23 17:28:10       47 阅读
  3. ELEC362 C++ Department of Electrical Engineering and Electronics

    2024-02-23 17:28:10       43 阅读
  4. jquery简介与解析

    2024-02-23 17:28:10       45 阅读
  5. 回调函数(Language C)

    2024-02-23 17:28:10       50 阅读
  6. Less基本语法

    2024-02-23 17:28:10       48 阅读