Convert Figma logo to code with AI

PKUJohnson logoOpenData

开源的金融投资数据提取工具,专注在各类网站上爬取数据,并通过简单易用的API方式使用

1,291
331
1,291
20

Top Related Projects

8,990

AKShare is an elegant and simple financial data interface library for Python, built for human beings! 开源财经数据接口库

5,323

A extendable, replaceable Python algorithmic backtest && trading framework supporting multiple securities

25,149

基于Python的开源量化交易平台开发框架

Quick Overview

PKUJohnson/OpenData is a GitHub repository that provides open-source financial and economic data for China. It includes various datasets related to Chinese stocks, bonds, and macroeconomic indicators, aimed at researchers, analysts, and developers working with Chinese financial markets.

Pros

  • Comprehensive collection of Chinese financial and economic data
  • Regularly updated datasets
  • Open-source and freely accessible
  • Includes both raw data and processed datasets

Cons

  • Limited documentation in English
  • Some datasets may have inconsistent formatting
  • Lack of detailed data cleaning processes
  • May require additional processing for specific use cases

Code Examples

# Example 1: Loading stock data
import pandas as pd

# Load daily stock data for a specific stock
stock_data = pd.read_csv('https://raw.githubusercontent.com/PKUJohnson/OpenData/master/stock/daily/000001.csv')
print(stock_data.head())
# Example 2: Analyzing bond yield curve
import matplotlib.pyplot as plt

# Load bond yield curve data
yield_curve = pd.read_csv('https://raw.githubusercontent.com/PKUJohnson/OpenData/master/bond/yield_curve.csv')

# Plot yield curve for a specific date
date = '2021-12-31'
plt.plot(yield_curve.columns[1:], yield_curve[yield_curve['date'] == date].iloc[0, 1:])
plt.title(f'Bond Yield Curve on {date}')
plt.xlabel('Maturity')
plt.ylabel('Yield (%)')
plt.show()
# Example 3: Exploring macroeconomic indicators
import seaborn as sns

# Load GDP growth rate data
gdp_growth = pd.read_csv('https://raw.githubusercontent.com/PKUJohnson/OpenData/master/macro/gdp_growth.csv')

# Create a heatmap of GDP growth rates
sns.heatmap(gdp_growth.set_index('year'), cmap='YlOrRd', annot=True)
plt.title('China GDP Growth Rate Heatmap')
plt.show()

Getting Started

To start using the PKUJohnson/OpenData repository:

  1. Clone the repository:

    git clone https://github.com/PKUJohnson/OpenData.git
    
  2. Install required dependencies:

    pip install pandas matplotlib seaborn
    
  3. Navigate to the desired dataset folder and load the data using pandas:

    import pandas as pd
    
    # Example: Load stock index data
    index_data = pd.read_csv('OpenData/stock/index/000001.csv')
    print(index_data.head())
    
  4. Explore and analyze the data using your preferred tools and libraries.

Competitor Comparisons

8,990

AKShare is an elegant and simple financial data interface library for Python, built for human beings! 开源财经数据接口库

Pros of akshare

  • More comprehensive data sources, covering a wider range of financial markets and instruments
  • Actively maintained with frequent updates and new features
  • Better documentation and examples for ease of use

Cons of akshare

  • Steeper learning curve due to more complex API structure
  • Potentially slower performance for large data requests
  • Requires more dependencies, which may increase setup complexity

Code Comparison

OpenData:

from OpenData import Stock

stock = Stock('000001.XSHE')
df = stock.get_k_data(start_date='2019-01-01', end_date='2019-12-31')

akshare:

import akshare as ak

stock_zh_a_daily_df = ak.stock_zh_a_daily(symbol="sz000001", start_date="20190101", end_date="20191231")

Both libraries provide similar functionality for fetching stock data, but akshare offers a more extensive range of functions for various financial instruments and markets. OpenData's API is simpler and more intuitive for basic stock data retrieval, while akshare's API requires more specific function calls but provides greater flexibility and data variety.

5,323

A extendable, replaceable Python algorithmic backtest && trading framework supporting multiple securities

Pros of rqalpha

  • More comprehensive and feature-rich quantitative trading platform
  • Actively maintained with regular updates and community support
  • Extensive documentation and examples for ease of use

Cons of rqalpha

  • Steeper learning curve due to its complexity
  • Requires more computational resources to run
  • May be overkill for simple data analysis tasks

Code Comparison

OpenData:

import pandas as pd
from opendata import stock

df = stock.get_price('000001.SZ', start='2020-01-01', end='2020-12-31')
print(df.head())

rqalpha:

from rqalpha import run_func

def init(context):
    context.s1 = "000001.XSHE"

def handle_bar(context, bar_dict):
    print(bar_dict[context.s1].close)

run_func(init=init, handle_bar=handle_bar, start_date="2020-01-01", end_date="2020-12-31")

OpenData focuses on simple data retrieval, while rqalpha provides a more comprehensive framework for strategy implementation and backtesting. OpenData is easier to use for basic tasks, but rqalpha offers more advanced features for quantitative trading strategies.

25,149

基于Python的开源量化交易平台开发框架

Pros of vnpy

  • More comprehensive trading platform with extensive features
  • Active development and larger community support
  • Supports multiple asset classes and exchanges

Cons of vnpy

  • Steeper learning curve due to complexity
  • Potentially overwhelming for beginners or those focused solely on data analysis

Code Comparison

OpenData:

import tushare as ts
df = ts.get_hist_data('000001')
print(df.head())

vnpy:

from vnpy.trader.vtConstant import *
from vnpy.trader.app.ctaStrategy.ctaTemplate import CtaTemplate

class MyStrategy(CtaTemplate):
    def __init__(self, ctaEngine, setting):
        super().__init__(ctaEngine, setting)

Key Differences

  • OpenData focuses on providing financial data for the Chinese market
  • vnpy is a full-fledged trading platform with strategy implementation capabilities
  • OpenData is more suitable for data analysis and research
  • vnpy offers real-time trading and backtesting functionalities

Use Cases

OpenData:

  • Financial data analysis for Chinese markets
  • Academic research on Chinese securities

vnpy:

  • Algorithmic trading across multiple asset classes
  • Developing and testing trading strategies
  • Building custom trading applications

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

OpenDataTools

开源的数据提取工具,专注在各类网站上爬取数据,并通过简单易用的API方式使用

最近更新

2019-10-10

修正issue里面的几个问题,包括:

  1. 选股宝主题名称问题
  2. 经济数据pmi获取失败的问题
  3. 全球指数获取失败的问题
  4. 私募基金数据获取失败的问题

install

声明:本工具只支持 python3,请安装python3.6以上版本。没有支持python2的计划。

  1. 直接从pypi上安装:pip install opendatatools

  1. 下载源代码,运行下面的命令:

python setup.py install

快速使用

本工具包括若干模块,基本使用方法如下:

  1. 导入模块:from opendatatools import XXXXXX(XXXXXX代表模块名)

  2. 调用模块方法: df, msg = XXXXXX.function(param)

  3. 处理结果:df is None,代表失败,可以从msg中查看失败原因。

一个样例:

from opendatatools import stock
df, msg = stock.get_quote('600000.SH,000002.SZ')
print(df)

demo

please see wiki

qq群讨论

小程序