{"id":22608950,"url":"https://github.com/bitfinexcom/bfx-hf-models","last_synced_at":"2025-10-30T02:11:01.347Z","repository":{"id":33155981,"uuid":"149792215","full_name":"bitfinexcom/bfx-hf-models","owner":"bitfinexcom","description":null,"archived":false,"fork":false,"pushed_at":"2022-07-07T19:46:39.000Z","size":187,"stargazers_count":5,"open_issues_count":3,"forks_count":16,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-09-23T17:13:37.155Z","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":"2018-09-21T16:53:08.000Z","updated_at":"2024-03-11T14:14:37.000Z","dependencies_parsed_at":"2022-07-11T19:50:03.627Z","dependency_job_id":null,"html_url":"https://github.com/bitfinexcom/bfx-hf-models","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/bitfinexcom/bfx-hf-models","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fbfx-hf-models","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fbfx-hf-models/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fbfx-hf-models/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fbfx-hf-models/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitfinexcom","download_url":"https://codeload.github.com/bitfinexcom/bfx-hf-models/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fbfx-hf-models/sbom","scorecard":{"id":240168,"data":{"date":"2025-08-11","repo":{"name":"github.com/bitfinexcom/bfx-hf-models","commit":"846bca49cb1650cf7eac27211e37d7f2196c9479"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.2,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":4,"reason":"Found 7/15 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":5,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'master'","Info: 'force pushes' disabled on branch 'master'","Info: 'branch protection settings apply to administrators' is required to merge on branch 'master'","Info: 'stale review dismissal' is required to merge on branch 'master'","Info: required approving review count is 2 on branch 'master'","Warn: codeowners review is not required on branch 'master'","Warn: 'last push approval' is disabled on branch 'master'","Warn: no status checks found to merge onto branch 'master'","Info: PRs are required in order to make changes on branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 22 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T06:34:17.290Z","repository_id":33155981,"created_at":"2025-08-17T06:34:17.290Z","updated_at":"2025-08-17T06:34:17.290Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281731419,"owners_count":26551804,"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","status":"online","status_checked_at":"2025-10-30T02:00:06.501Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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:21.131Z","updated_at":"2025-10-30T02:11:01.331Z","avatar_url":"https://github.com/bitfinexcom.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Bitfinex Honey Framework Database System for Node.JS\n\n[![Build Status](https://travis-ci.org/bitfinexcom/bfx-hf-models.svg?branch=master)](https://travis-ci.org/bitfinexcom/bfx-hf-models)\n\nThis repo implements a backend-agnostic database system for the Bitfinex Honey Framework. It is used by all HF repos for data storage, i.e:\n\n* `bfx-hf-data-server`\n* `bfx-hf-algo-server`\n* `bfx-hf-server`\n\nBoth the DB backend and exchange-specific schema methods can be configured upon initialization. There are currently two official exchange adapters:\n\n* `bfx-hf-ext-plugin-bitfinex` - implements Bitfinex-specific model methods\n* `bfx-hf-ext-plugin-dummy` - provides the base set of DB methods\n\nBesides these, two DB backends are available:\n\n* `bfx-hf-models-adapter-lowdb`\n* `bfx-hf-models-adapter-sql` - uses knex internally, allowing flexibility in DB selection\n\n### Features\n\n* DB-agnostic; currently two official backends are supported: `lowdb` and `knex` for SQL databases.\n* Exchange-agnostic; exchange-specific sync logic is provided via a plugin system\n\n#### Available Models\n* AlgoOrder\n* Backtest\n* Candle\n* Credential\n* Strategy\n* Trade\n\n### Installation\n\n```bash\nnpm i --save bfx-hf-models\n```\n\n### Quickstart\n\n```js\nconst HFDB = require('bfx-hf-models')\nconst HFDBLowDBAdapter = require('bfx-hf-models-adapter-lowdb')\nconst { schema: DummySchema } = require('bfx-hf-ext-plugin-dummy')\n\nconst db = new HFDB({\n  schema: DummySchema,\n  adapter: HFDBLowDBAdapter({\n    dbPath: './db.json',\n  })\n})\n\n// db is now ready to be used; see examples below\n```\n\n### Docs\n\n[Refer to `docs/models.md`](/docs/models.md) for an overview of the available models and their schema, [and `docs/methods.md`](/docs/methods.md) for a list of methods available for both map \u0026 collection models.\n\nExecutable examples are available [within `examples/`](/examples).\n\n### Examples\n#### Usage of built-in models \u0026 methods\n```js\nconst HFDB = require('bfx-hf-models')\nconst HFDBLowDBAdapter = require('bfx-hf-models-adapter-lowdb')\nconst { schema: DummySchema } = require('bfx-hf-ext-plugin-dummy')\n\nconst db = new HFDB({\n  schema: DummySchema,\n  adapter: HFDBLowDBAdapter({\n    dbPath: './db.json',\n  })\n})\n\n// All default models are available, but will lack exchange specific methods (i.e Candle.sync_range())\nconst {\n  AlgoOrder, Backtest, Candle, Credential, Strategy, Trade\n} = db\n\nconst allCandles = await Candle.getAll()\nconst allTrades = await Trade.getAll()\nconst activeAlgoOrders = await AlgoOrder.find(['active', '=', true])\nconst allCredentialsByCID = await Credential.getAll()\nconst allCredentials = Object.values(allCredentialsByCID)\nconst credential = await Credential.create({\n  cid: Date.now(),\n  key: 'some_public_key',\n  secret: 'some_secret_key',\n  meta: 'credential information'\n})\n\n//  etc...\n```\n\n#### Usage of bitfinex model methods\nAs above, but with the bitfinex plugin the `Candle` and `Trade` models will gain a `syncRange()` method which populates the local DB with data from the exchange API.\n\n```js\nconst HFDB = require('bfx-hf-models')\nconst HFDBLowDBAdapter = require('bfx-hf-models-adapter-lowdb')\nconst { schema: BitfinexSchema } = require('bfx-hf-ext-plugin-bitfinex')\n\nconst db = new HFDB({\n  schema: BitfinexSchema,\n  adapter: HFDBLowDBAdapter({\n    dbPath: './db.json',\n  })\n})\n\nconst SYMBOL = 'tBTCUSD'\nconst TIME_FRAME = '1m'\nconst END_MTS = Date.now()\nconst START_MTS = END_MTS - (60 * 60 * 1000)\nconst { Candle } = db\n\n// sync range\nawait Candle.syncRange({\n  exchange: 'bitfinex',\n  type: 'trade',\n  symbol: SYMBOL,\n  tf: TIME_FRAME,\n}, {\n  start: START_MTS,\n  end: END_MTS,\n})\n\n// candles are now in DB, and can be queried\nconst bitfinexCandles = await Candle.getInRange([\n  ['exchange', '=', 'bitfinex'],\n  ['symbol', '=', SYMBOL],\n  ['tf', '=', TIME_FRAME]\n], {\n  key: 'mts',\n  start: START_MTS,\n  end: END_MTS\n})\n\n// etc...\n```\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-models.git#v2.3.1\n```\n\nExample on how to install it latest version from github:\n```\nnpm i --save-prod https://github.com/bitfinexcom/bfx-hf-models.git\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitfinexcom%2Fbfx-hf-models","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitfinexcom%2Fbfx-hf-models","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitfinexcom%2Fbfx-hf-models/lists"}