Skip to content

bug-or-feature/pysystemtrade-fsb

 
 

Repository files navigation

pysystemtrade-fsb

Systematic Futures Spread Bets in Python

A fork of Rob Carver's pysystemtrade, adapted to trade futures spread bets with IG

See upstream README here

Description

An attempt to adapt Rob Carver's pysystemtrade for trading spread bets - as outlined in his book Leveraged Trading. Limited to futures based dated spread bets for Indices, Bonds/Rates, Commodities and quarterly dated forward spread bets for FX

Release notes

See CHANGES for release notes

Differences with upstream

  • custom instrument and roll config
  • IG as broker instead of IB
  • daily price updates from Barchart and IG
  • daily FX updates from Alpha Vantage
  • Futures Spread Bets (FSBs) are represented internally as futures instruments, but with codes like GOLD_fsb, SP500_fsb
  • Custom dataBroker and dataBlob classes
  • fractional positions, fills
  • custom market algo
  • custom scripts for data setup / import

Status (October 2023)

My own production system

  • is sampling approx 80 instruments (list)
  • get capital data from IG
  • runs a static backtest, generating optimal positions
  • makes automated trades (market orders only)
  • produces the following reports (examples)
    • Costs report
    • FSB report (new report)
    • Instrument risk report (customised version)
    • Market monitor report
    • Minimum capital report (customised version)
    • P&L report
    • Reconcile report
    • Remove markets report (customised version)
    • Risk report (customised version)
    • Roll report (customised version)
    • Slippage report
    • Status report
    • Strategy report
    • Trade report

Roadmap / wishlist

  • adding more instruments
  • add setup instructions to docs
  • implement limit orders
  • implement 'best' algo
  • implement dynamic optimisation

Support

This is an open source project, maintained by one busy developer in his spare time. Same rules apply as for upstream. It is probably not suitable for people who are not prepared to read docs, delve into code, and go deep down rabbit holes. Report a bug or feature here. But please read the docs first

Additional dependencies

Licensing and legal (adapted from upstream)

GNU v3 (See LICENSE)

Absolutely no warranty is implied with this product. Use at your own risk. I provide no guarantee that it will be profitable, or that it won't lose all your money very quickly, or delete every file on your computer (by the way: it's not supposed to do that. Just in case you thought it was). All financial trading offers the possibility of loss. Spread betting may result in you losing all your money, and still owing more. Backtested results are no guarantee of future performance. I can take no responsibility for any losses caused by live trading using this code. I am not registered or authorised by any financial regulator.

Packages

No packages published

Languages

  • Python 97.7%
  • Jupyter Notebook 0.9%
  • JavaScript 0.5%
  • HTML 0.5%
  • Shell 0.3%
  • CSS 0.1%