Skip to content

Instantly share code, notes, and snippets.

@evan-coygo
Last active August 17, 2022 17:32
Show Gist options
  • Save evan-coygo/305df6f49a939be73f165dcda8c77706 to your computer and use it in GitHub Desktop.
Save evan-coygo/305df6f49a939be73f165dcda8c77706 to your computer and use it in GitHub Desktop.
// configure basic information about your bot strategy
coygo.configure({
// which types of orders this strategy supports
orderTypes: [
coygo.orderTypes.market, // this indicates your strategy uses market orders
coygo.orderTypes.limit // this indicates your strategy uses limit orders
]
});
// Create configurable input values for this Strategy. On the "Configure" screen you can use
// an interface to set these to whatever you'd like. This allows you to re-use the same Strategy
// code while using different exchanges, trade pairs, etc.
const exchangeInput = coygo.input({
type: coygo.inputTypes.exchange,
label: 'The exchange to use',
description: 'The exchange that this bot will trade on.'
});
const tradePairInput = coygo.input({
type: coygo.inputTypes.tradePair,
label: 'The trade pair to use',
description: 'The trade pair that this bot will trade on.'
});
// set up a Market to interact with an exchange
const marketToUse = coygo.market({
exchange: exchangeInput,
baseSymbol: tradePairInput.baseSymbol,
quoteSymbol: tradePairInput.quoteSymbol
});
// access this trade pair's order book
const orderBook = coygo.orderBook({
market: marketToUse
});
// log the order book to the Activity Log
coygo.log('This is the order book!', orderBook);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment