关于分时图成交量红绿柱的问题,我们总结了以下几点,给你解答:
分时图成交量红绿柱代表什么
红色是买入,绿色是卖出
分时图成交量红绿柱
:param stock_code:
:return:
"""
url = 'http://stock.gtimg.cn/data/index.php?appn=detail&action=data&c={}'.format(stock_code)
r = requests.get(url)
data = r.json()
data = data['data']
data = data['qt']['sz002475']
data = data['kline']
data = data['day']
data = data[0]
data = data['data']
data = data.split('|')
data = data[1:]
data = [float(i) for i in data]
return data
def get_stock_data(stock_code):
"""
获取股票分时图数据
:param stock_code:
:return:
"""
url = 'http://stock.gtimg.cn/data/index.php?appn=detail&action=data&c={}'.format(stock_code)
r = requests.get(url)
data = r.json()
data = data['data']
data = data['qt']['sz002475']
data = data['kline']
data = data['day']
data = data[0]
data = data['data']
data = data.split('|')
data = data[1:]
data = [float(i) for i in data]
return data
def get_stock_data_by_date(stock_code, date):
"""
获取指定日期的股票分时图数据
:param stock_code:
:param date:
:return:
"""
url = 'http://stock.gtimg.cn/data/index.php?appn=detail&action=data&c={}&p=1'.format(stock_code)
r = requests.get(url)
data = r.json()
data = data['data']
data = data['qt']['sz002475']
data = data['kline']
data = data['day']
for i in data:
if i['date'] == date:
data = i['data']
data = data.split('|')
data = data[1:]
data = [float(i) for i in data]
return data
return None
def get_stock_data_by_date_range(stock_code, start_date, end_date):
"""
获取指定日期范围的股票分时图数据
:param stock_code:
:param start_date:
:param end_date:
:return:
"""
url = 'http://stock.gtimg.cn/data/index.php?appn=detail&action=data&c={}&p=1'.format(stock_code)
r = requests.get(url)
data = r.json()
data = data['data']
data = data['qt']['sz002475']
data = data['kline']
data = data['day']
data_list = []
for i in data:
if i['date'] >= start_date and i['date'] <= end_date:
data = i['data']
data = data.split('|')
data = data[1:]
data = [float(i) for i in data]
data_list.append(data)
return data_list
if __name__ == '__main__':
stock_code = 'sz002475'
data = get_stock_data(stock_code)
print(data)
data = get_stock_data_by_date(stock_code, '2020-04-17')
print(data)
data = get_stock_data_by_date_range(stock_code, '2020-04-17', '2020-04-20')
print(data)
分时图成交量红绿柱怎么调