‘Invalid UTF-8 code encountered.’ close reason with QWebSocket

I get close reason: ‘Invalid UTF-8 code encountered.’ (code=1007) with QWebSocket in the following scenario:

  • I connect to Binance stream wss://stream.binance.com:9443/stream with QWebSocket::open.
  • Successfully receive messages for some time period (a few hours).
  • Binance disconnects me when its servers load increases (because I have low-priority API) and I get close reason code=1000 that indicates a normal closure.
  • Try to reconnect multiple times by calling QWebSocket::open again, but Binance closes the connection with close reason ‘Invalid UTF-8 code encountered.’ (code=1007) that indicates that an endpoint is terminating the connection because it has received data within a message that was not consistent with the type of the message (e.g., non-UTF-8 [RFC3629] data within a text message).
  • Restart the application manually and connect successfully.

The difficulty of reproducing the bug is that Binance disconnects me rarely (once a day, for example) and experimentation with disconnecting the network cable from my machine does not have this effect, after I connect the cable back, QWebSocker reconnects successfully. When I disconnect the network cable I get Error: ‘Unknown error’ (code=-1), Close reason: ” (code=1000).

(more…)

My first trade with my simple Binance bot

It calculates the difference between 2.5 hour moving average (MA) and the current price, when the difference exceeds the threshold it buys:

(more…)

Array subscript -N is outside array bounds warning in GCC11

Consider the code below with UB:

template <class Derived>
class A
{
public:

    Derived * get() { return static_cast<Derived *>(this);}

private:

    int m_a;
};

class B
{
public:

    double m_b;
};

class X : public B, public A<X>
{
public:

    int m_x;
};

int main()
{
    A<X> a;
    std::cout << a.get();
    return 0;
}
(more…)

Disabling power button on Windows 10

When you mistakenly press power button your Windows 10 machine surprisingly shuts down. Switch it off with the following steps:

(more…)

Compiling Awl on Ubuntu 18 and 20 with GCC 11

Below I provided the instruction on how to build Awl on Ubuntu 18 and 20.

On Ubuntu 18 you do an extra step to install CMake version >= 3.12:

wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add -
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
sudo apt update

Then do the following steps on both Ubuntu 18 and 20:

sudo apt install cmake
cmake --version
(more…)

Earned 50$ with some unknown coins on Binance

Coins FIS, BADGER and TORN did 3x, 2x and 2x respectively and I earned 50$ with my trading bot:

(more…)

Multi-Processor in Visual Studio

It is /MP:

(more…)

Investigating how to find the candles on a price chart

The basic idea is to calculate the difference with 10 minutes (600 seconds) moving and the current price, for example.

ASR/USDT:

(more…)

A bit burned out graphics card

GPU on my GTX 1060 3GB burned out a bit:

(more…)

We’ll never get our Sparks

Below I provided my dialog with Binance support:

what about sparks?
I mean should I expect them?

avatar
Can I know is this previous question or something else please ?

no, it is about Spark airdrop
I held XRP on December 2020

avatar
Kindly wait please, we will check and get back to you as soon as possible.

avatar
Upon checking, this airdrop of Spark tokens has not been sent yet, please follow our official announcements about this airdrop,
once we will distribute it, we will post official announcement here https://www.binance.com/en/support/announcement

avatar
Is there anything else I can assist you?

is there some planned date when we'll get some Sparks?

avatar
For now have to wait for the announcement since we don't have any planned date.

ok, thanks
(more…)