piker icon indicating copy to clipboard operation
piker copied to clipboard

Binance orders

Open goodboy opened this issue 4 years ago • 0 comments

Now that #190 is ready to land (once y'all glance at it) we've got a much more explicit api for supporting order management and thus live trading.

The big crypto boi in town is of course the new binance backend and, from a glance at their api it should be mostly a cinch to implement.

This needs a readme / write up (coming soon) but the basic gist is this:

  • each backend module needs to define @tractor.context (yes the new bidir streaming api) endpoint named trades_dialogue() which sets up a 2 way stream for both accepting order requests from the EMS (execution management system, or "clearing system" which runs in the emsd sub-daemon) and delivering user account trade events back from binance to the ems. Examples of this endpoint include:
  • binance has 2 main sets of endpoints that are likely to be needed to get support going:

The crash course on the 2 sets of message types:

  • piker client dialogue msgs are in the set of Cancel, Order, and Status these are purely piker related client <-> emsd messages that provide a uniform/simpler layer for abstracting across ems services
  • emsd <-> brokerd dialogues (which take place with the trades_dialogue() mentioned above) are the messages in this set which include a few extra messages for order request acks, positions, individual fills, and errors. For now as long as we stick to the pydantic fields everything should just work; if we need to modify / extend the messages that's also just fine 😎.

Hopefully this is enough to get going 😂

goodboy avatar Jun 09 '21 11:06 goodboy