piker icon indicating copy to clipboard operation
piker copied to clipboard

Binancial secs: futes for the peepz!

Open goodboy opened this issue 2 years ago • 1 comments

Replacement for #182 keeping as much of the work from @guilledk as possible!

This is the first proto which will begin to complete the tasks listed in #519 🏄🏼

More then likely I am going to rebase this onto #486 as well since I'm somewhat hoping that lands before this onto mainline.

ping @ebisu4


To defer to new issues/PRs

  • [x] Created #524 as follow up for all the content that was here :surfer:

To CHERRY from downstream PRs that relate to this

  • [ ] 2efc34af: drop config get/set/del api stuff from legacy PR
  • [ ] 674f99a3: symcache methods and derivative qualified asset keys
  • [ ] 416dbc93: use .get_assets() in .get_mkt_info()
  • [ ] 82fd7856: make default binance section in config use paper engine and disable testnets.

ToDo Summary:

  • [x] adds first proto support for futures testnet endpoints, rest API and drafted functionality to support live order control via our EMS:

    _url = 'https://api.binance.com'
    _sapi_url = 'https://api.binance.com'
    _fapi_url = 'https://testnet.binancefuture.com'
    
    • thanks @guilledk for all that work from 2 years ago 😂
  • general cleanups / factoring in the API client

    • [x] don't think we need separate ._api, ._sapi, ._fapi right? simply do the right endpoints parent call implicitly based on venue selection?
      • factored and simplified in 24ef09a7
  • [x] futures live data feeds via ws api as per requirements in #519

    • [x] paper engine trading using these feeds alongside spot feeds
  • [x] ideally basic limit order control through emsd with accompanying tests

    • [x] live limits submission and group cancellation

      • daa1895..e54efb9
      • [x] drop OrderedDict usage? pretty sure with modern python we don't need it any more
    • [x] dynamic swap to testnet user stream based on brokers.toml config binance.futes.use_testnet: bool

      • ~currently it's hardcoded..~
      • cdeee8d2, fbc15b96 (more or less XD)
    • [x] clearing processing with position update passthrough

      • easy enough just remapping the binance status set to our EMS set :surfer:
      • [x] for now just relay the position values given directly from binance via 'ACCOUNT_UPDATE' events from the user stream (also see another bullet below.)
        • 021c00b
    • [x] live order edit support

      • supported via 86c6e683
    • [x] position tracking?

      • can we defer this to a follow up?
      • [x] tracking via binance's native calcs: https://binance-docs.github.io/apidocs/futures/en/#event-balance-and-position-update
    • [x] full dark order support

      • currently there's a precision bug (seemingly) on trigger where rounding isn't matched to binance's engine limit?
        • fixed in 6ce7cb15 :facepalm:
    • [x] existing live order loading

      • 0705b8e4, d679f2a1
      • [x] load instead using trade endpoint https://binance-docs.github.io/apidocs/futures/en/#current-all-open-orders-user_data

goodboy avatar Jun 09 '23 19:06 goodboy

Just adding a skip on the marketstore docker test and then CI should run clean as well 🏄🏼

goodboy avatar Jun 20 '23 22:06 goodboy