What are custom strategies?
- Use built-in trading methods, candle, and indicator data to quickly create custom strategies.
- A strategy runs as an async function, executed once every time a trading pair 'cycles' in Gunbot.
About the environment your code runs in
Here are some important technical facts to keep in mind:
- Gunbot takes care of the exchange connection, collecting data, and making it available to a strategy.
- Save strategies in your own .js files in a folder called
- Strategy code has access to a single outside object:
gb, which contains a number of trading methods and lots of data to work with.
- There are no restrictions on what you can do with the provided trading methods, but exchange-defined restrictions apply (API usage rate limits, open orders limits, etc.).
- There are no protections against double orders or any other unwanted behavior, so be careful.
console.log()logs to the main Gunbot console logs.
- Code runs inside an async function, and you can use the
awaitkeyword to collect additional data like candle data for a different timeframe.
- A strategy does not have to return anything, but you can use
returnstatements to easily stop your code at a certain point.
user_modulesinside your Gunbot folder.