Top Related Projects
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:
-
Clone the repository:
git clone https://github.com/PKUJohnson/OpenData.git
-
Install required dependencies:
pip install pandas matplotlib seaborn
-
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())
-
Explore and analyze the data using your preferred tools and libraries.
Competitor Comparisons
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.
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.
基于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 designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
OpenDataTools
å¼æºçæ°æ®æåå·¥å ·ï¼ä¸æ³¨å¨åç±»ç½ç«ä¸ç¬åæ°æ®ï¼å¹¶éè¿ç®åæç¨çAPIæ¹å¼ä½¿ç¨
æè¿æ´æ°
2019-10-10
ä¿®æ£issueéé¢çå 个é®é¢ï¼å æ¬ï¼
- éè¡å®ä¸»é¢å称é®é¢
- ç»æµæ°æ®pmiè·å失败çé®é¢
- å ¨çææ°è·å失败çé®é¢
- ç§ååºéæ°æ®è·å失败çé®é¢
install
声æï¼æ¬å·¥å ·åªæ¯æ python3ï¼è¯·å®è£ python3.6以ä¸çæ¬ã没ææ¯æpython2ç计åã
- ç´æ¥ä»pypiä¸å®è£ ï¼pip install opendatatools
- ä¸è½½æºä»£ç ï¼è¿è¡ä¸é¢çå½ä»¤ï¼
python setup.py install
å¿«é使ç¨
æ¬å·¥å ·å æ¬è¥å¹²æ¨¡åï¼åºæ¬ä½¿ç¨æ¹æ³å¦ä¸ï¼
-
å¯¼å ¥æ¨¡åï¼from opendatatools import XXXXXXï¼XXXXXX代表模ååï¼
-
è°ç¨æ¨¡åæ¹æ³ï¼ df, msg = XXXXXX.function(param)
-
å¤çç»æï¼df is Noneï¼ä»£è¡¨å¤±è´¥ï¼å¯ä»¥ä»msgä¸æ¥ç失败åå ã
ä¸ä¸ªæ ·ä¾ï¼
from opendatatools import stock
df, msg = stock.get_quote('600000.SH,000002.SZ')
print(df)
demo
please see wiki
qq群讨论
å°ç¨åº
Top Related Projects
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot