
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
bfx-hf-strategy
Advanced tools
This 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.
Strategies 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.
bfx-hf-backtest for backtest executionbfx-hf-strategy-exec for execution on live marketsnpm i --save bfx-hf-strategy
Using 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:
const { MACD } = require('bfx-hf-indicators')
const { SYMBOLS, TIME_FRAMES } = require('bfx-hf-util')
const HFS = require('bfx-hf-strategy')
module.exports = ({
symbol = SYMBOLS.BTC_USD,
tf = TIME_FRAMES.ONE_HOUR
} = {}) => HFS.define({
id: 'quickstart_example',
name: 'quickstart_example',
symbol,
tf,
indicators: {
macd: new MACD([10, 26, 9])
},
// This quickstart example immediately opens a long position, and then no
// longer reacts to future market updates
onPriceUpdate: async (state = {}, update = {}) => {
const position = HFS.getPosition(state)
if (position) {
return state
}
return HFS.openLongPositionMarket(state, {
mtsCreate: mts,
amount: 1,
price
})
}
})
Refer to docs/usage.md for an overview of the strategy system and methods available at runtime, and docs/api.md for JSDoc-generated API documentation.
Ready to run examples can be found in the examples/ folder
git checkout -b my-new-feature)git commit -am 'Add some feature')git push origin my-new-feature)FAQs
HF strategy module
We found that bfx-hf-strategy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.