fluidex/dingir-exchange

gateway: sign and relay orders

lispc opened this issue · 1 comments

lispc commented

background

we may need to develop an exchange gateway to maker bots to integrate.

The rollup exchange is more complex than normal CEXs. eg nonce, eddsa signature.

The trading bots may include python/js/java/c++, it is unrealistic to implement to same logic ( encoding & sign ) in every language. So a rust gateway may be helpful.

The gateway is run by a trading team, the gateway can access their l2 seckey. Bots send raw orders to the gateway, gateway service fetchs nonce & order_id & order_pos and signs the order, and then send the signed order to the real FluiDex server.

TODO

  1. copy and modify client.ts into a grpc server process, which expose one grpc endpoint signOrder. signOrder shares most codes with createOrder function. input: order details, output: signature
  2. add a python client, which uses the js grpc signer to get order signature, then sends signed orders to the exchange
lispc commented

APIs of the gateway:

here is an example of APIs ( ccxt / freqtrade) : https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/exchange/exchange.py