问答交流

【平台使用】如何在查看每天总市值低于30亿的股票数量?

由bqnvfzc5创建,最终由small_q 被浏览 21 用户

我想看看每天有多少只总市值低于30亿的股票,能给一份查看的代码吗

评论
  • 参考以下代码
  • import dai
  • df = dai.query("SELECT date, instrument, total_market_cap FROM cn_stock_prefactors", filters={"date": ["2024-11-01", "2024-12-16"]}).df()
  • df[df["total_market_cap"] < 3000000000].groupby("date")["instrument"].count()
  • 怎么把他和上证指数和在一起,形成一个曲线图
  • import dai
  • import bigcharts
  • import pandas as pd
  • stock = dai.query("SELECT date, instrument, total_market_cap FROM cn_stock_prefactors", filters={"date": ["2024-11-01", "2024-12-16"]}).df()
  • stock_count = df1[df1["total_market_cap"] < 3000000000].groupby("date")["instrument"].count().reset_index(name='count')
  • index = dai.query("SELECT date, close FROM cn_stock_index_bar1d WHERE instrument = '000001.SH'", filters={"date": ["2024-11-01", "2024-12-16"]}).df()
  • df = pd.merge(stock_count, index, on='date', how='inner')
  • line = bigcharts.Line(df)
  • line.render()
{link}