-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Use script to generate market data for binance, karken and bitfinex and exchange function for lot sizing #1550
Conversation
…around asset prefix quirks from their API.
I submitted the same change for Kraken, as a bonus I was finally able to remove all the special handling code for newer assets. While not clearly documented in their AI, the returned API object keys actually give us the correct order book name for an asset pair queries. |
@cmroche
|
@ms121 The undefined error suggst that you might be using a binance older than 1.1.0, could you check and confirm that please? That aside, I'll look into why it tried to allow that order to go through, it clearly should have been prevented due to the lot size. |
@ms121 Should be fixed now. |
@cmroche Sorry for another newb question, but what is the easiest way to download all the changed files in the "files changed" section, or otherwise update my gekko installation with these latest code changes? I've been copying and pasting the text, but I'm thinking there has to be a better way. Thanks! |
@jessrbird You cannot really download just the changed files, the easiest way to test a PR is to checkout or download the branch it is based on. In this case that would be here: https://github.com/cmroche/gekko/tree/origin/product_updates If you are using GitKraken as your GIT client, it does have the ability to grab and apply PRs in the client. You would need to handle conflicts yourself, but should be minimal if you are based on the 'develop' branch. I am not an expert with GitKraken though, so I cannot offer much help with this. |
I pulled this commit and ran the updateBinance.js script, the markets file looks correct. When running it on actual trading I get the error:
|
@werkkrew Please update your binance module with |
@werkkrew The error that you are seeing, that the amount was too small, is correct if the amount it is requesting is too small for the market LOT size. I've made some small changes though, changing the error to a warning and printing the original requested amount and price (not the adjusted) just in case the lot size calculation was wrong. If you update try again and let me know if the requested amount was actually larger than the minimum lot sizes. |
@cmroche I downloaded the zip using the link you provided above to get the latest PR. Getting an error running tradebot at binance USDT/BCC pair. The bot tried to sell BCC, but BCC balance was already 0. Here is the error: /home/money/gekko/plugins/trader/portfolioManager.js:236 TypeError: log.warning is not a function Let me know what you think. |
@jessrbird Bah, should be log.warn sorry.. will send a fix in a few minutes |
@cmroche apologies for the delays on this PR, it escaped my attention completely. First note: I love this approach! I think it is important that Gekko only supports currencies whatever we release, and this way we stay in total control between release cycles. Some quick questions/notes:
Is this function required? Eg. will merging this break every other exchange (that does not have this implemented)? If so: I can work on making this optional.
For me personally it would be a lot more clear to call this file
What do you think about moving this to a util folder that can generate whatever is necessary (which for now means only market files). |
The function is option though. portfolioManager checks is the function exists, if it does then it uses the provided function, if not it falls back to the old behaviour. Documentation is updated to indicate that it is optional as well. Changing to JSON is not a problem, I considered this but went with JS to be consistent with the config files. It makes sense to use JSON though, and putting them in another folder is no problem at all. |
perfect! testing this now, if it all seems to work and I will manually fix what I like to see different :) |
…ko into cmroche-origin/product_updates
works great! If you can merge this: https://github.com/cmroche/gekko/pull/3 I'll merge this PR :) |
minor file tweaks
@askmike Thanks :) Done. |
Seems I didn't commit everything, note that this is commit is needed now: 8bf4670 |
@cmroche or anyone that can shed some light on this... What i want to achieve is place a buy order, at market price would be nice, with the BTC amount available. Then when conditions are meet, place a sell order with the bought currency amount available. Can someone help out? |
hello has the fix been merged? i am still getting the MIN_NOTIONAL error even after updating the dev branch. should I open a new issue? thanks |
Feature
Product entries are done by hand, for exchanges with many assets this is tedious and prone to human error.
getMinimumSize on portfolioManager doesn't handle Binance's lot size requirements correctly result in occasional errors when posting small orders.
Binance market data is now moved to a second .js file, which is updateable with a script. The script parses the product definitions for all available pairs and adds them to the product list with all necessary information.
Added the function getLotSize to the exchange and updated portfolioManager to check for this function and use it is available for computing the correct lot size of an order. General rules are that if we are blow the minimum, we don't trade. This will allow any exchange to define necessary behaviour for lot sizing to that specific exchange.
If we are happy with this approach for managing market data I'll apply the change to Kraken and Bitfinex as well.