This commit is contained in:
cheney 2025-07-21 20:55:01 +08:00
commit 6ff6c0e8b0
4 changed files with 58 additions and 0 deletions

4
Dockerfile Normal file
View File

@ -0,0 +1,4 @@
FROM ubuntu:latest
LABEL authors="Cheney"
ENTRYPOINT ["top", "-b"]

6
main.py Normal file
View File

@ -0,0 +1,6 @@
import akshare as ak
import sh000300
if __name__ == '__main__':
print(ak.__version__)
sh000300.day()

34
pushplus.py Normal file
View File

@ -0,0 +1,34 @@
import requests
import json
import logging
logger = logging.getLogger(__name__)
token = "14d265653e8247dcbdefb7d83d1fe26e"
url = "https://www.pushplus.plus/send"
headers = {
"Content-Type": "application/json"
}
def send_msg(title, content):
logger.info("msg title: {}".format(title))
logger.info("msg content: {}".format(content))
payload = {
"token": token,
"title": title,
"content": content,
"template": "html",
"channel": "wechat"
}
response = requests.post(url, headers=headers, data=json.dumps(payload))
logger.info("response code: {}".format(response.status_code))
logger.info("response data: {}".format(response.text))
return {
"code" : response.status_code,
"data" : response.text
}
if __name__ == '__main__':
ret = send_msg("Python 测试", "测试通知内容")
print(ret)

14
sh000300.py Normal file
View File

@ -0,0 +1,14 @@
import akshare as ak
def day():
# 获取收盘价
index_data = ak.stock_zh_index_daily(symbol="sh000300") # 上海证券交易所代码 sh000300
latest_close = index_data.iloc[-1]["close"] # 获取最新收盘价
print(f"沪深300指数000300最新收盘价: {latest_close}")
# 获取沪深300指数实时行情需在交易时间段内运行
# index_realtime = ak.stock_zh_ah_spot() # 获取所有指数实时行情
# sh000300_realtime = index_realtime[index_realtime["代码"] == "000300"] # 筛选沪深300指数
# current_price = sh000300_realtime["最新价"].values[0]
# print(f"沪深300指数000300当前实时价格: {current_price}")