stockapi股票基金api接口地址:https://stockapi.com.cn 不想自己写的:https://stockapi.com.cn 除了牛逼,只剩下牛逼,除了方便,只剩下方便,python不是唯一的量化编程语言 接口说明:日线macd指标 https://stockapi.com.cn/v1/quota/macd?code=600004&cycle=9&date=2021-10-17&longCycle=26&shortCycle=12&...
data.sort_index(ascending=True,ignore_index=True,inplace=True) return data except: pass def plot_kline_figure(stock='399905',start_date='20210101',end_date='20500101',data_type='1'): df1=get_stock_hist_data_em(stock=stock,start_date=start_date,end_date=end_date) df1.rename(columns={...
stock_data['macd'] = stock_data['macd'] # 制定交易策略 if stock_data['macd'] > 0 and stock_data['rsi'] > 70: print("卖出信号") elif stock_data['macd'] < 0 and stock_data['rsi'] < 30: print("买入信号") else: print("观望") 实际应用场景 Python stockstats库在实际应用中有...
pro=ts.pro_api(token) #使用python3自带的sqlite数据库 #本人创建的数据库地址为c:\zjy\db_stock\ file='sqlite:///c:\\zjy\\db_stock\\' #数据库名称 db_name='stock_data.db' engine = create_engine(file+db_name) class Data(object): def __init__(self, start='20050101', end='20191115...
The bad news: there is no such thing as a “Free” stock data API in Python. Sourcing the stock data, cleaning the data, storing the data, building the API, documenting the API, maintaining the API, and marketing the API all costs money. As you can see, there’s no way that sustai...
——Python爬虫Sina Stock实战 实时股票数据的重要性 对于四大可交易资产:股票、期货、期权、数字货币来说,期货、期权、数字货币,可以从交易所提供的api收到实时行情数据,而股票由于量化交易接口不面向普通人开放,导致大家想要获取到股票的实时数据,十分困难。而与此同时,股票实时数据,又是极其重要的场内交易数据。
Python SDK: Gitee地址:https://gitee.com/waizao/StockApiPython Github地址::https://github.com/waizao/StockApiPython 初始化: pip install waizao -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com --upgrade
data= wenben[start:end].strip()[:-2]#此时获得的data是str格式的json,可以转为python了data_python =json.loads(data)#此时的data_python是一个列表,列表中的每一个元素是一个字典#包含上市新股的各种信息。我们只需要遍历股票的名字和日期就可以了#其中securityshortname是股票名称,purchasedate是申购日期#循环...
Sina Finance API Usage: import json from cstock.request import Requester from cstock.sina_engine import SinaEngine engine = SinaEngine() requester = Requester(engine) stock = requester.request("300327") data = stock[0].as_dict() print(data) print(json.dumps(data, ensure_ascii=False)) prin...
def data_api(code, api='ak'): if api == 'ak': if period in ['daily', 'weekly', 'monthly']: download_df = ak.stock_zh_a_hist(symbol=code, period=period, start_date=g_start_date, end_date=to_date, adjust=adjustflag) df = pd.DataFrame(download_df, columns=['id', ...