{"id":22608922,"url":"https://github.com/bitfinexcom/bfx-hf-strategy","last_synced_at":"2026-03-09T00:31:45.634Z","repository":{"id":37958435,"uuid":"143997991","full_name":"bitfinexcom/bfx-hf-strategy","owner":"bitfinexcom","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-11T12:37:13.000Z","size":324,"stargazers_count":27,"open_issues_count":9,"forks_count":21,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-11T06:13:51.408Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitfinexcom.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","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}},"created_at":"2018-08-08T10:27:30.000Z","updated_at":"2025-04-08T14:42:42.000Z","dependencies_parsed_at":"2023-10-11T15:37:34.530Z","dependency_job_id":null,"html_url":"https://github.com/bitfinexcom/bfx-hf-strategy","commit_stats":{"total_commits":135,"total_committers":8,"mean_commits":16.875,"dds":0.5481481481481482,"last_synced_commit":"d15fca4b75cb1b10ac6ac78c681eeab52973f815"},"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fbfx-hf-strategy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fbfx-hf-strategy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fbfx-hf-strategy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fbfx-hf-strategy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitfinexcom","download_url":"https://codeload.github.com/bitfinexcom/bfx-hf-strategy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248351393,"owners_count":21089270,"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":[],"created_at":"2024-12-08T15:10:06.507Z","updated_at":"2026-03-09T00:31:40.606Z","avatar_url":"https://github.com/bitfinexcom.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Bitfinex Honey Framework Trading Strategy Library for Node.JS\n\n[![Build Status](https://travis-ci.org/bitfinexcom/bfx-hf-strategy.svg?branch=master)](https://travis-ci.org/bitfinexcom/bfx-hf-strategy)\n\nThis repo serves as a framework for creating trading bots/strategies on the Bitfinex platform. It consists of a set of order methods and an architecture compatible with `bfx-hf-data-server` and `bfx-hf-backtest` for backtests on historical candle/trade data, which can be transitioned seamlessly to trading on the live markets.\n\nStrategies written using this framework must define a set of update methods, called on each tick (with either a trade or a candle), along with a set of indicators which are automatically updated on each tick. The indicators are made available to the strategy methods, and can be queried to direct trading behavior.\n\n### Features\n* Event-driven design approach allowing strategies to react to market updates in real-time\n* Compatibility with `bfx-hf-backtest` for backtest execution\n* Compatibility with `bfx-hf-strategy-exec` for execution on live markets\n\n### Installation\n\n```bash\nnpm i --save bfx-hf-strategy\n```\n\n### Quickstart \u0026 Example\n\nUsing `bfx-hf-stratey` implies writing a custom strategy utilizing the methods provided by the library. The following is an example of a valid strategy as defined within `examples/macd_cross`:\n\n```js\nconst { MACD } = require('bfx-hf-indicators')\nconst { SYMBOLS, TIME_FRAMES } = require('bfx-hf-util')\nconst HFS = require('bfx-hf-strategy')\n\nmodule.exports = ({\n  symbol = SYMBOLS.BTC_USD,\n  tf = TIME_FRAMES.ONE_HOUR\n} = {}) =\u003e HFS.define({\n  id: 'quickstart_example',\n  name: 'quickstart_example',\n  symbol,\n  tf,\n\n  indicators: {\n    macd: new MACD([10, 26, 9])\n  },\n\n  // This quickstart example immediately opens a long position, and then no\n  // longer reacts to future market updates\n  onPriceUpdate: async (state = {}, update = {}) =\u003e {\n    const position = HFS.getPosition(state)\n\n    if (position) {\n      return state\n    }\n\n    return HFS.openLongPositionMarket(state, {\n      mtsCreate: mts,\n      amount: 1,\n      price\n    })\n  }\n})\n```\n\n### Docs\n\n[Refer to `docs/usage.md`](/docs/usage.md) for an overview of the strategy system and methods available at runtime, [and `docs/api.md`](/docs/api.md) for JSDoc-generated API documentation.\n\nReady to run examples can be found in the [`examples/` folder](/examples)\n\n### Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n### Note\n\nThis package will be maintained only via github, please use latest relases from github instead of npm.\n\nExample on how to install specific version from github:\n```\nnpm i --save-prod https://github.com/bitfinexcom/bfx-hf-strategy.git#v1.1.1\n```\n\nExample on how to install it latest version from github:\n```\nnpm i --save-prod https://github.com/bitfinexcom/bfx-hf-strategy.git\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitfinexcom%2Fbfx-hf-strategy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitfinexcom%2Fbfx-hf-strategy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitfinexcom%2Fbfx-hf-strategy/lists"}