{"id":13412865,"url":"https://github.com/sdcoffey/techan","last_synced_at":"2025-04-08T14:06:21.132Z","repository":{"id":31291815,"uuid":"84272132","full_name":"sdcoffey/techan","owner":"sdcoffey","description":"Technical Analysis Library for Golang","archived":false,"fork":false,"pushed_at":"2023-09-13T21:16:18.000Z","size":184,"stargazers_count":817,"open_issues_count":21,"forks_count":143,"subscribers_count":53,"default_branch":"main","last_synced_at":"2024-07-31T20:51:36.163Z","etag":null,"topics":["bitcoin","cryptocurrency","go","golang","stock","stock-market","technical-analysis","trading-bot","trading-strategies"],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/sdcoffey/techan","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sdcoffey.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-03-08T03:04:08.000Z","updated_at":"2024-07-30T14:16:35.000Z","dependencies_parsed_at":"2024-01-08T15:02:45.267Z","dependency_job_id":"efcb0589-028e-497b-97af-74e608598c3b","html_url":"https://github.com/sdcoffey/techan","commit_stats":{"total_commits":150,"total_committers":8,"mean_commits":18.75,"dds":0.3733333333333333,"last_synced_commit":"e192d24cb6932aff7ba1470d619ead27ef77dc46"},"previous_names":["sdcoffey/talib4g"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdcoffey%2Ftechan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdcoffey%2Ftechan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdcoffey%2Ftechan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdcoffey%2Ftechan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sdcoffey","download_url":"https://codeload.github.com/sdcoffey/techan/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247856541,"owners_count":21007620,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitcoin","cryptocurrency","go","golang","stock","stock-market","technical-analysis","trading-bot","trading-strategies"],"created_at":"2024-07-30T20:01:30.336Z","updated_at":"2025-04-08T14:06:21.103Z","avatar_url":"https://github.com/sdcoffey.png","language":"Go","readme":"## Techan\n![](https://travis-ci.org/sdcoffey/techan.svg?branch=master)\n\n[![codecov](https://codecov.io/gh/sdcoffey/techan/branch/master/graph/badge.svg)](https://codecov.io/gh/sdcoffey/techan)\n\nTechAn is a **tech**nical **an**alysis library for Go! It provides a suite of tools and frameworks to analyze financial data and make trading decisions.\n\n## Features \n* Basic and advanced technical analysis indicators\n* Profit and trade analysis\n* Strategy building\n\n### Installation\n```sh\n$ go get github.com/sdcoffey/techan\n```\n\n### Quickstart\n```go\nseries := techan.NewTimeSeries()\n\n// fetch this from your preferred exchange\ndataset := [][]string{\n\t// Timestamp, Open, Close, High, Low, volume\n\t{\"1234567\", \"1\", \"2\", \"3\", \"5\", \"6\"},\n}\n\nfor _, datum := range dataset {\n\tstart, _ := strconv.ParseInt(datum[0], 10, 64)\n\tperiod := techan.NewTimePeriod(time.Unix(start, 0), time.Hour*24)\n\n\tcandle := techan.NewCandle(period)\n\tcandle.OpenPrice = big.NewFromString(datum[1])\n\tcandle.ClosePrice = big.NewFromString(datum[2])\n\tcandle.MaxPrice = big.NewFromString(datum[3])\n\tcandle.MinPrice = big.NewFromString(datum[4])\n\n\tseries.AddCandle(candle)\n}\n\nclosePrices := techan.NewClosePriceIndicator(series)\nmovingAverage := techan.NewEMAIndicator(closePrices, 10) // Create an exponential moving average with a window of 10\n\nfmt.Println(movingAverage.Calculate(0).FormattedString(2))\n```\n\n### Creating trading strategies\n```go\nindicator := techan.NewClosePriceIndicator(series)\n\n// record trades on this object\nrecord := techan.NewTradingRecord()\n\nentryConstant := techan.NewConstantIndicator(30)\nexitConstant := techan.NewConstantIndicator(10)\n\n// Is satisfied when the price ema moves above 30 and the current position is new\nentryRule := techan.And(\n\ttechan.NewCrossUpIndicatorRule(entryConstant, indicator),\n\ttechan.PositionNewRule{})\n\t\n// Is satisfied when the price ema moves below 10 and the current position is open\nexitRule := techan.And(\n\ttechan.NewCrossDownIndicatorRule(indicator, exitConstant),\n\ttechan.PositionOpenRule{})\n\nstrategy := techan.RuleStrategy{\n\tUnstablePeriod: 10, // Period before which ShouldEnter and ShouldExit will always return false\n\tEntryRule:      entryRule,\n\tExitRule:       exitRule,\n}\n\nstrategy.ShouldEnter(0, record) // returns false\n```\n\n### Enjoying this project?\nAre you using techan in production? You can sponsor its development by buying me a coffee! ☕\n\n**ETH:** `0x2D9d3A1c16F118A3a59d0e446d574e1F01F62949`\n\n### Credits\nTechan is heavily influenced by the great [ta4j](https://github.com/ta4j/ta4j). Many of the ideas and frameworks in this library owe their genesis to the great work done over there.\n\n### License\n\nTechan is released under the MIT license. See [LICENSE](./LICENSE) for details.\n","funding_links":[],"categories":["Financial","Go","金融领域相关库","金融","Technical analysis libraries","金融领域相关库`处理货币与金融领域的库`","Relational Databases"],"sub_categories":["Advanced Console UIs","Search and Analytic Databases","SQL 查询语句构建库","检索及分析资料库"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdcoffey%2Ftechan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsdcoffey%2Ftechan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdcoffey%2Ftechan/lists"}