添加巨量ip的代理池 https://www.juliangip.com/users/
This commit is contained in:
@@ -26,3 +26,4 @@ TA-Lib
|
|||||||
tabulate
|
tabulate
|
||||||
|
|
||||||
playwright>=1.45.1
|
playwright>=1.45.1
|
||||||
|
retry>=0.9.2
|
||||||
@@ -3,7 +3,7 @@ from db_config import DatabaseManager, DatabaseConfig
|
|||||||
from loguru import logger
|
from loguru import logger
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import akshare as ak
|
import akshare as ak
|
||||||
# from index_downloader import get_all_stock_index
|
from index_downloader import get_all_stock_index
|
||||||
from em_index_sport import get_index_latest_data
|
from em_index_sport import get_index_latest_data
|
||||||
import schedule
|
import schedule
|
||||||
import time
|
import time
|
||||||
@@ -11,12 +11,25 @@ import traceback
|
|||||||
from dingtalk import DingTalkBot
|
from dingtalk import DingTalkBot
|
||||||
import os
|
import os
|
||||||
from signal_calc import main_calc_process
|
from signal_calc import main_calc_process
|
||||||
|
import requests
|
||||||
|
from retry import retry
|
||||||
|
|
||||||
webhook = "https://oapi.dingtalk.com/robot/send?access_token=21de667159edadd33172c6ec414a2addf9c6359189350ffd36819d2a20e8a0f4"
|
webhook = "https://oapi.dingtalk.com/robot/send?access_token=21de667159edadd33172c6ec414a2addf9c6359189350ffd36819d2a20e8a0f4"
|
||||||
secret = "SEC43a0fa0b29717f98637a119b92a0bd5f7b2b6da671bdd2bd1279ed8323454d5e"
|
secret = "SEC43a0fa0b29717f98637a119b92a0bd5f7b2b6da671bdd2bd1279ed8323454d5e"
|
||||||
dingtalk = DingTalkBot(webhook, secret)
|
dingtalk = DingTalkBot(webhook, secret)
|
||||||
|
|
||||||
|
|
||||||
|
def set_proxy():
|
||||||
|
url = "http://v2.api.juliangip.com/company/postpay/getips?auto_white=1&num=1&pt=1&result_type=json&trade_no=6735165951220899&sign=bd763049a68b4b817608520dad35ea25"
|
||||||
|
r = requests.get(url)
|
||||||
|
data = r.json()
|
||||||
|
logger.info(data)
|
||||||
|
proxy = data["data"]["proxy_list"][0]
|
||||||
|
os.environ["https_proxy"] = f"http://{proxy}"
|
||||||
|
os.environ["http_proxy"] = f"http://{proxy}"
|
||||||
|
|
||||||
|
|
||||||
|
@retry(tries=3, delay=10)
|
||||||
def get_latest_index_kline_date():
|
def get_latest_index_kline_date():
|
||||||
# df = pd.read_csv(
|
# df = pd.read_csv(
|
||||||
# "/Users/aszer/Documents/vscode/etf/index_all_stock.csv", encoding="utf-8-sig"
|
# "/Users/aszer/Documents/vscode/etf/index_all_stock.csv", encoding="utf-8-sig"
|
||||||
@@ -25,8 +38,9 @@ def get_latest_index_kline_date():
|
|||||||
# "/Users/aszer/Documents/vscode/etf/data/index_history_data/000001.csv",
|
# "/Users/aszer/Documents/vscode/etf/data/index_history_data/000001.csv",
|
||||||
# encoding="utf-8-sig",
|
# encoding="utf-8-sig",
|
||||||
# )
|
# )
|
||||||
# df = get_all_stock_index()
|
set_proxy()
|
||||||
df = get_index_latest_data()
|
df = get_all_stock_index()
|
||||||
|
# df = get_index_latest_data()
|
||||||
column_mapping = {
|
column_mapping = {
|
||||||
"date": "date",
|
"date": "date",
|
||||||
"代码": "code",
|
"代码": "code",
|
||||||
@@ -67,6 +81,8 @@ def get_latest_index_kline_date():
|
|||||||
index_hist = index_hist_df.to_dict(orient="records")[0]
|
index_hist = index_hist_df.to_dict(orient="records")[0]
|
||||||
hist_date = index_hist["日期"]
|
hist_date = index_hist["日期"]
|
||||||
df["date"] = hist_date
|
df["date"] = hist_date
|
||||||
|
df.dropna(how="any", inplace=True)
|
||||||
|
# df.to_csv(f"aaaa.csv", index=False, encoding="utf-8-sig")
|
||||||
return df
|
return df
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user