Top Related Projects
Open Data, more than 50 financial data. 提供超過 50 個金融資料(台股為主),每天更新 https://finmind.github.io/
提供同花顺客户端/国金/华泰客户端/雪球的基金、股票自动程序化交易以及自动打新,支持跟踪 joinquant /ricequant 模拟交易 和 实盘雪球组合, 量化交易组件
基于Python的开源量化交易平台开发框架
TuShare is a utility for crawling historical data of China stocks
AKShare is an elegant and simple financial data interface library for Python, built for human beings! 开源财经数据接口库
阿布量化交易系统(股票,期权,期货,比特币,机器学习) 基于python的开源量化交易,量化投资架构
Quick Overview
The pythonstock/stock repository is a Python-based stock market analysis and prediction system. It utilizes machine learning algorithms and technical indicators to analyze historical stock data and generate predictions for future stock prices. The project aims to provide a comprehensive toolkit for stock market enthusiasts and researchers.
Pros
- Comprehensive set of technical indicators and analysis tools
- Integration with popular data sources for real-time and historical stock data
- Modular architecture allowing for easy extension and customization
- Includes both traditional statistical methods and machine learning approaches
Cons
- Limited documentation and user guides
- Some dependencies may be outdated or require manual updates
- Lack of extensive testing and validation of prediction accuracy
- May require significant computational resources for large-scale analysis
Code Examples
- Fetching historical stock data:
from pythonstock import data_fetcher
symbol = "AAPL"
start_date = "2022-01-01"
end_date = "2023-01-01"
historical_data = data_fetcher.get_historical_data(symbol, start_date, end_date)
print(historical_data.head())
- Calculating technical indicators:
from pythonstock import indicators
close_prices = historical_data['Close']
sma_20 = indicators.simple_moving_average(close_prices, window=20)
rsi_14 = indicators.relative_strength_index(close_prices, window=14)
print("SMA(20):", sma_20[-1])
print("RSI(14):", rsi_14[-1])
- Training a machine learning model:
from pythonstock import ml_models
X, y = ml_models.prepare_data(historical_data)
model = ml_models.train_lstm_model(X, y)
future_prediction = ml_models.predict_future(model, X[-1])
print("Predicted price for next day:", future_prediction)
Getting Started
To get started with pythonstock/stock:
-
Clone the repository:
git clone https://github.com/pythonstock/stock.git cd stock
-
Install dependencies:
pip install -r requirements.txt
-
Run the example script:
python examples/basic_analysis.py
This will perform a basic analysis on a sample stock and display the results. Refer to the documentation for more advanced usage and customization options.
Competitor Comparisons
Open Data, more than 50 financial data. 提供超過 50 個金融資料(台股為主),每天更新 https://finmind.github.io/
Pros of FinMind
- More comprehensive data sources, including global markets and cryptocurrencies
- Better documentation and API reference
- Active development and regular updates
Cons of FinMind
- Steeper learning curve due to more complex features
- Requires API key for some data sources
Code Comparison
FinMind example:
from FinMind.data import DataLoader
dl = DataLoader()
df = dl.taiwan_stock_daily(
stock_id="2330",
start_date="2020-01-01",
end_date="2020-12-31"
)
Stock example:
import tushare as ts
df = ts.get_hist_data('600000', start='2020-01-01', end='2020-12-31')
FinMind offers a more structured approach with a dedicated DataLoader class, while Stock relies on the tushare library for data retrieval. FinMind's code is more explicit in specifying the data source (taiwan_stock_daily), whereas Stock's code is more concise but less descriptive.
Both projects aim to provide financial data analysis tools, but FinMind offers a broader range of data sources and more advanced features. Stock focuses primarily on the Chinese market and may be easier to use for beginners. The choice between the two depends on the specific requirements of the user's project and their familiarity with financial data analysis.
提供同花顺客户端/国金/华泰客户端/雪球的基金、股票自动程序化交易以及自动打新,支持跟踪 joinquant /ricequant 模拟 交易 和 实盘雪球组合, 量化交易组件
Pros of easytrader
- More focused on automated trading functionality
- Supports multiple Chinese brokers and trading platforms
- Actively maintained with recent updates
Cons of easytrader
- Limited to Chinese stock markets and brokers
- Less comprehensive market analysis tools
- Steeper learning curve for non-Chinese users
Code comparison
easytrader:
import easytrader
user = easytrader.use('ths')
user.connect(broker_type='universal_client')
user.buy('162411', price=0.55, amount=100)
stock:
from QUANTAXIS import QA_fetch_stock_day_adv
import QUANTAXIS as QA
data = QA_fetch_stock_day_adv('000001', '2017-01-01', '2017-07-01')
QA.QA_util_log_info('data: '+str(data))
Key differences
easytrader focuses on executing trades through various Chinese brokers, while stock provides a broader set of tools for stock market analysis and backtesting. easytrader is more suitable for automated trading in Chinese markets, whereas stock offers a more comprehensive suite of functions for market analysis and strategy development across different markets.
基于Python的开源量化交易平台开发框架
Pros of vnpy
- More comprehensive and feature-rich trading platform
- Supports multiple asset classes (stocks, futures, options, etc.)
- Active development with frequent updates and contributions
Cons of vnpy
- Steeper learning curve due to its complexity
- Requires more system resources to run efficiently
- May be overkill for users focused solely on stock trading
Code Comparison
vnpy:
from vnpy.event import EventEngine
from vnpy.trader.engine import MainEngine
from vnpy.trader.ui import MainWindow, create_qapp
def main():
qapp = create_qapp()
event_engine = EventEngine()
main_engine = MainEngine(event_engine)
stock:
import tushare as ts
import pandas as pd
def get_stock_data(code, start_date, end_date):
df = ts.get_k_data(code, start=start_date, end=end_date)
return pd.DataFrame(df)
The code snippets highlight the difference in scope between the two projects. vnpy provides a more comprehensive trading platform with event-driven architecture, while stock focuses on simpler stock data retrieval and analysis using libraries like Tushare.
TuShare is a utility for crawling historical data of China stocks
Pros of Tushare
- More comprehensive data sources, including financial statements and real-time quotes
- Better documentation and community support
- Regularly updated with new features and data types
Cons of Tushare
- Requires a token for full access to data
- May have slower performance for large data requests
- Learning curve can be steeper for beginners
Code Comparison
Tushare:
import tushare as ts
ts.set_token('your_token_here')
df = ts.get_stock_basics()
Stock:
from stock import Stock
stock = Stock('000001')
df = stock.get_k_data()
Key Differences
- Tushare offers a wider range of financial data beyond just stocks
- Stock focuses specifically on Chinese A-shares market
- Tushare requires authentication, while Stock is more straightforward to use
- Stock provides some built-in analysis tools, whereas Tushare is primarily for data retrieval
Use Cases
- Tushare: Suitable for comprehensive financial analysis and research projects
- Stock: Better for quick analysis of Chinese stocks and simple portfolio management
Both libraries serve the purpose of accessing Chinese stock market data, but Tushare offers a more extensive dataset at the cost of slightly more complex setup and usage.
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 its extensive API and features
- May be overkill for simple stock analysis tasks
- Requires more setup and dependencies
Code comparison
akshare:
import akshare as ak
stock_zh_a_spot_df = ak.stock_zh_a_spot()
print(stock_zh_a_spot_df)
stock:
from stock import Stock
stock = Stock('000001')
print(stock.get_k_data())
Key differences
- akshare provides a more extensive API with access to various financial data sources
- stock focuses primarily on Chinese A-share market data
- akshare offers more flexibility in data retrieval and analysis
- stock provides a simpler interface for basic stock data operations
Use cases
akshare is better suited for:
- Comprehensive financial market analysis
- Multi-asset class research
- Building complex trading systems
stock is more appropriate for:
- Quick analysis of Chinese A-share stocks
- Simple portfolio tracking
- Educational purposes for beginners in stock market analysis
Both libraries have their merits, and the choice between them depends on the specific requirements of your project and your level of expertise in financial data analysis.
阿布量化交易系统(股票,期权,期货,比特币,机器学习) 基于python的开源量化交易,量化投资架构
Pros of abu
- More comprehensive and feature-rich, offering a wider range of trading strategies and analysis tools
- Better documentation and examples, making it easier for users to understand and implement the system
- Active development and community support, with regular updates and improvements
Cons of abu
- Higher complexity, which may be overwhelming for beginners or those seeking a simpler solution
- Requires more computational resources due to its extensive features and analysis capabilities
- Steeper learning curve compared to stock's more straightforward approach
Code Comparison
abu:
from abupy import AbuFactorBuyBreak, AbuFactorAtrNStop, AbuFactorPreAtrNStop, AbuFactorCloseAtrNStop
buy_factors = [{'class': AbuFactorBuyBreak, 'xd': 20, 'rs': False}]
sell_factors = [
{'class': AbuFactorAtrNStop, 'stop_loss_n': 1.0, 'stop_win_n': 3.0},
{'class': AbuFactorPreAtrNStop, 'pre_atr_n': 1.5},
{'class': AbuFactorCloseAtrNStop, 'close_atr_n': 1.5}
]
stock:
from strategy import ma_strategy
from data import get_stock_data
data = get_stock_data('AAPL')
signals = ma_strategy(data, short_window=50, long_window=200)
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
说æï¼é¡¹ç®è¿ç§»å°äºGitee å¦ï¼æåä¸æ¬¡ä¿®æ¹ï¼2023-06-02 æ§è¡åæ¡£
项ç®è¿ç§»å°è¿éäºï¼æ¤é¡¹ç®åç»æ´æ°è®¿é®è¿éï¼
https://gitee.com/pythonstock/stock
github项ç®åç»å°±Archivesåæ¡£äºï¼ä¸åæ´æ°äºï¼
csdnçpythonstockä¸æ å°åï¼ç¸å ³èµæé½å¨è¿éæ说æï¼
https://blog.csdn.net/freewebsys/category_9285317.html
pythonstock V2 项ç®ç®ä»
ç¹å«è¯´æï¼è¡å¸æé£é©æèµéè°¨æ ï¼æ¬é¡¹ç®åªè½ç¨äºPython代ç å¦ä¹ ï¼è¡ç¥¨åæï¼æèµå¤±è´¥äºé±ä¸è´è´£ï¼ä¸ç®BUGã
项ç®å°åï¼https://github.com/pythonstock/stock
PythonStock V2 æ¯åºäºPythonçpandasï¼akshareï¼bokehï¼tornadoï¼stockstatsï¼ta-libçæ¡æ¶å¼åçå
¨æ è¡ç¥¨ç³»ç»ã
项ç®å建äº2017å¹´7æ17æ¥ï¼æ¯æä¸å®ææ´æ°ã
1ï¼å¯ä»¥ç´æ¥ä½¿ç¨dockerç´æ¥æ¬å°é¨ç½²è¿è¡ï¼æ´ä¸ªé¡¹ç®å¨docker hubä¸å缩å200MBï¼æ¬å°å ç¨500MBç£ç空é´ã
2ï¼ä½¿ç¨Docker解å³äºPythonåºå®è£
é®é¢ï¼ä½¿ç¨Mariadbï¼MySQLï¼åå¨æ°æ®ãåå©akshareæåæ°æ®ã
3ï¼ä½¿ç¨cronåå®æ¶ä»»å¡ï¼æ¯å¤©è¿è¡æ°æ®æå计ç®ï¼æ¯å¤©18ç¹å¼å§è¿è¡æ°æ®è®¡ç®ï¼è®¡ç®å½æ¥æ°æ®ï¼ä½¿ç¨300天æ°æ®è¿è¡è®¡ç®ï¼å¤§çº¦éè¦15åé计ç®å®æ¯ã
4ï¼è¡ç¥¨æ°æ®æ¥å£é²æ¢è¢«å°ï¼æ天è¿è¡æ°æ®ç¼åï¼å¨åæè¿3天æ°æ®ï¼æ¯å¤©å®æ¶æ¸
é¤ï¼åæ¶ä½¿ç¨read_pickle to_pickle çgzipå缩模å¼åå¨ã
5ï¼ä½¿ç¨tornadoå¼åwebç³»ç»ï¼æ¯ææ¯æ¥è¡ç¥¨æ°æ®-ä¸è´¢ï¼é¾èæ¦-个è¡ä¸æ¦-æ°æµªï¼æ°æ®ä¸å¿-大å®äº¤æè¡æ
çã
6ï¼æ°æ®å±ç¤ºç³»ç»ï¼æ¯éç¨æ°æ®å±ç¤ºç³»ç»ï¼é
ç½®åå
¸æ¨¡æ¿ä¹åï¼é¡µé¢èªå¨å è½½æ°æ®ï¼å¹¶å®ææ°æ®å±ç¤ºï¼åç»èªå·±å¼åçææ æ°æ®å¯ä»¥å å
¥è¿å»ã
7ï¼å¢å æ²çº¿æ°æ®åæï¼å¨æ¥çè¡ç¥¨ä¸ï¼å¯ä»¥ç´æ¥è·³è½¬å°ä¸æ¹è´¢å¯é¡µé¢æ¥çç¸å
³ä¿¡æ¯ï¼ç¹å»ææ ä¹å使ç¨Bokehå°å¤è¾¾ 17 个ææ çæ°æ®ç»å¾ï¼è¿è¡å¾è¡¨å±ç¤ºã
8) 2.0 æ大çæ´æ°å¨äºæ¿æ¢tushareåºï¼å é¨ååºä¸è½ä½¿ç¨ï¼ï¼ä½¿ç¨akshareè¿è¡æ°æ®æåã
åºç¡åºçæ¬
1ï¼pandas使ç¨ã 1.3.5 ãçæ¬ï¼å级äº
2ï¼numpy使ç¨ã 1.21.5 ãçæ¬ï¼å级äº
3ï¼akshare使ç¨ã 1.3.50 ãçæ¬ï¼å级äº
4ï¼bokeh使ç¨ã 2.4.2 ãçæ¬ï¼å级äº
5ï¼stockstats使ç¨ã 0.3.2 ãçæ¬
2.0 说æ
bokeh ç»å¾ææ æ°æ®ï¼
ç¶åæ ¹æ®3个ææ è¿è¡è¡ç¥¨æ°æ®è®¡ç®ï¼
KDJ:
1ï¼è¶
ä¹°åºï¼Kå¼å¨80以ä¸ï¼Då¼å¨70以ä¸ï¼Jå¼å¤§äº90æ¶ä¸ºè¶
ä¹°ãä¸è¬æ
åµä¸ï¼è¡ä»·æå¯è½ä¸è·ãæèµè
åºè°¨æ
è¡äºï¼å±å¤äººä¸åºå追涨ï¼å±å
人åºéæ¶ååºã
2ï¼è¶
ååºï¼Kå¼å¨20以ä¸ï¼Då¼å¨30以ä¸ä¸ºè¶
ååºãä¸è¬æ
åµä¸ï¼è¡ä»·æå¯è½ä¸æ¶¨ï¼åå¼¹çå¯è½æ§å¢å¤§ãå±å
人ä¸åºè½»ææåºè¡ç¥¨ï¼å±å¤äººå¯å¯»æºå
¥åºã
RSI:
1ï¼å½å
æ¥ææ ä¸åå°è¾¾80æ¶ï¼è¡¨ç¤ºè¡å¸å·²æè¶
ä¹°ç°è±¡ï¼å¦æä¸æ¦ç»§ç»ä¸åï¼è¶
è¿90以ä¸æ¶ï¼å表示已å°ä¸¥éè¶
ä¹°çè¦æåºï¼è¡ä»·å·²å½¢æ头é¨ï¼æå¯è½å¨çæå
å转å转ã
2ï¼å½å
æ¥å¼ºå¼±ææ ä¸éè³20æ¶ï¼è¡¨ç¤ºè¡å¸æè¶
åç°è±¡ï¼å¦æä¸æ¦ç»§ç»ä¸éè³10以ä¸æ¶å表示已å°ä¸¥éè¶
ååºåï¼è¡ä»·æå¯è½ææ¢è·ååçæºä¼ã
CCI
1ãå½CCIï¼ï¹¢100æ¶ï¼è¡¨æè¡ä»·å·²ç»è¿å
¥é常æåºé´ââè¶
ä¹°åºé´ï¼è¡ä»·çå¼å¨ç°è±¡åºå¤å å
³æ³¨ã
2ãå½CCIï¼ï¹£100æ¶ï¼è¡¨æè¡ä»·å·²ç»è¿å
¥å¦ä¸ä¸ªé常æåºé´ââè¶
ååºé´ï¼æèµè
å¯ä»¥é¢ä½å¸çº³è¡ç¥¨ã
è´ä¹°æ¡ä»¶ç»æ表ï¼guess_indicators_lite_buy_daily
è´ä¹°æ¡ä»¶ç»æ表ï¼guess_indicators_lite_sell_daily
æ¯æ¥è¡ç¥¨ææ æ°æ®è®¡ç®17个ææ å¦ä¸ï¼æ°æ®è¡¨ guess_indicators_dailyï¼ï¼
计ç®ææ | 说æ |
---|---|
1ï¼äº¤æédeltaææ åæ | The Volume Delta (Vol â) |
2ï¼è®¡ç®n天差 | å¯ä»¥è®¡ç®ï¼åån天ï¼ååån天çå·®ã |
3ï¼n天涨è·ç¾åç¾è®¡ç® | å¯ä»¥çå°ï¼-n天æ°æ®åä»å¤©æ°æ®çç¾åæ¯ã |
4, CRææ | http://wiki.mbalib.com/wiki/CR%E6%8C%87%E6%A0%87 ä»·æ ¼å¨éææ CRè·ç©¿aãbãcãdåæ¡çº¿ï¼åç±ä½ç¹åä¸ç¬å160æ¶ï¼ä¸ºç线è·å©çä¸ä¸ªè¯æºï¼åºéå½ååºè¡ç¥¨ã CRè·è³40以ä¸æ¶ï¼æ¯å»ºä»è¯æºãèCRé«äº300~400æ¶ï¼åºæ³¨æéå½åä»ã |
5ï¼æ大å¼ï¼æå°å¼ | 计ç®åºé´æå¤§å¼ volume max of three days ago, yesterday and two days later stock["volume_-3,2,-1_max"] volume min between 3 days ago and tomorrow stock["volume_-3 |
6, KDJææ | http://wiki.mbalib.com/wiki/%E9%9A%8F%E6%9C%BA%E6%8C%87%E6%A0%87 éæºææ (KDJ)ä¸è¬æ¯æ ¹æ®ç»è®¡å¦çåçï¼éè¿ä¸ä¸ªç¹å®çå¨æï¼å¸¸ä¸º9æ¥ã9å¨çï¼å åºç°è¿çæé«ä»·ã æä½ä»·åæåä¸ä¸ªè®¡ç®å¨æçæ¶çä»·åè¿ä¸è ä¹é´çæ¯ä¾å ³ç³»ï¼æ¥è®¡ç®æåä¸ä¸ªè®¡ç®å¨æçæªæçéæºå¼RSVï¼ ç¶åæ ¹æ®å¹³æ»ç§»å¨å¹³å线çæ¹æ³æ¥è®¡ç®Kå¼ãDå¼ä¸Jå¼ï¼å¹¶ç»ææ²çº¿å¾æ¥ç å¤è¡ç¥¨èµ°å¿ã ï¼3ï¼å¨ä½¿ç¨ä¸ï¼å¸¸æJ线çææ ï¼å³3ä¹ä»¥Kå¼å2ä¹ä»¥Då¼ï¼3Kï¼2Dï¼Jï¼ï¼å ¶ç®çæ¯æ±åºKå¼ä¸Då¼çæ大ä¹ç¦»ç¨åº¦ï¼ 以é¢å KDå¼æ¾åºåºé¨å头é¨ãJ大äº100æ¶ä¸ºè¶ ä¹°ï¼å°äº10æ¶ä¸ºè¶ åã |
7ï¼SMAææ | http://wiki.mbalib.com/wiki/Sma ç®å移å¨å¹³å线ï¼Simple Moving Averageï¼SMAï¼ å¯ä»¥å¨æè¾å ¥åæ°ï¼è·å¾å 天ç移å¨å¹³åã |
8, MACDææ | http://wiki.mbalib.com/wiki/MACD å¹³æ»å¼å移å¨å¹³å线(Moving Average Convergence Divergenceï¼ç®ç§°MACDææ )ï¼ä¹ç§°ç§»å¨å¹³åèæ£ææ MACD åå¯åæ¥å ¶åºæçåè½ï¼ä½å½å¸åºåçç®çæ´æ ¼å±ï¼è¡ä»·ä¸ä¸ä¸ä¸æ¶ï¼MACDä¹°å讯å·è¾ä¸ææ¾ã å½ç¨MACDä½åææ¶ï¼äº¦å¯è¿ç¨å ¶ä»çææ¯åæææ å¦çæ Kï¼Då¾å½¢ä½ä¸ºè¾ å©å·¥å ·ï¼èä¸ä¹å¯å¯¹ä¹°å讯å·ä½åéç确认ã |
9, BOLLææ | http://wiki.mbalib.com/wiki/BOLL å¸æ线ææ (Bollinger Bands) |
10, RSIææ | http://wiki.mbalib.com/wiki/RSI ç¸å¯¹å¼ºå¼±ææ ï¼Relative Strength Indexï¼ç®ç§°RSIï¼ï¼ä¹ç§°ç¸å¯¹å¼ºå¼±ææ°ãç¸å¯¹å度ææ° 2ï¼å¼ºå¼±ææ ä¿æé«äº50表示为强å¿å¸åºï¼åä¹ä½äº50表示为弱å¿å¸åºã ï¼3ï¼å¼ºå¼±ææ å¤å¨70ä¸30ä¹é´æ³¢å¨ãå½å æ¥ææ ä¸åå°è¾¾80æ¶ï¼è¡¨ç¤ºè¡å¸å·²æè¶ ä¹°ç°è±¡ï¼å¦æä¸æ¦ç»§ç»ä¸åï¼è¶ è¿90以ä¸æ¶ï¼å表示已å°ä¸¥éè¶ ä¹°çè¦æåºï¼è¡ä»·å·²å½¢æ头é¨ï¼æå¯è½å¨çæå å转å转ã |
11, W%Rææ | http://wiki.mbalib.com/wiki/%E5%A8%81%E5%BB%89%E6%8C%87%E6%A0%87 å¨å»ææ°ï¼Williams%Rateï¼è¯¥ææ°æ¯å©ç¨æå¨ç¹æ¥åº¦éå¸åºçè¶ ä¹°è¶ åç°è±¡ã |
12, CCIææ | http://wiki.mbalib.com/wiki/%E9%A1%BA%E5%8A%BF%E6%8C%87%E6%A0%87 顺å¿ææ åå«CCIææ ï¼å ¶è±æå ¨ç§°ä¸ºâCommodity Channel Indexâï¼ æ¯ç±ç¾å½è¡å¸åæ家å纳德·è伯ç¹ï¼Donald Lambertï¼æåé çï¼æ¯ä¸ç§éç¹ç å¤è¡ä»·å离度çè¡å¸åæå·¥å ·ã 1ãå½CCIææ ä»ä¸åä¸çªç ´ï¹¢100线èè¿å ¥é常æåºé´æ¶ï¼è¡¨æè¡ä»·è±ç¦»å¸¸æèè¿å ¥å¼å¸¸æ³¢å¨é¶æ®µï¼ ä¸ç线åºåæ¶ä¹°å ¥ï¼å¦æææ¯è¾å¤§çæ交éé åï¼ä¹°å ¥ä¿¡å·åæ´ä¸ºå¯é ã 2ãå½CCIææ ä»ä¸åä¸çªç ´ï¹£100线èè¿å ¥å¦ä¸ä¸ªé常æåºé´æ¶ï¼è¡¨æè¡ä»·ççæ´é¶æ®µå·²ç»ç»æï¼ å°è¿å ¥ä¸ä¸ªæ¯è¾é¿ç寻åºè¿ç¨ï¼æèµè åºä»¥æå¸è§æ为主ã CCI, default to 14 days |
13, TRãATRææ | http://wiki.mbalib.com/wiki/%E5%9D%87%E5%B9%85%E6%8C%87%E6%A0%87 åå¹ ææ ï¼Average True Ranger,ATRï¼åå¹ ææ ï¼ATRï¼æ¯åä¸å®æ¶é´å¨æå çè¡ä»·æ³¢å¨å¹ 度ç移å¨å¹³åå¼ï¼ä¸»è¦ç¨äºç å¤ä¹°åæ¶æºã |
14, DMAææ | http://wiki.mbalib.com/wiki/DMA DMAææ ï¼Different of Moving Averageï¼åå«å¹³è¡çº¿å·®ææ ï¼æ¯ç®åè¡å¸åæææ¯ææ ä¸çä¸ç§ä¸çæææ ï¼å®å¸¸ç¨äºå¤§çææ°å个è¡çç å¤ã DMA, difference of 10 and 50 moving average stock[âdmaâ] |
15, DMIï¼+DIï¼-DIï¼DXï¼ADXï¼ADXRææ | http://wiki.mbalib.com/wiki/DMI å¨åææ°Directional Movement Index,DMIï¼ http://wiki.mbalib.com/wiki/ADX å¹³åè¶åææ ï¼Average Directional Indicatorï¼ç®ç§°ADXï¼ http://wiki.mbalib.com/wiki/%E5%B9%B3%E5%9D%87%E6%96%B9%E5%90%91%E6%8C%87%E6%95%B0%E8%AF%84%E4%BC%B0 å¹³åæ¹åææ°è¯ä¼°ï¼ADXRï¼å®é æ¯ä»æ¥ADXä¸åé¢æä¸æ¥çADXçå¹³åå¼ãADXRå¨é«ä½ä¸ADXåæ¥ä¸æ»ï¼å¯ä»¥å¢å 对ADXå·²ç»è°å¤´çå°½æ©ç¡®è®¤ã ADXRæ¯ADXçéå±äº§åï¼åªè½ååºä¸ç§è¾ å©åè¯å®ç讯å·ï¼å¹¶éå ¥å¸çææ ï¼èåªéåæ¶é åå¨åææ (DMI)çè¶å¿æå¯ä½åºä¹°åçç¥ã å¨åºç¨æ¶ï¼åºä»¥ADX为主ï¼ADXRä¸ºè¾ ã |
16, TRIXï¼MATRIXææ | http://wiki.mbalib.com/wiki/TRIX TRIXææ åå«ä¸éææ°å¹³æ»ç§»å¨å¹³åææ ï¼Triple Exponentially Smoothed Averageï¼ |
17, VRï¼MAVRææ | http://wiki.mbalib.com/wiki/%E6%88%90%E4%BA%A4%E9%87%8F%E6%AF%94%E7%8E%87 æ交éæ¯çï¼Volumn Ratioï¼VRï¼ï¼ç®ç§°VRï¼ï¼æ¯ä¸é¡¹éè¿åæè¡ä»·ä¸åæ¥æ交é¢ï¼ææ交éï¼ä¸åï¼ä¸è¡ä»·ä¸éæ¥æ交é¢æ¯å¼ï¼ ä»èææ¡å¸åºä¹°åæ°å¿çä¸æææ¯ææ ã |
使ç¨æ¹æ³ï¼ä¾èµdockerï¼
ä½¿ç¨ mariadb å stock 两个éå
mkdir -p /data/mariadb/data
docker pull pythonstock/pythonstock:latest
docker pull mariadb:latest
docker run --name mariadb -v /data/mariadb/data:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=mariadb -p 3306:3306 -d mariadb:latest
docker run -itd --link=mariadb --name stock \
-v /data/notebooks:/data/notebooks \
-p 8888:8888 \
-p 9999:9999 \
pythonstock/pythonstock:latest
ç´æ¥å¯å¨stock ï¼ä½¿ç¨å ¶ä» mysql æ°æ®åºï¼éè¦é ç½®åéæ¹å¼ï¼
docker run -itd --name stock \
-v /data/notebooks:/data/notebooks \
-p 8888:8888 \
-p 9999:9999 \
-e MYSQL_HOST=127.0.0.1 \
-e MYSQL_USER=root \
-e MYSQL_PWD=mariadb \
-e MYSQL_DB=stock_data \
pythonstock/pythonstock:latest
æè 使ç¨docker compose
å®è£ docker-compose https://www.runoob.com/docker/docker-compose.html
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose up -d
è¦æ³ä¿®æ¹æ件è¿è¡è°è¯ï¼å¢å å½åç®å½æ å°ï¼å å ¥å°stockéé¢ï¼
volumes:
- "./jobs:/data/stock/jobs"
- "./libs:/data/stock/libs"
- "./web:/data/stock/web"
è¿å ¥éåï¼
docker exec -it stock bash
sh /data/stock/jobs/cron.daily/run_daily
说æï¼å¯å¨å®¹å¨åï¼ä¼è°ç¨ãrun_init.sh è¿è¡æ°æ®åå§åï¼åæ¶ç¬¬ä¸æ¬¡æ§è¡åå°æ§è¡å½æ¥æ°æ®ã 以åæ¯æ¥18ç¹ï¼åªæ18ç¹å·¦å³ææä»æ¥çæ°æ®ï¼è¿è¡è¡ç¥¨æ°æ®æå并计ç®ã
æ¬å°è®¿é®ç«¯å£
http://localhost:9999 è¡ç¥¨ç³»ç»
è¡ç¥¨ç³»ç»è®¾è®¡
ç¸å ³å客èµæï¼ https://blog.csdn.net/freewebsys/category_9285317.html
æ°æ®åææ¸ æ´ä½¿ç¨pandasï¼numpyã http://pandas.pydata.org/
æ°æ®åå¨å°ç£çä¸ï¼ä½¿ç¨Mysqlæ°æ®åºãåå¨è¡ç¥¨æ°æ®ã https://pypi.python.org/pypi/mysqlclient
webæ¡æ¶ä½¿ç¨tornado http://www.tornadoweb.org/en/stable/
tornado webç³»ç» http://docs.pythontab.com/tornado/introduction-to-tornado/
æ¶æ设计
å ¨ç³»ä½¿ç¨pythonå®ç°ãå 为é½æ¯pythonçç±»åºï¼äºç¸ä¹é´è°ç¨æ¹ä¾¿ã ä»æ°æ®æåï¼æ°æ®å¤çï¼å°æ°æ®å±ç¤ºæ°æ®è¿ç®é½æ¯pythonå®ç°ã
æç»çæ°æ®é½å°å端å±ç¤ºåºæ¥ã主è¦å为4个æ件夹ã
jobs æåæ°æ®å¹¶åå¨å®ç°ç±»ã
libs éç¨å·¥å ·ç±»ã
web å端å±ç¤ºæ¡æ¶ã
supervisor è¿ç¨ç®¡çå·¥å ·ã
åºç¨é¨ç½²
éè¦mysqlæ°æ®åºå¯å¨ã项ç®æ¾å°/data/stock ç®å½ã
CREATE DATABASE IF NOT EXISTS `stock_data` CHARACTER SET utf8 COLLATE utf8_general_ci;
ä½¿ç¨ :
http://docs.sqlalchemy.org/en/latest/core/reflection.html
æ´æ°æ¥å¿
15 åå¸ä¸ä¸ª 2.0 ççæ¬ - 2021-10-11
æ建åºç¡çæ¬ pythonstock/pythonstock:base-2021-09 å¨è¿ä¸ªéåçåºç¡ä¸ä½¿ç¨ akshare 1.1.9 æè ¾å 个æï¼ç»äºæ2.0 å¼å¥½äºï¼ä¸ºå¥å¼2.0 å 为ä¹ååç° tushareçæ°æ®ä¸è½æåäºãéè¦æ³¨åæ pro çæ¬ï¼ä½æ¯pro è¿æ积åéå¶ã 诸å¤ä¸ä¾¿å§ï¼äºæ¯æ¢æäº akshare åºäºï¼å¤§æ¹äºï¼éè¦æ¾å°ç¸å ³çæ°åºãç¶åå¨äºä»£ç ã å é¤æäº ta-lib å®è£ äºä¹åä»æ¥æ²¡æç¨å°ï¼jupyter ä¹æ¯æ²¡æç¨ãå 空é´å½±åä¸è½½å¿æ ãå°éåè¿ä¸æ¥åå°ã
14 bokeh åçº§å° 2.4.0 çæ¬
ç®å½ /usr/local/lib/python3.7/site-packages 使ç¨èæ¬è¿è¡å级ã
13 å级akå°v1.0.80 å好æ¯æ¥ä¸æ¹è´¢ç»æ°æ®
https://www.akshare.xyz/zh_CN/latest/data/stock/stock.html#id1 éé: å次è¿åææ A è¡ä¸å¸å ¬å¸çå®æ¶è¡æ æ°æ®
600å¼å¤´çè¡ç¥¨æ¯ä¸è¯Aè¡ï¼å±äºå¤§çè¡ï¼å ¶ä¸6006å¼å¤´çè¡ç¥¨æ¯ææ©ä¸å¸çè¡ç¥¨ï¼ 6016å¼å¤´çè¡ç¥¨ä¸ºå¤§çèç¹è¡ï¼900å¼å¤´çè¡ç¥¨æ¯ä¸è¯Bè¡ï¼ 000å¼å¤´çè¡ç¥¨æ¯æ·±è¯Aè¡ï¼001ã002å¼å¤´çè¡ç¥¨ä¹é½å±äºæ·±è¯Aè¡ï¼ å ¶ä¸002å¼å¤´çè¡ç¥¨æ¯æ·±è¯Aè¡ä¸å°ä¼ä¸è¡ç¥¨ï¼200å¼å¤´çè¡ç¥¨æ¯æ·±è¯Bè¡ï¼ 300å¼å¤´çè¡ç¥¨æ¯åä¸æ¿è¡ç¥¨ï¼400å¼å¤´çè¡ç¥¨æ¯ä¸æ¿å¸åºè¡ç¥¨ã
è¿æ»¤å æ¬ï¼600ï¼6006ï¼601ï¼000ï¼001ï¼002ï¼ä¸ä¸å æ¬STçè¡ç¥¨æ°æ®ã
å¢å æ°æ®åºutf8 åæ° --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
12 å级åºç¡éåå°3.7 pythonï¼ä¿é akshare 0.6.10 以ä¸çæ¬æ¯æ
åç° akshare è¦æ±å级python 3.7 以ä¸çæ¬æå¯ä»¥ï¼éè¦å级åºç¡éåã ç¶å akshare å°±å¯ä»¥åçº§å° 0.9.65 çææ°çæ¬äºã æ°çæ¬å°±å¯ä»¥æç §æ¥æè¿è¡æ¥è¯¢ï¼è§£å³ TypeError: stock_zh_a_daily() got an unexpected keyword argument 'start_date' è¿ä¸ªé®é¢äºã
11 ä½¿ç¨ akshare åç¸å ³è¡ç¥¨æ°æ®æå
ä¸å½çè¡å¸å¼çæ¶é´ä¸ºï¼æ¯å¨ä¸è³å¨äºçä¸å9:30ââ11ï¼30ï¼ ä¸å13:00ââ15:00ãä¸å½è¡å¸æ¶çæ¶é´ä¸ºï¼æ¯å¨ä¸è³å¨äºçä¸å3ç¹ã
å®æ¶è¡æ æ°æ® æ¥å£: stock_zh_a_spot ç®æ å°å: http://vip.stock.finance.sina.com.cn/mkt/#hs_a æè¿°: A è¡æ°æ®æ¯ä»æ°æµªè´¢ç»è·åçæ°æ®, éå¤è¿è¡æ¬å½æ°ä¼è¢«æ°æµªææ¶å° IP, 建议å¢å æ¶é´é´é éé: å次è¿åææ A è¡ä¸å¸å ¬å¸çå®æ¶è¡æ æ°æ®
åå²è¡æ æ°æ® æ¥é¢ç æ¥å£: stock_zh_a_daily ç®æ å°å: https://finance.sina.com.cn/realstock/company/sh600006/nc.shtml(示ä¾) æè¿°: A è¡æ°æ®æ¯ä»æ°æµªè´¢ç»è·åçæ°æ®, åå²æ°æ®ææ¥é¢çæ´æ°; 注æå ¶ä¸ç sh689009 为 CDR, 请 éè¿ stock_zh_a_cdr_daily æ¥å£è·å éé: å次è¿åæå® A è¡ä¸å¸å ¬å¸æå®æ¥æé´çåå²è¡æ æ¥é¢çæ°æ®
10 å¢å ä¸æ¹è´¢ç»å¼¹çªçªå£ãå¢å ææ 计ç®å¼¹çªçªå£
åç°äºä¸ä¸ªä¸æ¹è´¢å¯ç页é¢ï¼æ¯ç»pc端ç¨çã å¯ä»¥å个弹åºæ¡æ¾å°ç³»ç»ä¸ãä¸è¿è¡è°æ´äºï¼é¿å®½é«å¯ä»¥åçå°ç¹ã使ç¨iframeå¼å ¥çé¢ãå¦åæè·¨ååæ ·å¼é®é¢ã
ä¿®æ¹ææ 页é¢ï¼æ¹æçªå£å¼¹çªï¼å页é¢éé ï¼æ¹ä¾¿æ¥çã
9ï¼å¢å æ¥å
å¤èçjquery 代ç ï¼
$( ".date-picker" ).datepicker({
language: 'zh-CN', //设置è¯è¨
format:"yyyymmdd",
showOtherMonths: true,
selectOtherMonths: false,
autoclose: true,
todayHighlight: true
});
é对æ¥æç±»åçæç´¢æ¡ä»¶å¢å æ¥å
https://www.bootcss.com/p/bootstrap-datetimepicker/ ä¸æ¯ä½¿ç¨jQueryçæ¶é´ã
8ï¼åç°MariaDb çæ¬ä¸å ¼å®¹é®é¢ï¼æååæ¢æmysql,ä½¿ç¨ mysql:5.7 éå
ç¸å ³æ°æ®æ§è¡åªæ¯æå°10.5.4ï¼çæ¬å¯ä»¥ä½¿ç¨ï¼ä½æ¯10.5.8 å°±æé®é¢äºã éå¶æ»äºçæ¬ãçæ¥è½¯ä»¶ä¹ä¸è½çå级ï¼é½ç¨ææ°çæé®é¢ãå¯ä»¥è§£å³æ°æ®é®é¢ã ä½¿ç¨ mysql:5.7 éåï¼æ´éç¨äºï¼ä¸æè ¾mariaDbäºã
7ï¼è§£å³ Bokeh JSå ¼å®¹é®é¢ã
å级 bokeh å° 2.1.1 çæ¬
https://pypi.org/project/bokeh/#files
å级JSï¼å 为 lib å å级导è´é®é¢ã
6ï¼å级 bokeh å° 2.1.1 çæ¬
https://pypi.org/project/bokeh/#files
5ï¼è§£å³æ¥å¿æå°é®é¢
é
ç½® main.py
tornado.options.parse_command_line()
ç¶åå¯å¨é
ç½®åæ°ï¼
/usr/local/bin/python3 /data/stock/web/main.py -log_file_prefix=/data/logs/web.log
4ï¼è§£å³è·æ°æ®é®é¢
# éè¿æ°æ®åºé¾æ¥ engineã
def conn():
try:
db = MySQLdb.connect(MYSQL_HOST, MYSQL_USER, MYSQL_PWD, MYSQL_DB, charset="utf8")
# db.autocommit = True
except Exception as e:
print("conn error :", e)
db.autocommit(on=True)
return db.cursor()
ä¹åå级è¿ä»£ç ï¼é æ db.cursor() é®é¢ã
3ï¼å¢å å¤å段æåº
1ï¼ç¹å»æ¯å个å段è¿è¡æåºã
2ï¼æç §ãshiftãï¼ç¹å»å¤ä¸ªï¼å³å¯å®æå¤å段æåºã
3ï¼æå¡ç«¯å页æåºã
4ï¼æç §å¤ä¸ªå段è¿è¡çéæ¥è¯¢ã
2ï¼ä½¿ç¨pandaså¤çéå¤æ°æ®
https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.drop_duplicates.html
data = get_data(year, quarter)
# å¤çéå¤æ°æ®ï¼ä¿åææ°ä¸æ¡æ°æ®ã
data.drop_duplicates(subset="code", keep="last")
1ï¼web使ç¨datatableæ¾ç¤ºæ¥è¡¨
éç¨æ°æ®é ç½®ï¼å¨ libs/stock_web_dic.py é ç½®æ°æ®ä¹åï¼å¯ä»¥å®ç°å¨æå è½½èåï¼æ ¹æ®æ°æ®åºè¡¨çè¡åæ¾ç¤ºæ°æ®ã
ä¸ç¨ä¸ä¸ªè¡¨ä¸ä¸ªè¡¨è¿è¡å¼åï¼éç¨æ°æ®å±ç¤ºã
Top Related Projects
Open Data, more than 50 financial data. 提供超過 50 個金融資料(台股為主),每天更新 https://finmind.github.io/
提供同花顺客户端/国金/华泰客户端/雪球的基金、股票自动程序化交易以及自动打新,支持跟踪 joinquant /ricequant 模拟交易 和 实盘雪球组合, 量化交易组件
基于Python的开源量化交易平台开发框架
TuShare is a utility for crawling historical data of China stocks
AKShare is an elegant and simple financial data interface library for Python, built for human beings! 开源财经数据接口库
阿布量化交易系统(股票,期权,期货,比特币,机器学习) 基于python的开源量化交易,量化投资架构
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