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

Invalid value error #47

Open
MrBlindMouse opened this issue Oct 28, 2022 · 15 comments
Open

Invalid value error #47

MrBlindMouse opened this issue Oct 28, 2022 · 15 comments

Comments

@MrBlindMouse
Copy link

Hi Guys,
While trying to post a market order using the following,
cl.post_market_order(min_name, 'BUY', base_account_id=buy_id, counter_volume=float(truncate(buy_val,buy_scale)), counter_account_id=btc_id)
I get the error:
('ErrInvalidValue', 'Invalid value provided for counter_volume')

I'm buying on the pair 'ADAXBT'

The value is above the indicated min value and truncated to the indicated precision as per: https://api.luno.com/api/exchange/1/markets

I have no idea what could be wrong.

Help please!!!

Kind Regards
MrBlindMouse

@MrBlindMouse
Copy link
Author

Hi,
I need some help here!

After some testing a bit it looks like this only happens with the ADAXBT trading pair when 'BUY'ing with the post_market_order() function as stated above.

I've tried with the 'SOLXBT' and 'XRPXBT' pairs as well and they seem to worked fine.

@sanari1
Copy link

sanari1 commented Nov 24, 2022

Hi MrBlindMouse

just out of curiosity what is the value of float(truncate(buy_val,buy_scale) if you had to print it out?
is it above the minimum volume amount?

@MrBlindMouse
Copy link
Author

Hi Sanari,
Thanx for responding.
The float value in that case was 0.0000897. I do not have the ADAXBT price from then but if I had to uses the current price the total volume would be 4.7.

The minimum volume for the ADAXBT trading pair is 1.0

@sanari1
Copy link

sanari1 commented Nov 24, 2022

Are you trying to buy ADA or XBT? I'm a novice but will try and help

@MrBlindMouse
Copy link
Author

It's a buy function, so XBT

@MrBlindMouse
Copy link
Author

Sorry, misstyped. Buying ADA, with XBT as the counter volume

@sanari1
Copy link

sanari1 commented Nov 24, 2022

Have you tried rounding down the volume from say 4.701 to 4.70 as an example

Thats the issue I had
https://github.com/luno/luno-python/issues/35

@MrBlindMouse
Copy link
Author

Yes, that is what the truncate function does. ADA needs to be trunced to 1 decimal and XBT to 8? I believe but the docs does not say what the counter_value needs to be scaled to

@sanari1
Copy link

sanari1 commented Nov 24, 2022

would it not be min_price : 0.000001 and the number can't be higher than max_price : 0.01
so 0.00000x?

@MrBlindMouse
Copy link
Author

I thought so as well, but I now believe those are the limits for the actual price, ie 1 ADA sells for 0.0000188 XBT at the moment. So when the market crashes or explodes then trading is forced close.

And even if they are really the counter_volume limits, the value I used falls within that range

@sanari1
Copy link

sanari1 commented Nov 24, 2022

are you sure truncate function is rounding down and not up ie 0.018 becomes 0.02 when it needs to become 0.01

@MrBlindMouse
Copy link
Author

Yes, thats what truncate does. It cuts the decimal instead of rounding up or down. Python will sometimes give strange results when trying to round.

@sanari1
Copy link

sanari1 commented Nov 24, 2022

I will try when I get home this evening buying and see if I have any issues

@sanari1
Copy link

sanari1 commented Nov 24, 2022

Having the same issue on my side... suspect something hasn't been implemented yet.

@echarrod
Copy link
Contributor

echarrod commented Aug 8, 2024

Hi both 👋 Sincere apologies that no-one from Luno got back to you on this one.
I know it's been a while, but are you still experiencing the same issue?

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

No branches or pull requests

3 participants