10 Offline Marketing Strategies That Still Work Today

Marketing has seen a paradigm shift with the rise of all things online and mobile. Creating a business Facebook page, tweeting about industry news, sending sale push notifications to customers… the…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Metrics and Results

The practice of using machines to provide and follow through with a trading strategy has been done for decades; with billions of investments into the technology to facilitate this, such as the example of the Hibernian Atlantic’s $300Million contract to reduce the speed of data delivery by 5.3 milliseconds¹.

Historically, projects of this nature can only be done in a research facility with access to a bloomberg terminal as well as the coding behind it to automatically place trades. However, the rise in crypto-currency as well as crypto-exchanges, facilitated by open source programming languages (e.g. Python) and increase in computing power; all of these elements have resulted in the possibilities of doing such a project, with nothing more than a good computer and an internet connection.

The data for this project comes from Kaggle², and this project picks ETH/USD pair for no particular reason (other than it is always considered to be the second to Bitcoin, and in the author’s perspective, better than Bitcoin); this project can easily be completed using other trading pairs as long as enough historical data is present for training models.

The trading strategy is a High-Low strategy, to explain, at a specific interval, each execution on an exchange typically has a high, as well as a low price, which indicates, during that interval, what was the highest price or the lowest price.

Fig 1. Example of an image for the J D Wetherspoon stock on Yahoo finance showing prices for Open, High, Low, Close etc.

XGBRegressor machine learning models were used to train to predict the next X minutes Low and High, a Buy-Order is subsequently placed at the Low price, once executed, a Sell-Order is then placed at the High price (and hope it executes). The final amount will result in a small profit gain.

The exmaple candlestick provided in Figure 1 has a unit of ‘day’, i.e. for everyday, what is the high, low, open price etc. To determine an optimal time interval, first, the data is grouped by different time intervals, and their respective stats are calculated (due to the volatility, an upper limit of 6% is set). Take 50% percentile as an example, it shows that the larger the interval, the greater the change, i.e. for 180-minute intervals, 50% of the intervals have seen a greater difference than 1.8%, whereas this is only 0.28% for 5-minute intervals. This is expected, since the shorter the time period, the less likely the return. However, there are 2 factors that must be considered.

Table 1. Basic statistics of the distribution for various time periods

The fist factor is the frequency, this is obvious, where the higher the frequency, the greater the absolute return. The second factor, which is one of the most important factor, is the fees.

The fee is a percentage that is levied on an action (i.e. executes a trade), therefore, the fee must be less that the percentage of return to produce a net positive trade. The fee impact with relation to frequency is plotted below.

Fig 4. Plot of the fee impact on percentage return (relational frequency is defined as x-minute/180, where for a 180 interval, the relational frequency would be 1, but for 15-minute interval, this value is 12)

Figure 4 shows that the relation between fees, estimated return, as well as frequency are not linear. Whilst the higher the frequency, the greater the return, but this only increases to a certain point until it decreases due to the ratio of fees to profit. Different crypto-exchanges have different fees, Binance for example, has a fee starting at 0.2%⁴ as opposed to 0.3% on Bitfinex. Based on these, the interval should be 10-minute and 20-minute depending on the exchange. For this report, 15minute intervals is chosen as a form of consensus.

Fig 5. Histogram of 15-minute intervals

The above analysis shows that it is possible to buy an asset at low price and sell for a small profit within 15minutes. The mean of the difference is 0.669%, with the median being 0.496%. One thing to consider, is that the statistics do not show whether it is a Low >> High, or High >> Low scenario (where the high price is hit before the low price, aka, when the price is dropping). Regardless, it is possible to reduce the risk of this happening during the execution strategy (more will be discussed in the methodology section).

The raw data obtained from Kaggle as previously stated. From there, the data is grouped into 15-minute intervals using the pandas “groupby” function, with arguments shown on figure 6.

Fig 6. Arguments for grouping

To make the data ready for training, it must be normalised. One obvious example is to divide by the range (max-min), however, with momentum-like trading strategies, the datasets leading up to the point in question is more important (such as the rolling averages). Therefore, the dataset is normalised by a rolling averages instead. To do so, a number of rolling averages are calculated, these are 1, 2 and 4 hour rolling averages (ra).

Fig 8. Examples of the parameters tested.
Fig 9. Screenshot of the pipeline used to train the 2 models.

Two main Python classes were written to replicate the trading environment. First class imitates what an exchange would do, it stores information such as the current price, open orders etc. It also executes open orders. The second class is a decision class, it takes in and stores raw data, processes them, and then predicts the next low and high value from the historical data.

Both classes work together to automate the trading process. The historical data was from 17th August 2017 until 1st December 2020. The data used to perform trades on was from 1st December 2020 until 27th December 2020. For December 2020, roughly 5% gain was obtained.

Fig 10. Shows the events of execution overlaying the price change for the month of December

Generally the model performed well, a few unforeseen complications were found while performing the testing on mimicking the exchange raw data for December 2020. As shown on the graph, a few Buy-orders were opened, and 3 were successfully closed (a successfully close order was one that bought and sold for a profit, as seen marked by a green, and a subsequently red dash line on the graph). However, the length of time that the order took was longer than expected, this will be discussed in the following sections.

At the start, the buy and sell order prices were purely what the model had suggested. However, often, the model would predict higher than the actual market value, causing it to miss the local maximum. The order, however, was still valid, causing it to miss all subsequent opportunities.

It appears the model has successfully captured some opportunities. However, there are rather a few opportunities that have been missed. Further investigation is needed to understand if the missed opportunities were due to having an open trade at the time.

A few interesting points was not planned, one of the point was the impact of fees on trading frequency, which shows, perhaps it is not valuable to engage on more frequent tradings. This was indeed an interesting discovery.

This project has built the ground work to enable the ability to engage with more advanced analytical techniques. A few areas of improvements should be researched into.

Improving upon the model accuracy is a very obvious choice to improve the end results as a whole (such goal could be achieved by engineering better features such as using natural language processing techniques on market news). Another way to improve on the model could be using a neural network instead, such method needs to be looked into.

2. Improving on the Trading Strategy

Perhaps it might be impossible to product a model that predicts the future to 100% accuracy, it doesn’t mean the end results can’t be improved. A few strategies can be used to improve the net return. For example, a time-limit can be used such that, when the limit is reached, the order is cancelled. This could expose the bot to more opportunities, which would mean high chance of return.

This project chooses cryptocurrency purely due to the simplification that crypto exchanges have built to engage on mass adoption of crypto. However, it has definitely becoming somewhat of a sensation (with recent Bitcoin breaking all time high — again).

However, there are a few factors that are against Bitcoin:

I personally don’t believe Bitcoin is the end game here (more like Infinity War). Especially there are other crypto currencies that are better than BTC (BTC does have the novelty to it, which is very hard to overcome), the technologies behind it, aka Blockchain, is likely to be here for the End Game.

Add a comment

Related posts:

What can we do about online extremism?

We recently made a submission to the Federal Government’s inquiry into online extremist movements and radicalism. This blog post takes some of our key thoughts, and summarises them below.

10 Women Doing Their Thing and Kicking Ass in Endurance Sports

Imagine a world where a young boy meets a celebrated sports hero — like a Shalane Flanagan or Megan Rapinoe — and walks away with a message to his parents, teachers, and all of his friends that he…

KingCasino is the best for your ICO and IEO

KingCasino is an online cryptocurrency casino site licensed in Curacao, which offers an amazing collection of more than 1000 very high quality slot games such as Sports Betting, Blackjack, Poker…