easytrader
提供同花顺客户端/国金/华泰客户端/雪球的基金、股票自动程序化交易以及自动打新,支持跟踪 joinquant /ricequant 模拟交易 和 实盘雪球组合, 量化交易组件
Top Related Projects
Quick Overview
EasyTrader is an open-source Python library that provides a unified interface for automatic trading with various Chinese brokers. It supports multiple trading platforms, including Yinhe, Haitong, and more, allowing users to automate their trading strategies across different brokers seamlessly.
Pros
- Supports multiple Chinese brokers and trading platforms
- Provides a unified API for easy integration and switching between brokers
- Offers both synchronous and asynchronous trading capabilities
- Includes features like real-time quotes, order placement, and account information retrieval
Cons
- Limited to Chinese brokers and may not be suitable for international trading
- Documentation is primarily in Chinese, which may be challenging for non-Chinese speakers
- Requires separate broker-specific software installations for some platforms
- May be subject to changes in broker APIs and regulations
Code Examples
- Initializing a trader and placing an order:
import easytrader
user = easytrader.use('ht') # 'ht' for Haitong Securities
user.prepare('config/ht.json') # Load configuration
user.buy('162411', price=0.55, amount=100) # Buy 100 shares of stock 162411 at 0.55
- Retrieving account balance:
balance = user.balance
print(f"Available balance: {balance['可用金额']}")
- Getting real-time quotes:
from easytrader import helpers
quotes = helpers.get_stock_quotes(['000001', '162411'])
for quote in quotes:
print(f"{quote['name']}: {quote['now']}")
Getting Started
-
Install easytrader:
pip install easytrader
-
Set up broker-specific configuration (example for Haitong Securities):
{ "user": "your_username", "password": "your_password", "comm_password": "your_comm_password", "exe_path": "C:\\htzqzyb2\\xiadan.exe" }
-
Initialize and use the trader:
import easytrader user = easytrader.use('ht') user.prepare('config/ht.json') # Now you can use various methods like user.buy(), user.sell(), user.balance, etc.
Note: Make sure to install any required broker-specific software and configure it properly before using easytrader.
Competitor Comparisons
基于Python的开源量化交易平台开发框架
Pros of vnpy
- More comprehensive trading platform with support for multiple asset classes
- Extensive documentation and active community support
- Modular architecture allowing for easy customization and extension
Cons of vnpy
- Steeper learning curve due to its complexity
- Heavier resource usage compared to lightweight alternatives
- May be overkill for simple trading strategies or single-market focus
Code Comparison
easytrader:
user = easytrader.use('ths')
user.prepare('account.json')
user.balance
user.position
user.buy('162411', price=0.55, amount=100)
vnpy:
from vnpy.event import EventEngine
from vnpy.trader.engine import MainEngine
from vnpy.gateway.ctp import CtpGateway
event_engine = EventEngine()
main_engine = MainEngine(event_engine)
main_engine.add_gateway(CtpGateway)
vnpy offers a more structured and extensible approach, while easytrader provides a simpler interface for quick trading operations. vnpy's code demonstrates its event-driven architecture and modular design, whereas easytrader focuses on ease of use for specific brokers.
QUANTAXIS 支持任务调度 分布式部署的 股票/期货/期权 数据/回测/模拟/交易/可视化/多账户 纯本地量化解决方案
Pros of QUANTAXIS
- More comprehensive quantitative trading framework with broader functionality
- Supports multiple markets including stocks, futures, and cryptocurrencies
- Includes advanced features like backtesting, risk management, and portfolio optimization
Cons of QUANTAXIS
- Steeper learning curve due to its complexity and extensive features
- May be overkill for users seeking simple trading automation
- Less focused on direct broker integration compared to easytrader
Code Comparison
QUANTAXIS example:
import QUANTAXIS as QA
data = QA.QA_fetch_stock_day_adv('000001', '2017-01-01', '2017-12-31')
QA.QA_SU_save_stock_day('tdx')
easytrader example:
import easytrader
user = easytrader.use('ht')
user.prepare('config/ht.json')
user.buy('162411', price=0.55, amount=100)
The code comparison shows that QUANTAXIS focuses on data fetching and processing, while easytrader emphasizes direct trading operations with brokers. QUANTAXIS provides a more comprehensive framework for quantitative analysis, while easytrader offers simpler, more direct trading functionality.
A extendable, replaceable Python algorithmic backtest && trading framework supporting multiple securities
Pros of rqalpha
- More comprehensive backtesting and simulation capabilities
- Supports multiple asset classes (stocks, futures, options)
- Extensive documentation and community support
Cons of rqalpha
- Steeper learning curve due to its complexity
- Requires more setup and configuration
- May be overkill for simple trading strategies
Code Comparison
rqalpha:
from rqalpha.api import *
def init(context):
context.s1 = "000001.XSHE"
def handle_bar(context, bar_dict):
order_shares(context.s1, 100)
easytrader:
import easytrader
user = easytrader.use('ths')
user.auto_login()
user.buy('162411', price=0.55, amount=100)
rqalpha offers a more structured approach with separate initialization and trading logic, while easytrader provides a simpler, more direct method for executing trades. rqalpha's code is designed for backtesting and live trading, whereas easytrader focuses on interfacing with brokers for real-time trading.
stock,股票系统。使用python进行开发。
Pros of stock
- More comprehensive stock analysis tools and indicators
- Includes machine learning models for stock prediction
- Provides a web-based interface for easier visualization
Cons of stock
- Less focused on automated trading functionality
- May have a steeper learning curve for beginners
- Potentially slower execution due to more complex analysis
Code Comparison
easytrader:
user = easytrader.use('ths')
user.connect(broker_id='123456', password='123456')
user.buy('162411', price=0.55, amount=100)
stock:
from stock import Stock
stock = Stock('AAPL')
stock.get_historical_data(start_date='2022-01-01', end_date='2022-12-31')
stock.calculate_moving_average(window=20)
Summary
easytrader focuses on automated trading and interaction with brokers, while stock provides more comprehensive analysis tools and prediction models. easytrader is likely better for users looking to automate trades, while stock may be more suitable for those interested in in-depth analysis and machine learning-based predictions. The choice between the two depends on the specific needs of the user and their level of expertise in stock trading and analysis.
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
easytrader
- è¿è¡èªå¨çç¨åºåè¡ç¥¨äº¤æ
- æ¯æè·è¸ª
joinquant
,ricequant
ç模æ交æ - æ¯æè·è¸ª éªçç»å è°ä»
- æ¯æéç¨çåè±é¡ºå®¢æ·ç«¯æ¨¡ææä½
- å®ç°èªå¨ç»å½
- æ¯æéè¿ webserver è¿ç¨æä½å®¢æ·ç«¯
- æ¯æå½ä»¤è¡è°ç¨ï¼æ¹ä¾¿å ¶ä»è¯è¨éé
- åºäº Python3.6, Winã注: Linux ä» æ¯æéªç
微信群以åå ¬ä¼å·
欢è¿å¤§å®¶æ«ç å ³æ³¨å ¬ä¼å·ãé£ç¯é¬¼ãï¼ä¸èµ·äº¤æµãè¿ç¾¤å¯éè¿èåå æ好åï¼å¤æ³¨éåã
è¥äºç»´ç å Github ç½ç»æ æ³æå¼ï¼è¯·ç¹å»å ¬ä¼å·äºç»´ç ç´æ¥æå¼å¾çã
Author
easytrader © shidenggui, Released under the MIT License.
Blog @shidenggui · Weibo @é£ç¯é¬¼ · Twitter @shidenggui
ç¸å ³
è·åæ°æµªå è´¹å®æ¶è¡æ çç±»åº: easyquotation
ç®åçè¡ç¥¨éå交ææ¡æ¶ ä½¿ç¨ easytrader å easyquotation
æ¯æå¸å
- æµ·é客æ·ç«¯(æµ·éç½ä¸äº¤æç³»ç»ç¬ç«å§æ)
- å泰客æ·ç«¯(ç½ä¸äº¤æç³»ç»ï¼ä¸ä¸çâ ¡ï¼)
- å½é客æ·ç«¯(å ¨è½è¡è¯å¸äº¤æç»ç«¯PCç)
- å ¶ä»å¸åéç¨åè±é¡ºå®¢æ·ç«¯(éè¦æå¨ç»é)
模æ交æ
- éªçç»å by @haogefeifeiï¼è¯´æï¼
使ç¨ææ¡£
ä½è å ¶ä»ä½å
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