-
-
Notifications
You must be signed in to change notification settings - Fork 270
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
llegal characters found in parameter 'price' #221
Comments
Hi @olafkotur I wrote the My library doesn't do any formatting for this, it just passes on the values you've provided. The only validation would be through types and interfaces, but that's build time only. That also means you could test your theory about passing |
Hey @tiagosiebler, I did some more testing with what you mentioned. Works like a charm - Binance API accepts In this particular case since the number is so small I had to use an additional library to be able to accurately control the formatting of the number i.e. Out of curiosity I also tested this for the export interface NewSpotOrderParams {
symbol: string;
side: OrderSide;
type: OrderType;
timeInForce?: OrderTimeInForce;
quantity?: number | string;
quoteOrderQty?: number;
price?: number | string;
newClientOrderId?: string;
stopPrice?: number;
icebergQty?: number;
newOrderRespType?: OrderResponseType;
isIsolated?: StringBoolean;
sideEffectType?: SideEffects;
} Thanks for the help, really appreciate it! ❤️ I'm gonna try my best to open a PR for this in the next couple of days 🙏🏽 |
Nice, this is really useful! Would love to see a PR to update the types based on your finding. Maybe you can include a link to your post here, as a comment on NewSpotOrderParams (since it won't be obvious why it supports a string while docs say number). |
With reference to
MainClient.submitNewOrder
, I'm getting the following response from Binance:Illegal characters found in parameter 'price'; legal range is '^([0-9]{1,20})(\.[0-9]{1,20})?$'.
This only seems a problem with a 2 assets that I'm trading, out of 230. both with a very small number as a price
5.8e-7
- I saw a few posts on some other libs saying that binance expects this to be astring
. I've had a look atNewSpotOrderParams
interface but this only accepts a number.I'm sending this as a number, so
5.8e-7 === 0.00000058
, initially I thought it was some dodgy conversion on my side converting to string including the scientific notation, but unfortunately this isn't the case.Is there any additional formatting done inside the lib to convert that number to a string before its sent to Binance?
Been stuck on this for some time so any help or pointers would be greatly appreciated.
The text was updated successfully, but these errors were encountered: