Codaone / DEXBot

Trading Bot for the BitShares Decentralized Exchange
Other
247 stars 127 forks source link

External Reference Price #319

Closed MarkoPaasila closed 5 years ago

MarkoPaasila commented 5 years ago

To be available for all strategies, and taken into use with Relative Orders.

This is an alternative source of "center price", and can be used in stead of "center price from market".

I suggest the following logic. Get the price from 3 separate API's, and average the closer two, ignoring the third. This will allow one source to be bad without affecting the price. Averaging all three would let a bad API affect the price - which we don't want to happen.

We can decide the API's ourselves for now, not to make it too complicated. Maybe in the future we can let the user choose among many.

For markets for which there is no equivalent elsewhere (like PPY:MAID), we must calculate the price from the USD price of both (PPY:USD and MAID:USD).

We can probably get the properly comparable symbols by dropping the issuer prefix ("OPEN.BTC" -> "BTC"). Bitasset's internal symbols already are without any prefix (USD, EUR, GOLD, BTC, CNY)

If the user selects "External Reference Price", checkbox, then the strategy must use that instead of the get_market_center_price(). Depth field also becomes irrelevant. Auto- and manual offsets must remain in force.

thehapax commented 5 years ago

How do I assign this task to me?

MarkoPaasila commented 5 years ago

@joelvai

joelvai commented 5 years ago

@thehapax you can start working on this. It doesn't have to be assigned. When you finally make a pull request just add a reference to the text field pointing to this ticket.

thehapax commented 5 years ago

have api code for coingecko and ccxt (100 different exchanges, only using 3 majors for now). I also suggest adding Waves DEX and possibly one other backup option for consolidated quotes, similar to coingecko as a backup. @MarkoPaasila

MarkoPaasila commented 5 years ago

So ccxt doesn't contain waves api?

thehapax commented 5 years ago

Hi @MarkoPaasila. The list of exchanges provided by ccxt are listed below.

Waves is not listed. Since they are a Waves is another DEX with some volume, I would suggest adding them as option for external feeds. This way we have 1 consolidated quote system (coingecko) , 1 for selecting any single exchange (ccxt, with 100 options, mostly centralized exchages with large volume) and 1 other DEX (waves).

Let me know if you feel otherwise. If we have 3 different sources for external feeds the system will be a bit more fault tolerant in case one source happens to be down.

complete list of ccxt exchanges from https://github.com/ccxt/ccxt Supported exchanges: ('_1broker, _1btcxe, acx, allcoin, anxpro, anybits, bcex, bibox, bigone, ' 'binance, bit2c, bitbank, bitbay, bitfinex, bitfinex2, bitflyer, bitforex, ' 'bithumb, bitibu, bitkk, bitlish, bitmarket, bitmex, bitsane, bitso, ' 'bitstamp, bitstamp1, bittrex, bitz, bl3p, bleutrade, braziliex, btcalpha, ' 'btcbox, btcchina, btcexchange, btcmarkets, btctradeim, btctradeua, btcturk, ' 'btcx, buda, bxinth, ccex, cex, chbtc, chilebit, cobinhood, coinbase, ' 'coinbaseprime, coinbasepro, coincheck, coinegg, coinex, coinexchange, ' 'coinfalcon, coinfloor, coingi, coinmarketcap, coinmate, coinnest, coinone, ' 'coinsecure, coinspot, cointiger, coolcoin, crypton, cryptopia, deribit, dsx, ' 'ethfinex, exmo, exx, fcoin, flowbtc, foxbit, fybse, fybsg, gatecoin, gateio, ' 'gdax, gemini, getbtc, hadax, hitbtc, hitbtc2, huobi, huobicny, huobipro, ' 'ice3x, independentreserve, indodax, itbit, jubi, kkex, kraken, kucoin, kuna, ' 'lakebtc, lbank, liqui, liquid, livecoin, luno, lykke, mercado, mixcoins, ' 'negociecoins, nova, okcoincny, okcoinusd, okex, paymium, poloniex, qryptos, ' 'quadrigacx, quoinex, rightbtc, southxchange, surbitcoin, theocean, therock, ' 'tidebit, tidex, uex, urdubit, vaultoro, vbtc, virwox, wex, xbtce, yobit, ' 'yunbi, zaif, zb')

MarkoPaasila commented 5 years ago

Thanks. As we now have a bridge between Waves and BitShares DEX's, Waves price feed is relevant. This feature is no MVP any more at this point :-). This is a much awaited feature, and I'm looking forward to community response.

thehapax commented 5 years ago

relative orders CLI implementation is complete. GUI implementation is TBD

thehapax commented 5 years ago

@PermieBTS This issue is complete a long time ago. Joelva already completed the GUI implementation, disregard Jan 28 note. If there is a need for any further update, lets make it a separate issue. thanks