Coygo Forge Hackathon 2022


Code a custom crypto trading bot and you could win $100 of BTC or ETH!

Multiple submissions will receive awards - you could win more than once!

Hackathon submission spotlight!

"The Meme Machine"

We'd like to highlight one of the more interesting submissions to our Coygo Forge Hackathon, "The Meme Machine"!

This automated crypto trading bot strategy was created with Coygo Forge and custom JavaScript code. It uses the BittsAnalytics API to retrieve social sentiment analysis data about different cryptocurrencies which helps determine when to buy or sell an asset.

We know many traders use social sentiment analysis to try and find and confirm trending assets. Unfortunately we have recently disabled the ability to retrieve data using external REST APIs within Coygo Forge due to security reasons, so this strategy will not be possible for future versions of Coygo Forge.

We are aware of how powerful social sentiment data can be though, so we are discussing how to support this in a more official manner in the future. Thanks for the inspiration!

// configure basic information about the strategy
coygo.configure({
  orderTypes: [
    coygo.orderTypes.market, // indicates this strategy supports market orders
  ]
});
/*
  Inputs that must be supplied by the user for this bot to run
*/
const exchangeInput = coygo.input({
    type: coygo.inputTypes.exchange,
    label: 'The exchange to use',
    description: 'Select the exchange of the order book that this bot will subscribe to'
  });
  const tradePairInput = coygo.input({
    type: coygo.inputTypes.tradePair,
    label: 'The trade pair',
    description: 'Select the trade pair that this bot will subscribe to. The first asset in the pair is the one that will be bought or sold for the other asset.'
  });
  const targetPositiveSentimentInput = coygo.input({
    type: coygo.inputTypes.number,
    label: 'Positive sentiment % to trigger buy or sell',
    description: 'When positive sentiment rises above this threshold asset will be sold or purchased in accordance with other inputs.'
  });
  const actionForPositiveSentimentInput = coygo.input({
    type: coygo.inputTypes.selectFromList,
    label: 'The action to take when positive sentiment threshold is reached',
    description: 'When positive sentiment threshold rises above the target, the action selected for this input will be taken.',
    list: ['buy', 'sell', 'nothing']
  });
  const targetNegativeSentimentInput = coygo.input({
    type: coygo.inputTypes.number,
    label: 'Positive sentiment % to trigger buy or sell',
    description: 'When positive sentiment rises above this threshold asset will be sold or purchased in accordance with other inputs.'
  });
  const actionForNegativeSentimentInput = coygo.input({
    type: coygo.inputTypes.selectFromList,
    label: 'The action to take when positive sentiment threshold is reached',
    description: 'When positive sentiment threshold rises above the target, the action selected for this input will be taken.',
    list: ['buy', 'sell', 'nothing']
  });
  const orderAmountInput = coygo.input({
    type: coygo.inputTypes.number,
    label: 'Order amount',
    description: 'The amount of the asset that will be bought or sold when thresholds are reached.',
    min: 0
  });
/*
  Set up the exchange market(s) this strategy will be interacting with.
*/
const thisMarket = coygo.market({
  exchange: exchangeInput,
  baseSymbol: tradePairInput.baseSymbol,
  quoteSymbol: tradePairInput.quoteSymbol
});
// Scrape bittsanalytics.com for sentiment values
const resp = await fetch('https://www.bittsanalytics.com/sentiment-index/' + tradePairInput.baseSymbol.toUpperCase());
const siteData = await resp.json();
// Find the sentiment index for the involved asset, and trim down the page source to just that asset
var regex = new RegExp('/\/sentiment-index\/' + tradePairInput.baseSymbol.toUpperCase() + '/')
var match = regex.exec(siteData)
siteData = siteData.substring(match[0].index, 150)
// Traverse through the trimmed down source to find the specific sentiment value
var subsequentRegex = new RegExp('/^(?:.*?([^<]*)<\ td="">){3}/');
var subsequentMatch = regex.exec(siteData)
const sentimentValue = Number(subsequentMatch[0]);
/*
Submit buy orders if favorable conditions found
*/
const shouldBuy = (
    // if either sentiment has reached the threshold and the action is buy we place a buy order
    (actionForPositiveSentimentInput == 'buy' && sentimentValue > targetPositiveSentimentInput) ||
    (actionForNegativeSentimentInput == 'buy' && sentimentValue < targetNegativeSentimentInput) 
);
/*
Submit sell orders if favorable conditions found
*/
const shouldSell = (
    // if either sentiment has reached the threshold and the action is sell we place a sell order
    (actionForPositiveSentimentInput == 'sell' && sentimentValue > targetPositiveSentimentInput) ||
    (actionForNegativeSentimentInput == 'sell' && sentimentValue < targetNegativeSentimentInput) 
);
  coygo.log('Current level of  sentiment for ' + tradePairInput.baseSymbol + ' is at ' + sentimentValue  + ' against a positive action threshold of ' + targetPositiveSentimentInput + ' If met the action triggered will be: ' + actionForPositiveSentimentInput);
  coygo.log('Current level of  sentiment for ' + tradePairInput.baseSymbol + ' is at ' + sentimentValue  + ' against a negative action threshold of ' + targetNegativeSentimentInput + ' If met the action triggered will be: ' + actionForNegativeSentimentInput);
  if (shouldBuy) {
    // set up the order config
    const orderConfig = {
      market: thisMarket,  // The Market to submit this order to. This should come from the return value of coygo.market(options).
      type: coygo.orderTypes.market, // The type of order to be submitted. Use coygo.orderTypes to specify the type.
      side: coygo.orderSides.buy,  // The side of the order to be submitted. Use coygo.orderSides to specify the side.
      amount: orderAmountInput,  // The order amount to be submitted.
    };
    const canSubmitCheck = coygo.canSubmitOrder(orderConfig);
    // check if this order can be submitted. this will check balanaces, exchange amount limits, etc.
    if (canSubmitCheck.canSubmit === true) {
      // order can be submitted
      coygo.log('Executing buy order of ' + orderAmountInput + ' ' + tradePairInput.baseSymbol);
      coygo.submitOrder(orderConfig);
    } else if (canSubmitCheck.canSubmit === false) {
      // order cannot be submitted. see 'canSubmitCheck.reason' for more details
      coygo.log('Attempted buy order but it could not be submitted for the following reason:', canSubmitCheck.reason, ' wanted to submit the following order: ', {
        type: orderConfig.type,
        side: orderConfig.side,
        amount: orderConfig.amount
      });
    }
  } 
  else if(shouldSell)
  {
    // set up the order config
    const orderConfig = {
        market: thisMarket,  // The Market to submit this order to. This should come from the return value of coygo.market(options).
        type: coygo.orderTypes.market, // The type of order to be submitted. Use coygo.orderTypes to specify the type.
        side: coygo.orderSides.sell,  // The side of the order to be submitted. Use coygo.orderSides to specify the side.
        amount: orderAmountInput,  // The order amount to be submitted.
      };
      const canSubmitCheck = coygo.canSubmitOrder(orderConfig);
      // check if this order can be submitted. this will check balanaces, exchange amount limits, etc.
      if (canSubmitCheck.canSubmit === true) {
        // order can be submitted
        coygo.log('Executing sell order of ' + orderAmountInput + ' ' + tradePairInput.baseSymbol);
        coygo.submitOrder(orderConfig);
      } else if (canSubmitCheck.canSubmit === false) {
        // order cannot be submitted. see 'canSubmitCheck.reason' for more details
        coygo.log('Attempted sell order but it could not be submitted for the following reason:', canSubmitCheck.reason, ' wanted to submit the following order: ', {
          type: orderConfig.type,
          side: orderConfig.side,
          amount: orderConfig.amount
        });
      }
  }
}

About the Hackathon

We've built a powerful platform and framework for coding custom crypto trading bots called Coygo Forge. Now we want to see what you can build with it!

  • Code a custom bot strategy for chance to win $100 of BTC or ETH*. Multiple submissions will be chosen to receive an award.
  • Feel free to enter multiple submissions - you could win more than once!
  • Submissions must focus on either real-time trading strategies that benefit from live order book data (arbitrage, market maker, etc.), or strategies that work on intervals of 5 minutes or shorter and don't rely on much historical data (grid trading, etc.). See "What can I create" below for ideas.
  • Anyone who enters will get their first month’s Coygo subscription for free
  • Contestants & winners will get a special badge in our Forge Community on reddit

How do I participate?

  • Sign up for a Coygo account
  • Use the promo code "HACKATHON22" to get one month's Coygo subscription for free ($17 value). A payment method will be required but you will get a free trial and your first month free!
  • Download Coygo Terminal
  • Code your own custom trading bot strategy with Coygo Forge
  • Join the Forge Community on reddit, see the details here
  • Submit your code in a new post to the Forge Community on reddit before the submission deadline of October 20, 2022
  • Winners will be announced shortly after the submission deadline of October 20, 2022

Join the community!

If you need help or want to collaborate with others, we have a private reddit community at https://reddit.com/r/CoygoForge/ where you can collaborate with and learn from others or get help directly from the Coygo team! All hackathon submissions will be made through the reddit community.

Get invited to the Forge Community today!

What can I create?

You are welcome to create any type of trading strategy you'd like! If you're not sure where to start we've put together some examples below afor inspiration.

Infinite grid trader

Constantly buys and sells at pre-defined price intervals, for example +/- 2%. Similar to the "Spot grid trader" but without any upper or lower bound for the range of prices it trades within.

Compounding grid trader

Constantly buys and sells at pre-defined price intervals, for example +/- 2%. Similar to the "Spot grid trader" but compounds returns by increasing order amounts to re-invest any profits.

Accumulator

Increase or decrease your holdings in a market while reducing slippage by splitting your buy/sell amount into multiple order amounts spaced apart over a short time. Order amounts and time between orders could be randomized or pre-configured. Bot would stop itself once it's bought or sold the total desired amount.

Advanced market maker

Constantly places buy/sell orders near the ask/bid rate to attempt to profit off of the bid-ask spread. Similar to "Simple market maker" but it could place multiple price levels of buy/sell orders. It could also dynamically determine the rates to submit buy/sell orders at given latest rates, your trading fees, etc.

Flash crash hunter

Sets target buy prices at pre-defined amounts below the current rate (i.e. every -2%), along with corresponding sell prices above each buy price, to attempt to profit off of short-term price drops and their following recoveries. Similar to "Drop hunter" but it sets up multiple target buy prices. It could also monitor multiple markets at once, i.e. if you have USD you could be monitoring any four or five markets that use USD (BTC-USD, ETH-USD, ADA-USD, etc.) and buy them when the price drops a desired amount with your USD.

Smart rebalancer - 4 coins

Repeatedly rebalances a portfolio of 4 coins to desired proportions. This attempts to reduce risk by spreading exposure across multiple assets, and to profit off of the volatility between the selected coins by constantly selling high and buying low. Similar to "Smart rebalancer: 5 coins" but it rebalances a porftolio of 4 coins instead of 5.

Good luck!

We can't wait to see what you can build.

* Rate of BTC or ETH to achieve $100 of value to be determined by Coygo at the time of sending to any winners.
Hackathon icon created by Flat Icons