Skip to content

binance live (futures) trading support #519

@goodboy

Description

@goodboy

Somewhat monumental, this is our first lurker sponsored feature
request and task set :party:

Feat summary

As part of utilizing piker in a real-time event driven crypto
trading strategy (using news.treeofalpha.com) we have a request to
add live trading support in for the binance broker backend, first
for their futures market and later as well for spot markets.

There actually was work done almost 2 years ago by @guilledk in
#182 which was never brought to
full completion and testing, but a lot of the initial API
integration work was prototyped to a MVP.

Obviously a lot has changed in many subsystems since then so
there will be some adjustments needed after rebase to latest main
branch.

Required base functionality:



  • live position tracking
    • Function for getting the current balance

    • It can be either data from P2 or run in a separate thread and fetched
      from the exchange after every open/close position event.

    • IOW, balance tracking which, again, we're more or less
      already doing in piker.accounting and friends 🏄
    • Function to get price percentage change from P1

      • IOW, realtime pnl tracking and display, again we have in
        piker.accounting and friends 🏄

This requirements section is the future nice to have / end goal
requirements and will likely require more coordination for testing
and design with the lurker sponsor 😉

  • real-time ticker/symbol/market name parsing and dynamic search,
    load, and cache of real-time data feeds from first section above.
    • For each symbol received from news.treeofalpha.com, immediately send
      the symbol so the code can prepare (i.e., get the price before the
      news from P1 to calculate price percentage change).


binance resources:


Detailed impl TODO:

much more to come.. !


testing TODO:

  • tests for round trip latency of live limit submissions
  • stop loss via dark orders
  • stop loss via binance API submission
  • connectivity resilience under network outage(s)
    • particularly dumping a pp if/when network returns

(maybe) much more to come here!

Metadata

Metadata

Assignees

Labels

accountingprolly positioning: the accounting of "what/when (is) owned"broker-backend`brokerd`/`datad` related backend techbrokers-can-smbzfeatures that suits should provideclearingauction and mm tech: EMS, OMS, algo-tradingconfigdata-layerreal-time and historical data processing and storagefeature-requestNew feature or requestlurker_sponsoredPaid (or traded) for by your local anon fanbois

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions