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

Binance updates #182

Closed
wants to merge 7 commits into from
Closed

Binance updates #182

wants to merge 7 commits into from

Conversation

guilledk
Copy link
Contributor

@guilledk guilledk commented May 24, 2021

Relates to #180

Since there's more then one part.

@guilledk guilledk force-pushed the binance_todos branch 2 times, most recently from 7835c23 to b46c992 Compare May 26, 2021 21:14
@goodboy
Copy link
Contributor

goodboy commented Jun 1, 2021

@guilledk you should consider adding -b binance to our example chart cmd too and maybe add a little section on how to search for multiple symbols?

Either way imo binance is probably the more prime cex that peeps gonna want to see out of the box.

@goodboy
Copy link
Contributor

goodboy commented Jun 1, 2021

Oh also, this needs to be rebased don't forget.

if signed:
params['signature'] = self._get_signature(params)

if action == 'get':
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@goodboy Here is a part I'm not confident in, you think I should just make separate methods for get / post or this is fine?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm good question.
This seems fine I think?

you could maybe even just proxy the method direct to asks -> getattr(self._sesh, method) ?

Not sure if that's too "dynamic" or wtv.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah love that option, always forget about getattr

asset_precision = self._pairs[symbol]['baseAssetPrecision']
quote_precision = self._pairs[symbol]['quoteAssetPrecision']

quantity = Decimal(quantity).quantize(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to sanitize price/quantity because binance has specific per-symbol requirements on precision.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this is also going to play in with new $positioning features where a user can specify the base pair for the position size; which fits naturally with crypto / forex, less so with discrete instruments like stocks / most derivatives.

@guilledk
Copy link
Contributor Author

Still TODO:

  • Order status updates
  • Order cancel

self._sesh.headers.update({'X-MBX-APIKEY': self.api_key})

def _get_signature(self, data: OrderedDict) -> str:
if not self.api_secret:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably add some more comments liking to docs about the signing of requests

@guilledk guilledk force-pushed the binance_todos branch 2 times, most recently from 14449dd to fa09688 Compare June 22, 2021 15:47
https://binance-docs.github.io/apidocs/spot/en/#payload-balance-update
"""

oid = event.get('c')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll write a pydantic model for all this later

@guilledk
Copy link
Contributor Author

guilledk commented Jul 1, 2021

Ok so in theory with that we have order cancellation & status updates, needs testing, I'll do it tomorrow.

@goodboy
Copy link
Contributor

goodboy commented Jul 21, 2021

@guilledk this needs a rebase eh?

@guilledk
Copy link
Contributor Author

Yeah, I'm catching up with $dayjob, so will not be able to continue this for a bit, this should be almost done pretty sure.

Guillermo Rodriguez added 6 commits February 19, 2022 17:29
Add minimal order support for binance
Add goodboy suggestion to avoid repetition in binance `_api` method
Add submit_cancel & listen key managment to binance backend
Drop Decimal quantize for now
Minor tweaks to trades_dialogue proto
@guilledk guilledk changed the title Taking Binance API to the next level Binance updates Mar 10, 2023
@goodboy goodboy mentioned this pull request Jun 9, 2023
21 tasks
@goodboy
Copy link
Contributor

goodboy commented Jun 9, 2023

Replaced by the lurker sponsored #510 💥 / 🏄🏼

@goodboy goodboy closed this Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants