<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[从0学习量化的基础知识股票数据]]></title><description><![CDATA[<p dir="auto">初学者学习量化，需要了解股票的数据，一般量化数据都是基于日K，OHLC，其全称是下面这些单词的组合。. open. high. low. close.<br />
开盘价，最高价，最低价，收盘价。</p>
<p dir="auto">业界都是以close收盘价代表一天的价格。A股也是基于收盘价决定第二天的最高价和最低价，一般是10%的涨幅。</p>
<p dir="auto">那么如何获取一只股票的K线呢？网上有很多工具 <a href="https://klang.org.cn/docs/stockdata/" rel="nofollow ugc">https://klang.org.cn/docs/stockdata/</a><br />
这里也有说明。</p>
<p dir="auto">今天给大家介绍一个最简单的方法:<a href="https://klang.org.cn/stockdata.zip" rel="nofollow ugc">https://klang.org.cn/stockdata.zip</a><br />
这个文件每天更新4，5次。 最好是每天下午4，5点钟下载，就可以获取 4000多只A股200天的日K。<br />
文件大小大约25M。</p>
<p dir="auto">展开后是 ~/.klang_stock_trader.json 文件。用 json工具就可以加载使用。</p>
]]></description><link>http://localhost:4567/topic/32/从0学习量化的基础知识股票数据</link><generator>RSS for Node</generator><lastBuildDate>Mon, 18 May 2026 12:28:23 GMT</lastBuildDate><atom:link href="http://localhost:4567/topic/32.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 27 Jun 2022 13:23:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 从0学习量化的基础知识股票数据 on Wed, 29 Jun 2022 13:03:34 GMT]]></title><description><![CDATA[<p dir="auto">上面介绍的是第一种方法。其实还可以用Klang库来操作。具体步骤如下:</p>
<h3>下载 Klang  并使用Klang来获取数据</h3>
<pre><code>git clone https://github.com/asmcos/Klang
cd Klang
pip3 install -r requirements.txt 
python3 setup.py install

</code></pre>
<p dir="auto">第二步、下载数据</p>
<p dir="auto">4000只股票，200天的日K，大约25M。正常网速3分钟左右。</p>
<p dir="auto">python3 tools/download.py</p>
<p dir="auto">如果遇到talib安装问题，请参考：<br />
安装过程中可能会遇到 TA-Lib 库问题。</p>
<p dir="auto">Windows 用户可以参考这篇文章 Klang安装使用文档（Windows）<a href="https://forum.klang.org.cn/topic/30/klang%E5%AE%89%E8%A3%85%E4%BD%BF%E7%94%A8%E6%96%87%E6%A1%A3-windows/2" rel="nofollow ugc">https://forum.klang.org.cn/topic/30/klang安装使用文档-windows/2</a></p>
<p dir="auto">Linux用户 可以这样试试</p>
<pre><code>$ wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz #下载
$ tar -xvf ta-lib-0.4.0-src.tar.gz  # 解压
$ cd ta-lib # 进入目录
$ ./configure --prefix=/usr
$ make
$ make install
</code></pre>
]]></description><link>http://localhost:4567/post/62</link><guid isPermaLink="true">http://localhost:4567/post/62</guid><dc:creator><![CDATA[asmcos]]></dc:creator><pubDate>Wed, 29 Jun 2022 13:03:34 GMT</pubDate></item><item><title><![CDATA[Reply to 从0学习量化的基础知识股票数据 on Wed, 29 Jun 2022 12:58:30 GMT]]></title><description><![CDATA[<h3>如何读取 下载的文件？</h3>
<pre><code>  f = open(filename_jsont)

   while True：
       content  = f.readline()
       if len(content) &lt; 8:
           break
       stock    = json.loads(content[:-1])
       code     = stock[0]
       name     = stock[1]
       jsondata = stock[2]
       print('正在获取',name,'代码',code)

       df = pd.json_normalize(jsondata)
       if len(df) &gt; 2:
          df['datetime'] = df['date']
          df = df.set_index('date')
        
   f.close()
</code></pre>
<p dir="auto">这段代码就是展示了按照每行读取一只股票数据。<br />
用pandas 转换成df</p>
]]></description><link>http://localhost:4567/post/61</link><guid isPermaLink="true">http://localhost:4567/post/61</guid><dc:creator><![CDATA[asmcos]]></dc:creator><pubDate>Wed, 29 Jun 2022 12:58:30 GMT</pubDate></item></channel></rss>