GithubHelp home page GithubHelp logo

Comments (12)

zoeyg avatar zoeyg commented on May 22, 2024

This is not the place to be asking this kind of question. These issues are for problems with the library or potential enhancements to it, not a support line for javascript or the binance API.

However, without someone knowing more specifics about your question it's going to be hard to answer it as is. What's the specific error you're getting, and what's your current code look like? What have you tried that's not working and how have you tried to troubleshoot it? You should try looking through the official docs for answers, or maybe try searching through or asking a question on stackoverflow. Maybe this is what you're looking for https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round?

from binance.

zoeyg avatar zoeyg commented on May 22, 2024

I've decided I'm going to repurpose your issue and use it to track an enhancement to the library. That is, adding examples for each library method. It would be nice if each example could also be run individually for testing various routes during development.

from binance.

talvasconcelos avatar talvasconcelos commented on May 22, 2024

Thanks, sorry for the question. Anyway i managed to solve it by copying zenbot's solution.

function roundToNearest(numToRound) {
    let numToRoundTo = minQty // value from the exchange filters
    numToRoundTo = 1 / (numToRoundTo)
    return Math.floor(numToRound * numToRoundTo) / numToRoundTo
  }

from binance.

zoeyg avatar zoeyg commented on May 22, 2024

@talvasconcelos Would you mind sharing the rest of your code? Perhaps I could use it as an example for others

from binance.

talvasconcelos avatar talvasconcelos commented on May 22, 2024

@aarongarvey i can give some help with that if you need. I'm building (or at least trying) a scanner for Binance.

Edit: oops you're too fast... i don't haven't on git yet, as i'm doing a trader to go with it also... but i can share a gist with some methods i've used so far. Is that ok? Can i post them in raw and you edit to your liking?

from binance.

zoeyg avatar zoeyg commented on May 22, 2024

Works for me, and thanks!

from binance.

talvasconcelos avatar talvasconcelos commented on May 22, 2024

@aarongarvey here's a small gist with some examples... it's a bit messy, if you have any troubles please contact me. But i guess you can easilly adapt from there.

https://gist.github.com/talvasconcelos/4fdb25f51ea34ad457ddcbb60156b330

from binance.

talvasconcelos avatar talvasconcelos commented on May 22, 2024

Had to add this for MIN_NOTONIAL filter for orders to go through:

function getOrderMinSize(currency) {
    if (currency === 'BTC') return 0.002
    else if (currency === 'ETH') return 0.02
    else return 1
  }

Hope this can help you @aarongarvey if you need i can make some dummy examples!

from binance.

zoeyg avatar zoeyg commented on May 22, 2024

Thanks for the code. I think I've decided on what is probably the best way to approach this, and that's an examples directory with individual files that each show a common task or route, and even better if the file is executable on it's own. If you've got the time and wanna create some, by all means, go for it.

from binance.

apexearth avatar apexearth commented on May 22, 2024

Somewhat on topic -- I've written a function in my own project that processes the lot size, min notional, and step size filters and returns a modified quantity and price which should fit within the filter requirements. I'm thinking of porting it into my fork of this binance repository. Since everyone who does some math on quantities and prices is going to have to do this work, I think it would be appropriate to have something inside of this package.

from binance.

apexearth avatar apexearth commented on May 22, 2024

Example: apexearth@59d7fe5

from binance.

zoeyg avatar zoeyg commented on May 22, 2024

@apexearth Took a quick look at the code and it looks great. I think having an example in the readme would be good as well. Then if you wanna create a pull request, go for it and I'll merge it back into master.

from binance.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.