Git Product home page Git Product logo

invest-alchemy's Introduction

Invest Alchemy

Invest Alchemy is a trading assistant focused on ETF portfolios. For more context, see this post.

TODO

  • Feature

    • Data
    • Strategy
      • Trade strategies
        • Double MA
        • Turtle
        • Backtrace MA250
        • Breakthrough Platform
        • Keep Increasing
        • Low Atr
      • Trade backtesting
        • Spike backtrader, maybe we can use it to do the strategy backtesting before we go to implement the strategy signal.
      • ETF similarity calculation, can filter similar ETF
    • Market
      • Support USA share ETF
      • Index Historical P/E Ratio
      • Base database store baseline (10%) and popular indexs performance (000905/000300/399006/HSI/IXIC/INX)
    • Portfolio
      • Transaction/Funding/Holding/NetValue/Performance Ledger
        • Add portfolio fund utilization performance (holding assets / total assets)
      • Add popular indexs net value compare Ledger
      • Support trade A share ETF/LOF funds
      • Support trade A share stock
      • Support trade A public funds (not include ETF/LOF)
    • Trader
      • User
        • User portfolio calculation support
      • Robot
        • Double MA (11/22)
          • Long ETF strategy robot trader
          • All In strategy robot trader
          • Periodic Payment strategy robot trader
    • Web UI
      • Re-Design web UI page
        • Portfolio Risk Monitor
        • Portfolio holding/transaction/funding history
    • Notify
      • Email
      • Telegram bot/channel
      • Slack bot/channel
      • Show different strategy signal (daily)
      • Show different trade robot portfolio performance report (weekly)
      • Can subscribe trade event of the special portfolio by email/rss
  • Arch Improve

    • Storage
      • Add database schema migration tool
      • SQLite DB backup to AWS S3
      • Trade data store in SQLite DB
      • Base Database migrate from SQLite to Supabase(PostgreSQL)
  • Bug Fix

    • Trading signals error when double ma price are same.
    • Portfolio performance ledger max_days_of_continuous_loss calculation error, max is 5, because the days_of_continuous_loss will set to 0 when on non-trade days.

Note

Strategy

  • Trade strategy

  • Issue

    • Split-adjusted share prices: Use qfq adjust price to generate trade signals.
  • Note

    • Why the trade strategy may not good at trading stock?
      • Compare index, stocks have the liquidity problem and suspension risk. Liquidity can lead to a huge gap between simulated trading and actual trading results, suspension will result in inability to trade, producing results that are completely different from simulated trading.
    • About strategy backtesting overfitting: Backtesting overfitting may be a killer in trade stragety, so we not pursue the profit maximization by overfitting, just using the simple trade strategy to overcome the market volatility.

Portfolio

  • Split-adjusted share prices: Not processed in the trading ledger (only robots, user trader need add a transaction when split-adjusted happens), but processed in the holding ledger calculation.
    • 🐛 Robot user still can not process, because split-adjusted check on the portfolio net value ledger calculation, but sell transaction amount do not equal to holding amount because sell transaction generated on the transaction ledger calculation, so it needs to process on portfolio net value calculation when user is a robot type.
      • Fix this issue by: robot trader use qfq adjust price while user trader use close price when calculate the portfolio net value (include transaction/holdings/net value ledger calculation), user trader need add a transaction when split-adjusted happens to adjust the hold amount.
        • qfq cannot fix this issue, because if the split-adjusted share happens, qfq only change it's hsitory price, e.g. the day before split-adjusted day(20220904), 512100.SH close price is 0.982, today(20220905) the close price is 2.713, if the hold amount is not changed, the market value of it will change to nearly three times than before.
      • Fix by changing the hold amout when split-adjusted happens and this must happens on the generated transaction csv file phase (if not, the robot trader can not know what amount it can sell). Although this solution can slow the calculation speed, but currently it is the most easy way to fix it.

Robot Trader

  • About the slippage issue: Since the underlying traded are daily level ETFs, the impact of slippage issues is minimal.
  • About the no liquidity issues: Because simulation trading cannot know the liquidity of the transaction of the day, such as A shares max up and down the restrictions caused the inability to deal, there is a certain deviation from the actual transaction, which is also the charm of the real deal, there is a certain amount of uncertainty brought about by the change.
  • About dividends: The robot trader will ignore the case of dividends on the holding position, because the calculation will be complicated. However, real user trader can manually record dividends as one transaction.
  • About trade fees: Because the ETF/LOF trade fees in A share market is very low, so robot trader just ignore the trade fees for simplified calculations.

Post

Video Log

invest-alchemy's People

Contributors

madawei2699 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

invest-alchemy's Issues

卖出了之前不存在的标的

在 tg 中,2022年11月1日的操作中,卖出了 证券 etf ,但是好像之前就没有持仓,这是要把这个标的加入可选池子中的意思吗?

投资组合标的支持A股港股与美股市场

此功能可以让在一个投资组合中支持A股、港股与美股的标的,需要加入汇率转换的功能,比如主要币种为人民币,则在资金管理中需要加入多币种的支持,在交易管理标的需要加入市场的属性,在净值展示模块中加入多币种自动转换成主币种的功能。

用户可自定义标的监控信号

  1. 可自定义监控标的交易信号,类似于券商条件单
  2. 可自定义交易指标信号,如定制双均线的长短期均线指标

需要考虑的是,这些功能是否有价值,因为看起来一些券商已经有类似的功能了,比如华泰的条件单功能,但那个功能比较简单。

2023-02-03 可买ETF并未进入持仓列表

2023-02-02 tg上报信号
==Other ETF==
可买标的:
地产ETF(512200.SH)可买, 收盘价0.742, 11日均线0.736, 22日均线0.735

但该ETF 并未出现在2023-02-03的持仓中

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.