Fruit Fly Trader (4): Second-by-second trades based on fruit fly behavior yield a 0.006% average gain per trade
Since the complete wiring diagram of the fruit fly brain was made public, attempts to build "virtual fruit flies" on computers have been proliferating abroad — running games and simulations on them has become something of a trend. The Herald Business is publishing a series documenting a reporter's experiment in which a virtual fruit fly brain, modeled on the published connectome, was put in charge of cryptocurrency trading. All trades were conducted as simulated transactions, and this series is not intended as investment advice. [Editor's note]
Thirty virtual fruit flies — programmed with the behavioral rules a real fruit fly uses to track a scent toward food — were put in charge of simulated bitcoin trading. Over roughly four days, they bought and sold 167 times, averaging a gain of 0.006% per trade. That works out to about 60 won in profit on every 1 million won ($744) traded.
The Herald Business has been running simulated bitcoin trading experiments using virtual fruit flies that operate a fruit fly brain on a computer. Under the same conditions, a single virtual fruit fly bought and sold eight times, averaging a loss of 0.09% per trade.
The approach of converting 15-minute candlestick charts into scent signals produced mostly losses in back-testing. Some individual flies did post gains of more than 3% over just three trades in real-time simulations, but the low trade count made it hard to rule out luck.
This round used a different method: the trading strategy was built around measurements from actual research on how real fruit flies move when following a scent, and the chart interval was switched from 15 minutes to individual seconds.
Mimicking the fruit fly's scent-tracking instinct
Because the way a scent disperses through the air is invisible, researchers at Yale University in 2020 built their own wind tunnel and pumped smoke through it in irregular bursts, substituting visible smoke for an odor that could not be seen.
Smoke is itself a kind of scent — a mixture of various compounds. The team filmed fruit flies walking across the floor of the tunnel alongside the moving smoke.
Their analysis found that fruit flies do not significantly change their walking speed when they encounter a scent, but when they happen to be turning at the moment they detect it, they become more likely to turn toward the direction the wind is coming from. The flies also used the timing of scent contact while standing still to decide when to start walking again.
The researchers concluded that, in conditions where it is hard to predict when or where a scent will appear, fruit flies navigate toward it by gradually adjusting their walking direction based on the cumulative pattern of scent encounters up to that point.
Not all the information in the chart was fed to the virtual fruit flies as a scent signal. Only large fills or a sudden cluster of executed trades within a short window were treated as a single scent event, and if the fill was on the buy side, the wind was set as blowing from that direction.
When a virtual fly moved toward the direction the wind was coming from, it bought bitcoin; when it stopped or changed direction, it sold. The walking and stopping durations measured in the earlier research paper were kept as-is; only a single time-scale parameter was adjusted to match the speed of the market.
Costs were calculated on the basis of a zero-fee exchange, since the strategy involves frequent buying and selling by the second and fee drag is substantial. On a standard exchange, buying and selling bitcoin at market price once costs 0.116% of the transaction amount when fees and the bid-ask spread are combined. Even with no fees, the 0.024% bid-ask spread incurred on each round trip was counted as a cost.
The performance of a single virtual fruit fly varied with the number of trades. Over the first 16 trades it averaged a gain of 0.041% per trade. By Tuesday, when the trade count had reached 45, the average had slipped to -0.003%.
Applying the same method to eight altcoins produced 234 trades with an average loss of 0.20% per trade; only 15 percent of all trades were profitable.
Selecting the best-performing fly from back-testing and running it forward also failed to work.
The fly that posted the best results in data from Sept. 23 to Sept. 29 averaged a gain of 0.27% per trade, but in the subsequent data from Sept. 30 to Oct. 3 it averaged a loss of 0.06%. Those figures came from just two and three trades respectively, making it hard to read much into the difference — and past accuracy offered no guarantee of future accuracy.
Pooling 30 flies produces real gains, not just luck
To compensate for the limitations of relying on a single fly, several virtual fruit flies with different settings were grouped together to make collective decisions. Aggregating the judgments of multiple flies means that when one is wrong, the others can offset the error, potentially reducing overall noise.
Real fruit fly research has produced similar findings. In 2015, Swiss researchers published a study in the journal Nature showing that fruit flies avoid a repellent odor only weakly when alone, but flee from it far more strongly when in a group.
In experiments using carbon dioxide, solitary flies showed almost no reaction. Groups, however, transmitted warning signals in a chain reaction as their legs made contact with one another — and even mutant flies that could not detect the scent themselves fled along with the group.
In the virtual fly setup, the 30 flies did not exchange signals with one another; instead, each made its own independent judgment and the results were pooled like a vote. The 30 flies were each given different settings for time scale, the fill threshold used to register a scent, and the exchange from which fill data was received. When 60 percent or more of the 30 flies moved in the buy direction, the system bought; when that share fell to 30 percent or below, it sold.
Over roughly four days, the 30 flies traded 167 times — about 40 trades a day — and averaged a gain of 0.006% per trade. Over the same period, a single fly traded eight times and averaged a loss of 0.09%.
The team also tested whether the 30 flies' gains were simply the result of chance. When the 30 flies' voting results were randomly shifted out of alignment with the actual chart and the calculation was repeated 200 times, only eight of those runs (4 percent) beat the 30 flies' actual performance. That suggests it is unlikely the gains were a coincidence.
This is the first time in the virtual fruit fly experiments that the benchmark — performing better than chance — has been cleared.
Clearing the benchmark does not guarantee future profits. The probability that the 30 flies will continue to generate gains going forward was calculated at roughly 68 percent, and the expected return per trade was estimated at between -0.012% and +0.026%.
A strong consensus among the 30 flies did not improve outcomes either. When 80 percent or more of the flies voted to buy, those trades actually averaged a loss of 0.027%.
The 30 flies entered real-time simulated trading on Saturday. Through Tuesday morning they had traded 104 times, averaging a gain of 0.01% per trade. That is broadly in line with the back-test results. Their return was, however, 0.1 percentage point lower than simply buying and holding bitcoin over the same period.
These results hold only under the assumption of using a zero-fee exchange; applying standard fees would turn the outcome into a loss. The experiment is also limited in that only bitcoin was tested.
Meanwhile, while the fruit fly behavioral rules did produce a small gain, a virtual brain built directly from the fruit fly connectome still runs at a loss. The next experiment will expand the virtual brain's memory capacity to see how much of the chart it can retain and respond to.
A four-week Saturday-and-Sunday series documenting an experiment in which a "virtual fruit fly," built from the published fruit fly connectome, was put in charge of cryptocurrency trading.
dbsdn1110@heraldcorp.com
