Skip to main content

Visual Studio Code extension for custom strategy devs

· 4 min read
@boekenbox

We've built a new Gunbot Custom Trading Strategy Snippets extension for Visual Studio Code. It provides a collection of pre-built snippets to make coding your trading strategies smoother and easier, minimizing the need to repeatedly check documentation for how methods work and which data is available. This extension helps you quickly access methods and data points that Gunbot supports.

Symbol image of gunbot vscode extension

Key Features of the Gunbot Snippet Extension​

The Gunbot Custom Trading Strategy Snippets extension includes a variety of ready-made JavaScript snippets specifically designed for Gunbot strategy development. Here’s what it offers:

  • Immediate access to Gunbot methods: Save time and avoid manual lookups by inserting common trading commands like buyMarket() or sellLimit() directly from the snippet library.
  • Snippets for technical indicators: Easily include popular technical indicators, such as Moving Averages or RSI, into your strategy without needing to write the logic from scratch.
  • Integration with live data points: Snippets are designed to work with live data points supported by Gunbot, which can simplify integrating real-time market data into your strategies.
  • Snippet sidebar for easy browsing: A dedicated sidebar in VS Code helps you quickly locate and insert the right snippets for your strategy.

Simplifying Gunbot Strategy Development​

For developers working on custom Gunbot strategies, this thing is a timesaver, but above all it reduces the hassle of having to frequently reference documentation to remember method names or how to call certain data points. With the snippets readily available, you can avoid interruptions to your workflow and focus on fine-tuning your strategy's logic.

  • Streamlined Prototyping: The snippets library allows you to rapidly set up key parts of a strategy. Instead of writing common methods manually, you can insert a snippet, make small customizations, and move forward faster.
  • Reducing Documentation Overhead: One of the main advantages of the extension is that it reduces the need to look up method documentation frequently, which can help developers stay focused on their code.

vscode extension

How to Install the Extension​

Follow these simple steps to install the Gunbot Custom Trading Strategy Snippets extension:

  1. Open Visual Studio Code and navigate to the Extensions view (Ctrl + Shift + X).
  2. In the search bar, type "Gunbot Custom Trading Strategy Snippets."
  3. Click Install.

Once the extension is installed, you can start using the snippets in any JavaScript file related to your Gunbot strategies.

Example Usage of Snippets​

Let’s look at an example. Suppose you want to place a limit sell within your Gunbot strategy and do so using a promise chain. Normally, you'd need to reference the method name and its parameters in the documentation, and remember how to do the .then chain. With the extension, you just type the prefix sellLimit, select the then variant and move on.

// Example of placing a limit buy order in Gunbot, in this case with a chained .then and .catch
gb.method.sellLimit(amount, price, gb.data.pairName, gb.data.exchangeName)
.then(response => {
console.log('Limit Sell Success:', response);
})
.catch(error => {
console.error('Limit Sell Error:', error);
});

This streamlines your coding experience and reduces potential errors from mistyped methods or forgotten parameters.

Contribute to the Snippets Collection​

This extension is open source, and contributions are welcome! If you have your own snippets that could benefit other Gunbot developers, consider sharing them with the community. Here's how you can contribute:

  1. Fork the repository on GitHub.
  2. Add your snippets in the json file with snippets and their metadata.
  3. Submit a pull request to propose your addition.

Your contributions will help expand the snippet library and make it an even more valuable resource for the Gunbot development community.

Conclusion​

The Gunbot Custom Trading Strategy Snippets extension is a useful tool for any developer working with Gunbot custom strategies. With instant access to key methods, technical indicators, and live data points, it helps simplify the trading strategy development process and reduces the need to constantly reference external documentation. If you're developing Gunbot strategies, this extension is a great addition to your toolkit.

Install the Extension from the VS Code Marketplace