butor / blackbird

Blackbird Bitcoin Arbitrage: a long/short market-neutral strategy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bitstamp - Error with response: {"amount": ["Ensure that there are no more than 8 decimal places."]

arthurolara opened this issue · comments

Bitstamp/Bitfinex: 0.11% [target 0.10%, min -0.01%, max 0.17%] trailing 0.15% 1/1
Looking for a limit price to fill 0.000463 BTC...
order book: 1.000000@$53946.66
Looking for a limit price to fill 0.000463 BTC...
order book: 16.309057@$54005.00

[ ENTRY FOUND ]
Date & Time: 03/09/2021 11:46:09
Exchange Long: Bitstamp (id 1)
Exchange Short: Bitfinex (id 0)
Fees: 0.25% / 0.20%
Price Long: 53946.66 (target)
Price Short: 54005.00 (target)
Spread: 0.11%
Cash used: 25.00 on each exchange
Exit Target: -1.09%

Trying to send a "buy" limit order: 0.000463@$53946.66...
Error with response: {"amount": ["Ensure that there are no more than 8 decimal places."], "all": [""]}
Order ID = 0. Message: {"error": {"amount": ["Ensure that there are no more than 8 decimal places."], "all": [""]}}
Done (order ID: 0)

Trying to send a "sell" limit order: 0.000463@$54005.00...
Done (order ID: 60247103292)

Need help please

I have the same problem... @arthurolara have you found any solution?

[ 03/24/2021 10:09:00 ]
Bitfinex: 56,476.00 / 56,477.00
Bitstamp: 58,507.93 / 55,284.88
Kraken: 56,402.40 / 56,402.50

Bitstamp/Bitfinex: 2.15% [target 0.80%, min -0.24%, max 3.42%] trailing 3.34% 1/1
Looking for a limit price to fill 0.000452 BTC...
order book: 0.002764@$55,284.88
Looking for a limit price to fill 0.000443 BTC...
order book: 0.427652@$56,476.00

[ ENTRY FOUND ]
Date & Time: 03/24/2021 10:09:00
Exchange Long: Bitstamp (id 1)
Exchange Short: Bitfinex (id 0)
Fees: 0.25% / 0.20%
Price Long: 55,284.88 (target)
Price Short: 56,476.00 (target)
Spread: 2.15%
Cash used: 25.00 on each exchange
Exit Target: 0.85%

Trying to send a "buy" limit order: 0.000452@$55,284.88...
Error with response: {"amount": ["Ensure that there are no more than 8 decimal places."], "all": [""]}
Order ID = 0. Message: {"error": {"amount": ["Ensure that there are no more than 8 decimal places."], "all": [""]}}
Done (order ID: 0)

Trying to send a "sell" limit order: 0.000443@$56,476.00...
Done (order ID: 61110089508)

Waiting for the two orders to be filled...
Done

WARNING: 2 second(s) too late at 03/24/2021 10:09:03

Ok, diving into the code I see this in bitstamp.cpp : sendLongOrder

Amount take quantity, and quantity is a double
oss << "amount=" << quantity << "&price=" << std::fixed << std::setprecision(2) << price;

I belive that the value of quantity have more then 8 decimal (is a bouble...)

On the output "Trying to send a "buy" limit order: 0.000452@$55,284.88..." the value of quantity 0.000452 is truncated by function setprecision(6).

*params.logFile << " Trying to send a "" << direction << "" limit order: "
<< std::setprecision(6) << quantity << "@$"
<< std::setprecision(2) << price << "...\n";

I need to test if it is true.