- Read
- Top Stories
- Write
- Listen
- Learn
Web Development Data Science - What is it?
- Best 50 Sites to Learn it
- Data Engineering
- Data Science Course 2020 ๐
- Deep Learning A-Z ๐
- Deep Learning vs. Machine Learning
- Love
- ML Essentials
- PG Program in Artificial Intelligence and Machine Learning ๐
- Optimize Your CV
- Python for Machine Learning ๐
- Statistics for Data Science and Business Analysis๐
- Zero to H...

Languages - Advertise
- About
- Tech Companies
- Experts ๐

Create Your Own Custom Calculation for Trading Crypto like a Pro [feat. the Crypto-Exchange I Built] by@binaryoverdose

November 11th 2019 757 reads

Custom calculations have just arrived in the latest update of Binary Overdose the realtime cryptocurrency analysis software, let's take a look.

Custom calculations are simple yet very powerful. Essentially itโs the ability to create brand new columns based on data from other columns.

A simple example would be if we loaded โVolume USDโ, a column that shows data in full units, we could then create a custom column called โVolume Millions USDโ, divide the previous column by 1 million and hide the original.

Of course there are many more advanced use cases than this and weโll get into some later in this article.

To weigh volume as a metric we can multiply it by the market cap. The lower the volume, the lower the overall score.

- Open theย binaryoverdose.comย website and click on โEditโ.
- On the bottom right of the dialogue click โClear Selectionsโ.
- Now open the CryptoCompare menu item in the left panel and select both โVolume 24h $โ and โMarket Cap $โ.
- On the right panel at the bottom click โAdd Customโ.
- Give the custom column a name, letโs say โVolume Weighted MCโ.
- There should only be 2 available options in the columns selector marked โstep 2โ. Select both of them. Note that the order you select them in will define which variable name they get assigned, eitherย

ย orย*c0*

.*c1* - Now in the calculation text box (step 4 in the graphic) write the followingย

ย and click the โOKโ button.`c0*c1`

We could clean this up a little as the number is really quite big. Change the calculation toย

`(c0*c1)/1000000`

, make sure the type is set to number and update the title to say โVolume Weighted MC Millionsโ, now we have something we can actually use.Hereโs one I made earlier:

Volume Weighted MC Live Example

And hereโs a quick YouTube example:

Letโs do another simple one before we work on a more complex example. To create this new ratio we need to divide code repo points by market cap.

Follow the previous steps again but select the โcode repo pointsโ and โmarket capโ columns instead, you can search for them if you donโt want to navigate the menu tree.

Now instead of multiplying the values just divide them. Make sure you divide Market cap by Code Repo Points though as this time the order does matter.

In the example I sorted by the new โRPMC Ratioโ field in ascending order as lower numbers are better. I also added a couple of filters, โMarket Cap > 100000000โ and โRPMC Ratio > 0โ just to filter out some junk.

Hereโs an example:ย BinaryOverdose Code Repo Points Market Cap Ratio.

For the next example weโre going to create a custom ranking system. Let's say weโre trying to value cryptocurrencies based on our own criteria. To do so weโll pick a number of metrics that were interested in and assign them points between 0 and 2.

Weโll then add up the points and sort the column in descending order.

At the risk of not overly complicating this example weโll only pick 3 data points, โNumber Of Exchangesโ, โSharpe Ratio 30 Dayโ and โ7 Day Change Against BTCโ.

Hereโs the calculation. It may look complicated at first but there is only one thing you need to know and its repeated 6 times.

```
(
c0 == 0
? 0
: c0 < 5
? 1
: 2
)
+
(
c1 > 5
? 2
: c1 > -1
? 1
: 0
)
+
(
c2 > 0
? 0
: c2 > -2
? 1
: 2
)
```

Firstly, theย

`c0`

ย ,ย `c1`

ย andย `c2`

ย variables are assigned automatically as in the previous example. For this calculation they are as follows:```
c0 = Exchanges
c1 = Sharpe Ratio
c2 = 7 Day Change
```

The โcโ stands for column if you were wondering.

Anyway, there are a maximum of 2 points assigned for each metric so a grand total of 6 max per result. A breakdown of how they are assigned is below but if you donโt care you can justย go to the live example hereย (I added a few more columns at the end so our calculation wasnโt lonely).

**A note on the syntax (skip if you know what a ternary operator is)**

In order to write the calculation weโll use a JavaScript conditional operator called theย ternary operator. It works as follows:ย

```
condition
? expression if condition is true
: expression if condition is false
```

So if the number of exchanges, lets call thatย

`c0`

ย equals 4 and our expression wasย `c0 < 3 ? 0 : 1ย `

then the result of the calculation would be 1 because 4 is not smaller than 3.Because we require multiple conditions we will use a nested ternary operator for each calculation. It may look a little complicated but it should be no worse than an excel function (I know thatโs not saying much).

The Number of Exchanges metric is the total number of exchanges that a cryptocurrency is listed on, in this example it will be assigned the variableย

`c0`

.```
c0 == 0 // if c0 equals 0
? 0 // then 0 points
: c0 < 5 // else if c0 is between 1 and 4
? 1 // then 1 point
: 2 // otherwise 2 points
```

For Sharpe ratio generally the greater the value of the Sharpe ratio, the more attractive the risk-adjusted return.

So let's say over 5 gets 2 points, between 0 and 4 gets 1 point and under 0 gets 0 points.

Sharpe Ratio will be assigned the variableย

`c1`

ย so our calculation is as follows.```
c1 > 5 // if c1 is greater than 5
? 2 // then 2 points
: c1 > -1 // else if c1 is greater than -1
? 1 // then 1 point
: 0 // otherwise 0 points
```

For this metric we are looking for projects that have recently pulled back so weโll assign more points if there has been a larger drawdown.

7 day change will be assigned the variableย

`c2`

```
c2 > 0 // if c2 is greater than 0
? 0 // then 0 points
: c2 > -2 // else if c2 is greater than -2
? 1 // then 1 point
: 2 // otherwise 2 points
```

Donโt forget to check out theย BinaryOverdoseย website and follow us onย Twitterย for updates. Leave a comment to let us know your experiences with custom calculations or if you need any help making your own. You can also check out this full feature screencast.

I (Alan), am the founder of Binary Overdose so am obviously biased as to how great it is. Stay tuned for even more powerful custom calculations coming real soon.

Join Hacker Noon

Create your free account to unlock your custom reading experience.