askmike / gekko

A bitcoin trading bot written in node - https://gekko.wizb.it/
MIT License
10.07k stars 3.95k forks source link

Enabling additional coins + intercoin analysis? #963

Closed CyborgDroid closed 7 years ago

CyborgDroid commented 7 years ago

Hi. This is a great trading app! Thanks for making it available open source.

I wanted to know if it is possible to add the coins that are currently on Bitstamp, LTC and XRP, with all the possible trading combinations on the exchange.

Also, could you provide a general explanation of how I could design a script that would analyze multiple pairs of currencies to compare the best ones to be trading at a given time? So if BTC is going down but LTC is going up, sell btc and buy LTC, then if LTC is going down but ETH is going up faster than BTC, sell LTC and buy ETH.

Sometimes there are imbalances in the trading routes, so in the example above, going from BTC to LTC might be better if I trade straight from BTC to LTC or BTC-USD-LTC. I am good with logic programming in general but no idea how to pull the current values from the market or from the different indicators running.

Thank you.

askmike commented 7 years ago

Hey! Adding coins is not too hard, see here for details: https://gekko.wizb.it/docs/extending/add_an_exchange.html#Capabilities

If you want to add it to Gekko you only have to adjust this file: https://github.com/askmike/gekko/blob/stable/exchanges/bitstamp.js#L220

and send a pull request :)


Sometimes there are imbalances in the trading routes, so in the example above, going from BTC to LTC might be better if I trade straight from BTC to LTC or BTC-USD-LTC.

This is order routing and is a very similar to triangular arbitrage, unfortunately this problem requires a vastly different solution than what Gekko can do, this is unfortunately out of scope for this project.

Also, could you provide a general explanation of how I could design a script that would analyze multiple pairs of currencies to compare the best ones to be trading at a given time? So if BTC is going down but LTC is going up, sell btc and buy LTC, then if LTC is going down but ETH is going up faster than BTC, sell LTC and buy ETH.

You cannot do this with Gekko: Gekko is designed as a "starterskit" for automated trading. In order to make it very easy (have an easy webinterface with some charts) without requiring a lot of coding we had to limit the scope. If you want to do this you can use gekko (or budfox, see #896) to sync realtime trade data in a database (of as many markets as you want) and process the market data yourself.

CyborgDroid commented 7 years ago

Thanks for the quick response Mike!

CyborgDroid commented 7 years ago

I tried adding currencies. It looked very straightforward, but when I restated gekko now gekko doesn't work. Did I mess this up?

Trader.getCapabilities = function () { return { name: 'Bitstamp', slug: 'bitstamp', currencies: ['USD', 'EUR', 'BTC'], assets: ['BTC', 'EUR', 'XRP','ETH','LTC'], maxTradesAge: 60, maxHistoryFetch: null, markets: [ { pair: ['USD', 'BTC'], minimalOrder: { amount: 5, unit: 'currency' } }, { pair: ['USD', 'ETH'], minimalOrder: { amount: 5, unit: 'currency' } }, { pair: ['EUR', 'BTC'], minimalOrder: { amount: 5, unit: 'currency' } }, { pair: ['USD', 'EUR'], minimalOrder: { amount: 5, unit: 'currency' } }, { pair: ['USD', 'XRP'], minimalOrder: { amount: 5, unit: 'currency' } }, { pair: ['USD', 'LTC'], minimalOrder: { amount: 5, unit: 'currency' } }, { pair: ['EUR', 'XRP'], minimalOrder: { amount: 5, unit: 'currency' } }, { pair: ['BTC', 'XRP'], minimalOrder: { amount: 5, unit: 'currency' } }, { pair: ['EUR', 'ETH'], minimalOrder: { amount: 5, unit: 'currency' } }, { pair: ['BTC', 'ETH'], minimalOrder: { amount: 5, unit: 'currency' } }, { pair: ['EUR', 'LTC'], minimalOrder: { amount: 5, unit: 'currency' } }, { pair: ['BTC', 'LTC'], minimalOrder: { amount: 5, unit: 'currency' } } ], requires: ['key', 'secret', 'username'], fetchTimespan: 60, tid: 'tid', tradable: true }; }