-
Notifications
You must be signed in to change notification settings - Fork 17
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
Binance updates #182
Conversation
7835c23
to
b46c992
Compare
@guilledk you should consider adding Either way imo binance is probably the more prime cex that peeps gonna want to see out of the box. |
Oh also, this needs to be rebased don't forget. |
piker/brokers/binance.py
Outdated
if signed: | ||
params['signature'] = self._get_signature(params) | ||
|
||
if action == 'get': |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
piker/brokers/binance.py
Outdated
asset_precision = self._pairs[symbol]['baseAssetPrecision'] | ||
quote_precision = self._pairs[symbol]['quoteAssetPrecision'] | ||
|
||
quantity = Decimal(quantity).quantize( |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Still
|
self._sesh.headers.update({'X-MBX-APIKEY': self.api_key}) | ||
|
||
def _get_signature(self, data: OrderedDict) -> str: | ||
if not self.api_secret: |
There was a problem hiding this comment.
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
14449dd
to
fa09688
Compare
https://binance-docs.github.io/apidocs/spot/en/#payload-balance-update | ||
""" | ||
|
||
oid = event.get('c') |
There was a problem hiding this comment.
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
Ok so in theory with that we have order cancellation & status updates, needs testing, I'll do it tomorrow. |
@guilledk this needs a rebase eh? |
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. |
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
9ff5f36
to
de87c8a
Compare
Drop Decimal quantize for now Minor tweaks to trades_dialogue proto
Replaced by the lurker sponsored #510 💥 / 🏄🏼 |
Relates to #180
Since there's more then one part.