MCPcopy Index your code
hub / github.com/cinar/indicator

github.com/cinar/indicator @v2.1.33

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.1.33 ↗ · + Follow
1,853 symbols 8,453 edges 478 files 1,209 documented · 65%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

GoDoc License Go Report Card Go CI codecov GHCR Version GitHub Stars

<img src="https://github.com/cinar/indicator/raw/v2.1.33/logo.png" />

Indicator Go

Indicator is a Golang module that provides an extensive set of technical analysis indicators, strategies, and a framework for backtesting with real-time strategy execution.

An extensive technical analysis library for algorithmic trading - 80+ indicators, backtesting framework, and AI integration via MCP.

Major improvements in v2:

  • Enhanced Code Quality: A complete rewrite was undertaken to achieve and maintain at least 90% code coverage.
  • Improved Testability: Each indicator and strategy have dedicated test data in CSV format for easier validation.
  • Streamlined Data Handling: The library was rewritten to operate on data streams (Go channels) for both inputs and outputs. If you prefer using slices, helper functions like helper.SliceToChan and helper.ChanToSlice are available. Alternatively, you can still use the v1 version.
  • Configurable Indicators and Strategies: All indicators and strategies were designed to be fully configurable with no preset values.
  • Generics Support: The library leverages Golang generics to support various numeric data formats.
  • MCP Support: MCP (Multi-Client Protocol Server) support is integrated into the library, facilitating its use with various AI tools.

I also have a TypeScript version of this module now at Indicator TS.

👆 Indicators Provided

The following list of indicators are currently supported by this package:

📈 Trend Indicators

🚀 Momentum Indicators

🎢 Volatility Indicators

📢 Volume Indicators

💰 Asset Valuation

🧠 Strategies Provided

The following list of strategies are currently supported by this package:

⚖ Base Strategies

📈 Trend Strategies

🚀 Momentum Strategies

🎢 Volatility Strategies

📢 Volume Strategies

🧪 Compound Strategies

Compound strategies merge multiple strategies to produce integrated recommendations. They combine individual strategies' recommendations using various decision-making logic.

🎁 Decorator Strategies

Decorator strategies offer a way to alter the recommendations of other strategies.

🗃 Repositories

Repository serves as a centralized storage and retrieval location for asset snapshots.

The following repository implementations are provided.

The Sync function facilitates the synchronization of assets between designated source and target repositories by employing multi-worker concurrency for enhanced efficiency. This function serves the purpose of procuring the most recent snapshots from remote repositories and seamlessly transferring them to local repositories, such as file system repositories.

The indicator-sync command line tool also offers the capability of synchronizing data between the Tiingo Repository and the File System Repository. To illustrate its usage, consider the following example command:

$ indicator-sync \
    -source-name tiingo \
    -source-config $TIINGO_KEY \
    -target-name filesystem \
    -target-config /home/user/assets \
    -days 30

This command effectively retrieves the most recent snapshots for assets residing within the /home/user/assets directory from the Tiingo Repository. In the event that the local asset file is devoid of content, it automatically extends its reach to synchronize 30 days' worth of snapshots, ensuring a comprehensive and up-to-date repository.

⏳ Backtesting

The Backtest functionality, using the Outcome, rigorously evaluates the potential performance of the specified strategies applied to a defined set of assets. It generates comprehensive visual representations for each strategy-asset pairing.

```go report := backtest.NewHTMLReport(outputDir) bt

Extension points exported contracts — how you extend this code

Strategy (Interface)
Strategy defines a shared interface for trading strategies. [52 implementers]
strategy/strategy.go
MaWithContext (Interface)
MaWithContext represents the interface for the Moving Average (MA) indicators that support context-aware computation. [51 …
trend/ma.go
Repository (Interface)
Repository serves as a centralized storage and retrieval location for asset snapshots. [5 implementers]
asset/repository.go
Report (Interface)
Report is the backtest report interface. [2 implementers]
backtest/report.go
ReportColumn (Interface)
ReportColumn defines the interface that all report data columns must implement. This interface ensures that different ty [1 …
helper/report.go
SQLRepositoryDialect (Interface)
SQLRepositoryDialect defines the SQL dialect for the SQL repository. [1 implementers]
asset/sql_repository_dialect.go
ReportBuilderFunc (FuncType)
ReportBuilderFunc defines a function to build a new report using the given configuration parameter.
backtest/report_factory.go
CsvOption (FuncType)
CsvOption represents a functional option for configuring the CSV instance.
helper/csv.go

Core symbols most depended-on inside this repo

IdlePeriod
called by 421
trend/ma.go
Map
called by 325
helper/map.go
SliceToChan
called by 300
helper/slice_to_chan.go
AddColumn
called by 239
helper/report.go
CheckEquals
called by 221
helper/check.go
Skip
called by 191
helper/skip.go
Duplicate
called by 190
helper/duplicate.go
NewNumericReportColumn
called by 187
helper/numeric_report_column.go

Shape

Function 929
Method 642
Struct 264
Interface 12
FuncType 3
TypeAlias 3

Languages

Go100%

Modules by API surface

helper/reflect_test.go49 symbols
asset/sql_repository_test.go24 symbols
helper/csv.go22 symbols
helper/csv_test.go19 symbols
asset/snapshot.go13 symbols
momentum/connors_rsi.go12 symbols
helper/bst.go12 symbols
backtest/html_report.go12 symbols
backtest/backtest_test.go12 symbols
strategy/strategy.go11 symbols
helper/report.go11 symbols
trend/pivot_point.go10 symbols

For agents

$ claude mcp add indicator \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact