{"id":22608958,"url":"https://github.com/bitfinexcom/bfx-hf-strategy-dazaar","last_synced_at":"2025-08-06T13:15:56.051Z","repository":{"id":40757494,"uuid":"287525206","full_name":"bitfinexcom/bfx-hf-strategy-dazaar","owner":"bitfinexcom","description":null,"archived":false,"fork":false,"pushed_at":"2022-07-07T20:02:49.000Z","size":46,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-11T06:18:04.996Z","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}},"created_at":"2020-08-14T12:14:19.000Z","updated_at":"2022-07-07T20:02:53.000Z","dependencies_parsed_at":"2022-09-20T22:11:16.022Z","dependency_job_id":null,"html_url":"https://github.com/bitfinexcom/bfx-hf-strategy-dazaar","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fbfx-hf-strategy-dazaar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fbfx-hf-strategy-dazaar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fbfx-hf-strategy-dazaar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fbfx-hf-strategy-dazaar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitfinexcom","download_url":"https://codeload.github.com/bitfinexcom/bfx-hf-strategy-dazaar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248351396,"owners_count":21089272,"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:23.090Z","updated_at":"2025-04-11T06:18:10.631Z","avatar_url":"https://github.com/bitfinexcom.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bitfinex Honey Framework Dazaar Module\n\n[![Build Status](https://travis-ci.org/bitfinexcom/bfx-hf-strategy-exec.svg?branch=master)](https://travis-ci.org/bitfinexcom/bfx-hf-strategy-exec)\n\nThis module can execute strategies built with `bfx-hf-strategy` on a live data stream from dazaar hypercores and dazaar market data.\n\n### Features\n\n* Execute trading strategies on the live Bitfinex markets using Bitfinex Terminal Streams\n* Easy selling of trading signals on Dazaar\n\n### Installation\n\n```bash\nnpm i --save bfx-hf-strategy-dazaar\n```\n\n### Quickstart \u0026 Example\n\nFull examples are in the  [`examples/`](/examples) folder.\n\n\n#### Selling Trading Signals on Dazaar\n\nFull example in [./examples/example_ema_dazaar_sell.js](./examples/example_ema_dazaar_sell.js)\n\n```js\nconst execDazaar = require('bfx-hf-strategy-dazaar')\nconst util = require('bfx-hf-strategy-dazaar/util')\n\nconst EMAStrategy = require('bfx-hf-strategy/examples/ema_cross')\nconst { SYMBOLS, TIME_FRAMES } = require('bfx-hf-util')\n\nconst market = {\n  symbol: SYMBOLS.BTC_USD,\n  tf: TIME_FRAMES.ONE_HOUR\n}\n\nconst strategy = EMAStrategy(market)\nconst submitOrder = util.getSubmitOrderToFeed(sellFeed)\n\nconst { exec, stream } = await execDazaar(strategy, market, db, {\n  submitOrder,\n  includeTrades: false,\n  seedCandleCount: 10\n})\n\nlet btState\nfor await (const data of stream) {\n  const { key, value } = data\n  btState = await exec(key, value)\n}\n```\n\n#### Trade with Custom Order Submit Functions\n\nYou can use any custom function to handle trading signals, as long as it returns a promise.\n\nFull example in [./examples/example_ema_websocket.js](./examples/example_ema_websocket.js)\n\n```js\nasync function submitOrder (strategyState = {}, order = {}) {\n  const { amount, price, type } = order\n\n  // BFX WS API\n  // https://github.com/bitfinexcom/bitfinex-api-node\n\n  const o = new Order({\n    cid: Date.now(),\n    symbol: 'tETHUSD',\n    amount,\n    type,\n    price\n  }, ws)\n\n  await o.submit()\n})\n\nconst { exec, stream } = await execDazaar(strategy, market, db, {\n  submitOrder,\n  includeTrades: false,\n  seedCandleCount: 10\n})\n```\n\n\n\n### Docs\n\nFor executable examples refer to the [`examples/`](/examples) folder. JSDoc generated API documentation can be found [within `docs/api.md`](/docs/api.md).\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitfinexcom%2Fbfx-hf-strategy-dazaar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitfinexcom%2Fbfx-hf-strategy-dazaar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitfinexcom%2Fbfx-hf-strategy-dazaar/lists"}