The resource loading... loading...

High frequency trading problems

Author: lzhqlj, Created: 2022-07-11 21:43:31, Updated:

The code in the forums, seeing that now Bitcoin has zero transaction fees, I want to run a test.

2022-07-11 21:40:41 Information The amount of bitcoins that can be sold 0 2022-07-11 21:40:41 Information for sale at the price of 20481.24 2022-07-11 21:40:41 Information The amount of bitcoins that can be purchased -0.09 2022-07-11 21:40:41 Information Purchase price is 20461.24

var amountBuy = _N((account.Balance / buyPrice-0.1),2);

account.Balance=11.47336 buyPrice=20461.24 This is the price of the account. Why is amountBuy = -0.9? Thank you.


More

lzhqljSheesh, it was actually a parenthesis that was missing in the calculation.

Inventors quantify - small dreamsPrint out the calculation values for each step and analyze them to find out why. Also, the message you sent in your log is -0.09 instead of -0.9. account.Balance / buyPrice-0.1 is calculated with only two decimal places left, so -0.09 is not a problem.