gridtrader

agent
Guvenlik Denetimi
Basarisiz
Health Uyari
  • License — License: NOASSERTION
  • Description — Repository has a description
  • Active repo — Last push 0 days ago
  • Low visibility — Only 5 GitHub stars
Code Basarisiz
  • eval() — Dynamic code execution via eval() in main.py
Permissions Gecti
  • Permissions — No dangerous permissions requested

Bu listing icin henuz AI raporu yok.

SUMMARY

Grid-trading strategy development & backtesting toolset (Python / backtrader): A-share daily-K via baostock, CSV-driven grid backtests, Pipenv-managed. | 网格交易策略开发及回测工具:baostock 拉 A 股日 K、CSV 驱动网格回测、Pipenv 管理依赖。

README.md

gridtrader logo

gridtrader — Grid-Trading Strategy Toolset

License: MIT Version: 0.1.0 Type: Quant Tool

🌐 简体中文

gridtrader is a grid-trading strategy development and backtesting toolset built on backtrader: it fetches A-share daily-K data via baostock (get_data_scripts/get_data.py), runs grid backtests from CSV data (main.py's gridrun() plus the GridStrategy in gridtrader.py), and ships sample datasets under data/ (CSI 300 index, a single A-share, and a segmented Binance series). Dependencies are managed with Pipenv.

A sub-project of QuantStrategistAgent (Markowitz), the quant-strategy agent of the xhqing AI agent team. Research tooling only: not for live trading, not financial advice.

How it works

GridStrategy derives a mid price from the highest/lowest range of the past 1440 bars and builds 11 price levels spaced 0.5% apart across ±2.5% around that mid. Each level maps to a target position (lightest at the top, fully invested at the bottom); whenever the close crosses a level, the strategy re-balances to that level's target — classic grid logic (buy the dips, sell the rips), implemented with order_target_percent.

Quick start

Requires Python (the project declares 3.7) and Pipenv:

pip install pipenv
pipenv install
pipenv run python main.py

All settings live in the __main__ block of main.py:

  • filename — input CSV path (default ./data/binance-segment.csv);
  • timeframe — the data's backtrader timeframe (default Minutes; the dict maps index → name);
  • all_cash — starting cash (default 100000.00).

The CSV must have exactly the columns ['time', 'open', 'high', 'low', 'close', 'volume'] in that order (pandas CSV format, time parsed as datetimes).

The run prints the starting and final portfolio value.

Repository layout

gridtrader/
├── main.py                  # Backtest entry: gridrun() + all settings
├── gridtrader.py            # GridStrategy (the backtrader strategy) implementation
├── get_data_scripts/
│   └── get_data.py          # Sample A-share daily-K fetcher (baostock)
├── data/                    # Sample datasets (CSV): CSI 300, one A-share, segmented Binance
├── Pipfile / Pipfile.lock   # Dependencies (pandas / backtrader / baostock)
└── .claude/skills/quant/    # Quant skill (superset copy from QuantStrategistAgent)

License & attribution

This project is released under the MIT License, and you are additionally asked to credit the author and cite the source whenever you use, redistribute, or build upon it:

If you reference code or derive from this repository, please retain this attribution in your documentation, README, or acknowledgements.

Yorumlar (0)

Sonuc bulunamadi