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

Need an extra decimal point #971

Closed
asfbhero opened this issue Jul 30, 2019 · 16 comments
Closed

Need an extra decimal point #971

asfbhero opened this issue Jul 30, 2019 · 16 comments

Comments

@asfbhero
Copy link

image
I think the fair value is getting rounded up. should be 0.000006355

@asfbhero
Copy link
Author

Looks like bitmex provides support for getting bots to work with their API, the link to their support is here, https://www.bitmex.com/app/automatedTradingEngines

@ctubio
Copy link
Owner

ctubio commented Jul 30, 2019

that is not support, that is language-specific implementations (that they published instead of properly documenting the meaning of each attribute)

i have seen useless documentation pages, but https://www.bitmex.com/app/wsAPI is the most useless one; just listing channel names

@ctubio
Copy link
Owner

ctubio commented Jul 30, 2019

about the rounding decimals, these are the same as the displayed decimals, so for TBP the rounding is of 8 decimals; cannot have moar

@asfbhero
Copy link
Author

Is there any way we can get the Fair Value to be in between the bid and the ask, instead of setting FV at the ask?

@ctubio
Copy link
Owner

ctubio commented Aug 4, 2019

umm let me investigate this situation of the fair value

@ctubio
Copy link
Owner

ctubio commented Aug 4, 2019

here you have exemplified the issue http://cpp.sh/3ppc6

happens at:

fairValue = (asks.cbegin()->price
+ bids.cbegin()->price) / 2;

and can be set to match the bid value if instear of round() you call floor() at:

fairValue = K.gateway->decimal.price.round(fairValue);

recompile and enjoy!

@asfbhero
Copy link
Author

asfbhero commented Aug 4, 2019

I'm a bit new to compiling things in linux, I tried just editing the source file then running make, but it seems to not make any sort of difference. I'm sure I'm doing something wrong.
image

@ctubio
Copy link
Owner

ctubio commented Aug 4, 2019

before make works, you need to build the distributed dependencies, that is make dist

once you have the dependencies, no need to run make dist anymore unless you remove them manually with rm -rf build-*

@ctubio
Copy link
Owner

ctubio commented Aug 4, 2019

@asfbhero
Copy link
Author

asfbhero commented Aug 5, 2019

Thanks, not sure if this change is doing exactly what I want, but now that I know where to look and hot to get it to compile I can play with the math a bit mroe and see what I can come up with.

Thanks again!

@Camille92
Copy link
Contributor

Yes, stream precision needs to be 9 instead of 8 in that particular example.

Yes, the general stream precision for this pair should be 8 (for minimal increment etc), however, FV needs to be in between the two values at 0.000006355.

Hope it helps,
Camille

@ctubio
Copy link
Owner

ctubio commented Aug 7, 2019

i would say there is no need to limit precision (most of the time while doing calculations)

precision only needs to be limiterd to 8 when displaying values to the final user

@asfbhero
Copy link
Author

asfbhero commented Aug 8, 2019

Is this value hard coded somewhere, I can find the variable, but I don't see where it's pulling it's value from.

@ctubio
Copy link
Owner

ctubio commented Aug 8, 2019

🐨 i think you are looking for:

decimal.funds.precision(1e-8);
decimal.price.precision(tickPrice);
decimal.amount.precision(tickSize);
decimal.percent.precision(1e-2);

^this sets the precision for each type of decimals

fairvalue uses price type:

fairValue = K.gateway->decimal.price.round(fairValue);

@asfbhero
Copy link
Author

asfbhero commented Aug 8, 2019

Perfect! Thanks!
Now I can start trying to shoehorn KAMA into EWMAPrice. That should allow profitable trading on more volatile, and also more liquid pairs like XBT/USD.

@ctubio
Copy link
Owner

ctubio commented Aug 13, 2019

hope for this issue to be fixed at #984

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants