添加巨量ip的代理池 https://www.juliangip.com/users/
This commit is contained in:
@@ -25,4 +25,5 @@ akshare
|
||||
TA-Lib
|
||||
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 datetime import datetime
|
||||
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
|
||||
import schedule
|
||||
import time
|
||||
@@ -11,12 +11,25 @@ import traceback
|
||||
from dingtalk import DingTalkBot
|
||||
import os
|
||||
from signal_calc import main_calc_process
|
||||
import requests
|
||||
from retry import retry
|
||||
|
||||
webhook = "https://oapi.dingtalk.com/robot/send?access_token=21de667159edadd33172c6ec414a2addf9c6359189350ffd36819d2a20e8a0f4"
|
||||
secret = "SEC43a0fa0b29717f98637a119b92a0bd5f7b2b6da671bdd2bd1279ed8323454d5e"
|
||||
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():
|
||||
# df = pd.read_csv(
|
||||
# "/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",
|
||||
# encoding="utf-8-sig",
|
||||
# )
|
||||
# df = get_all_stock_index()
|
||||
df = get_index_latest_data()
|
||||
set_proxy()
|
||||
df = get_all_stock_index()
|
||||
# df = get_index_latest_data()
|
||||
column_mapping = {
|
||||
"date": "date",
|
||||
"代码": "code",
|
||||
@@ -67,6 +81,8 @@ def get_latest_index_kline_date():
|
||||
index_hist = index_hist_df.to_dict(orient="records")[0]
|
||||
hist_date = index_hist["日期"]
|
||||
df["date"] = hist_date
|
||||
df.dropna(how="any", inplace=True)
|
||||
# df.to_csv(f"aaaa.csv", index=False, encoding="utf-8-sig")
|
||||
return df
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user