Giter Club home page Giter Club logo

at's Introduction

Automated Trader (at)

tests

Purpose: Framework for building automated trading strategies in three steps:

  1. Build your own strategy.
  2. Verify it with the backtest module.
  3. Connect it to a real broker API to make some money.

Every broker API can be implemented. Works for stocks, forex, cryptocurrencies, etc.

Supported brokers:

Broker Demo account Paperwallet trading Real trading Backtesting (historical prices)
IG.com
Coinbase
FTX

Disclaimer: The developers are not liable for any losses arising from the buy or sell of securities. All included strategies are examples and in no case ready trading systems.

Installation

go get github.com/sklinkert/at

Example backtesting run:

INSTRUMENT="BTC-USD" STRATEGY="rsi" CANDLE_DURATION=24h YEAR_FROM=2021 MONTH_FROM=4 YEAR_TO=2021 MONTH_TO=12 PRICE_SOURCE="COINBASE" go run -ldflags="-w -s -X main.GitRev=123" ./cmd/backtesting/main.go

Uses ETHUSD candles from Coinbase via api.pattern-trading.com

Overview

Overview

Packages

broker

Implements concrete broker API. paperwallet can be used if a broker does not offer testing/sandbox accounts for trading without real money.

trader

The nerve center of the program. It connects the broker with strategies.

indicator

Implements various trading indicator like Simple Moving Average (SMA) or RSI. Indicators should implement this interface.

strategy

Implements various trading strategies. Each strategy needs to implement this interface thus the trader is able to connect.

General flow:

  1. Trader sends candlesticks (what is a candlestick?) and the current price (tick) to the strategy
  2. Optional: The strategy feeds indicators and retrieves the latest indicator values
  3. The strategy decides if trader should open a new position and which position should be closed.
  4. Trader executes new orders or closes open positions via broker APIs.

environment overlays (eo)

EOs can help to adjust a strategy according to the market volatility in order to reduce risk. E.g. you might want to buy when RSI indicator is below 25. However, if the market is getting dangerous due to high volatility you might only buy if RSI falls below 10 to ensure you buy only when indicator signals are stronger.

backtesting

The backtest module can apply historical price simulations to your strategy.

You can configure tradings fees and spreads to simulate trading like with real money.

Terminal output

It can also print a chart with a beautiful equity curve:

Terminal output

You can use Coinbase and histdata.com prices for backtestings. Check cmd/import-histdata for more.

Contribution

Feel free to send PRs. I'm always happy to discuss and improve the code.

For hosting I can recommend DigitalOcean:

DigitalOcean Referral Badge

Donations

In case you want to show some love:

  • BTC: 3BNnZUfw9qnLVnza9FvWF6n7tEXfWYVVy2
  • ETH: 0xd30638F4fD54aeDB458d30504DD1cF2ce7563D36
  • XMR: 45At7ezTicAejiLWTAfb28NNXnciH1M67VRrxLRHgfFyimHuPNP7MqbiUgYwwdTzXjbGFwCMsoMoH1Cvv7jPqKKANuaMpjo

at's People

Contributors

sklinkert avatar

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.