Convert Figma logo to code with AI

shidenggui logoeasytrader

提供同花顺客户端/国金/华泰客户端/雪球的基金、股票自动程序化交易以及自动打新,支持跟踪 joinquant /ricequant 模拟交易 和 实盘雪球组合, 量化交易组件

7,823
2,650
7,823
77

Top Related Projects

25,149

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

QUANTAXIS 支持任务调度 分布式部署的 股票/期货/期权 数据/回测/模拟/交易/可视化/多账户 纯本地量化解决方案

5,323

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

6,578

stock,股票系统。使用python进行开发。

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

  1. 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
  1. Retrieving account balance:
balance = user.balance
print(f"Available balance: {balance['可用金额']}")
  1. 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

  1. Install easytrader:

    pip install easytrader
    
  2. 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"
    }
    
  3. 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

25,149

基于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.

5,323

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.

6,578

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 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

easytrader

Package Travis License

  • 进行自动的程序化股票交易
  • 支持跟踪 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版)
  • 其他券商通用同花顺客户端(需要手动登陆)

模拟交易

使用文档

中文文档

作者其他作品