Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arbitrage strategies dex <---> cex #504

Open
bitphage opened this issue Mar 1, 2019 · 4 comments
Open

Arbitrage strategies dex <---> cex #504

bitphage opened this issue Mar 1, 2019 · 4 comments
Labels
epic [3] Type: Enhancement [3] Type: Idea [5] Huge Task Indicates size of task. Est. more than ten hours (Recommended to split in tasks)

Comments

@bitphage
Copy link
Collaborator

bitphage commented Mar 1, 2019

To implement arbitrage strategies dexbot-wide, we need to make a common middleware (hope this is a correct term) which will serve as intermediate between strategy and particular CEX API. So we're not reimplementing strategy for every new exchange.

Strategy —-> middleware —--> bittrex / coinbase / binance / etc

@bitphage bitphage added [1] Status: Requires Discussion [3] Type: Enhancement [3] Type: Idea [5] Huge Task Indicates size of task. Est. more than ten hours (Recommended to split in tasks) epic labels Mar 1, 2019
@bitphage bitphage changed the title Arbitrage strategies Arbitrage strategies dex <---> cex Mar 1, 2019
@thehapax
Copy link
Collaborator

we can leverage some of the existing code from external feeds for the CEXs that has already been written. specifically the ccxt part and dealing with the prefix, e.g. OPEN.BTC instead of just BTC. Async has already been implemented for fetching market data.

With ccxt we can leverage the private API to handle trades directly on the CEXs. there is also a list of exchanges which are ccxt certified. https://github.com/ccxt/ccxt

For some APIs, websockets would be more efficient but not all CEXs have these; some are still REST.

@cloud-8
Copy link

cloud-8 commented Mar 20, 2019

Ah didnt know about https://github.com/ccxt/ccxt awesome !

@PermieBTS
Copy link
Collaborator

PermieBTS commented May 16, 2019

CEX-DEX Arbitrage feature specification google doc:
Using ccxt

https://docs.google.com/document/d/1-9kPRdOnbc_fd4A4lntLLJMX3rhrcOih7QYqu_FrG6I

note: some ccxt exchanges only allow trades with limit orders only and not market orders. emulating market as limit may have risks. see: https://github.com/ccxt/ccxt/wiki/Manual#exchanges
@thehapax

So limit orders can be calculated to be placed in such a way that they in-fact take orders off the book?

If there is a limit order currently on the books to sell 1btc for 100kbts, and DEXBot deems this a profitable opportunity, DEXBot can use its knowledge of the CEX orderbook to place a limit order at the exact same price as the opposite limit order alread on the book. Thus the trade will fill.

I assume the risk is in the fact that placing a limit order that matches to an existing opposing limit order is that this process takes longer to execute than placing a proper market order.
Meaning that in some scenarios DEXBot may end up having a sucessfully executed tx on the DEX, but a FAILED tx on the CEX. Therefore resulting in the arbitrage strategy failing?

@PermieBTS
Copy link
Collaborator

LIST OF CCXT SUPPORTED EXCHANGES THAT LIST BTS TRADING PAIRS AND HAVE WEBSOCKET API

CoinTiger https://coinmarketcap.com/exchanges/cointiger/
Available on ccxt? YES - Websocket
Please visit 【www.cointiger.com】-[Account] – [API control] – [create the new key] to create your own API Key.
Request Process
There are REST and Websocket two methods of Public Api Request; REST is the only method for Private Trading Api Request.

CoinTiger is of particular importance because it lists bitCNY, and arbitrage between CT and the DEX on bitCNY markets would be very helpful for the health of bitCNY, Bitshares’ flagship product.

  1. (From here on the CEX's are also ranked in order of bts volume traded)
    Lbank https://coinmarketcap.com/exchanges/lbank/
    Available on ccxt? Yes - Websocket and REST API’s
    https://github.com/LBank-exchange/lbank-official-api-docs/blob/master/README.md

ZB https://coinmarketcap.com/exchanges/zb-com/
Available on ccxt? Yes - Websocket and REST API’s
https://www.zb.com/i/developer

Poloniex https://coinmarketcap.com/exchanges/poloniex/
Available on ccxt? Yes - Websocket and HTTP API’s
https://docs.poloniex.com/#introduction
askmike/gekko#517 - simulating market orders using polo api

Gate.io https://coinmarketcap.com/exchanges/gate-io/
Available on ccxt? Yes - Websocket and REST API’s
https://www.gate.io/api2

EXX https://coinmarketcap.com/exchanges/exx/
Available on ccxt? Yes - Websocket and REST API’s
https://www.exx.com/help/websocketApi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic [3] Type: Enhancement [3] Type: Idea [5] Huge Task Indicates size of task. Est. more than ten hours (Recommended to split in tasks)
Projects
None yet
Development

No branches or pull requests

4 participants