save
This commit is contained in:
commit
6ff6c0e8b0
4
Dockerfile
Normal file
4
Dockerfile
Normal file
@ -0,0 +1,4 @@
|
||||
FROM ubuntu:latest
|
||||
LABEL authors="Cheney"
|
||||
|
||||
ENTRYPOINT ["top", "-b"]
|
||||
6
main.py
Normal file
6
main.py
Normal file
@ -0,0 +1,6 @@
|
||||
import akshare as ak
|
||||
import sh000300
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(ak.__version__)
|
||||
sh000300.day()
|
||||
34
pushplus.py
Normal file
34
pushplus.py
Normal 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
14
sh000300.py
Normal 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}")
|
||||
Loading…
Reference in New Issue
Block a user