Files
MoFin/venv/lib/python3.12/site-packages/akshare/futures/futures_comm_ctp.py
T
知微 fa45d8aa5f fix: 小果地址统一node122(兼容LAN+EasyTier)
- health_checklist.json: 192.168.1.122→node122
- ocr_client.py: docstring IP→node122
- docs/market-data-requirements.md: IP→node122
- 所有API调用通过ProxyHandler({})绕过系统代理
  Privoxy对node122:18003返回500,直连正常
2026-06-30 02:56:35 +08:00

38 lines
1003 B
Python

#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Date: 2024/7/6 18:00
Desc: openctp 期货交易费用参照表
http://openctp.cn/fees.html
"""
from datetime import datetime
from io import StringIO
import pandas as pd
import requests
from bs4 import BeautifulSoup
def futures_fees_info() -> pd.DataFrame:
"""
openctp 期货交易费用参照表
http://openctp.cn/fees.html
:return: 期货交易费用参照表
:rtype: pandas.DataFrame
"""
url = "http://openctp.cn/fees.html"
r = requests.get(url)
r.encoding = "utf-8"
soup = BeautifulSoup(r.text, features="lxml")
datetime_str = soup.find("p").string.strip("Generated at ").strip(".")
datetime_raw = datetime.strptime(datetime_str, "%Y-%m-%d %H:%M:%S")
temp_df = pd.read_html(StringIO(r.text))[0]
temp_df["更新时间"] = datetime_raw.strftime("%Y-%m-%d %H:%M:%S")
return temp_df
if __name__ == "__main__":
futures_fees_info_df = futures_fees_info()
print(futures_fees_info_df)