Crypto : API Order Entry and Volatility

Crypto Currencies: Speed/Breadth/Precision

Presently, the Crypto Currencies have very large Volatility, which is one of the many reasons why I've started with Crypto Trading.

Nope, I of course do not believe in the false adage 'Trend is your friend' at all.

I choose my own friends, and for me 'Volatility is my friend'.

The speed with which the Cryptos rise and fall is breathtaking. The speed with which a human can respond to such rise/fall, perhaps will be too slow.

In addition to this, at present there are 800+ Cryptos in existance. Binance.US has just about 50 Crypto Currencies to trade. The pattern so far for Binance.US is that they keep adding more and more Cryptos, on their platform, for their trader-customers. The attention span that a human has perhaps is inadquate to accommodate the breadth of these Cryptos becoming available for trading.

Lastly, in the US exchanges the securities such as Stocks, Bonds, ETFs, Mutual Funds have low level of precision. Most Bonds trade in integers. When I want to use Structured Notes, I can buy/sell only in integers. For the Stocks until recently, trading was in integer units only, however now some of the brokers have started fractional trading for Stocks. (For Mutual Funds the precision was upto 3 decimal places after decimal point for a while.) However, Crypto trading happens at much higher precision - upto 4/5/6 digits after the decimal point. The humans are ill equipped to perform such calculations using paper/pencil/calculator.

To cope-up with these attributes - speed/breadth/precision - I've formed the solution using automation in Excel and Python.



Excel: Visual Database

Excel is a versatile program that offers many features - one of the which is to create Visual Databases. (Sure - ORACLE, Postgres offer true databases, but they are not visual.)

I've used Visual Databases I created in Excel for trading ETFs, and mutual funds, so I extended the same usage to Cryptos as well.

Following is a mock visual database I created, to test API Order Entry.



Binance: API to place order

Binance has well documented APIs that I like in my personal life.

(Pretty much similar to documentation I enjoy from ORACLE and Zuora in my professional life !)

Here's the doc for the API I used.



Python for API Order Entry

I'm a trader/coder. So to assist my trading, I used my coding to code a back-end Python program to read the Visual Database, and transmit all the orders to Binance.US. The exact same program of course can be invoked using Excel's button 'Transmit All' !! (Yes, my VBA comes in handy with Excel.)

Here's the 'Windows 10' CMD window that shows the execution of the Python program. As can be seen, the first order was placed on 6/27 at 16:59.01, and last on 16:59.20. Which means it took 19 seconds for all the orders to be placed. (If I were to do this manually naturally it will take me much longer.)



Browser on Binance.US showing the orders

The check-up of this API order entry, of course, is to ascertain that the orders indeed were placed as expected on the Binance.US web-site.

Yes, these were placed correctly, with the precision that I was expecting.

Of course these orders are not 'real' orders that I want to execute, rather these are test orders, therefore I've cancelled all of these after ascertaining validity.

For actual orders, I'd go with different/higher amounts, and with different limits, and quantity would be a calculation.



Crypto: Scalable Solution

Plenty of emphasis is placed on 'scalability' in IT departments for any solution being implemented. The solution I've implemented for myself is totally scalable for me as an individual trader.

  1. The ease of operation is literally 'click of a button'. I simply need to push the button 'Transmit All' - nothing more !!
  2. The speed is pretty satisfactory - it's taking less than 1 second for each order. As I had posted on linked-in last month (click here), I had less than 2k open orders with TD Ameritrade for ETFs. The number of ETFs I track are more than 2.5k; and I actively trade just about 700. Therefore, with just about 50 cryptos available I have a long way to go till I'd need more than 1k orders.
  3. Both Python (numpy/Pandas) and Excel are easily capable of handling precision upto 8 decimal digits after the decimal point.
  4. Lastly, from what I hear 'Turbo Tax Premier' (Click here) is capable of handling my Tax Filing with IRS.

Volatility: Average True Range

The false adage 'Trend is you Friend' rhymes for sure, however, I believe, it is far from being logical. (Of course for personal finances, the decision about who is one's friend and who is not, is 'personal', therefore everyone needs to decide for her/him self about the friend.) If there is zero volatility in a security, then a price graph of such a security will be a flat-line. ( Nah ... flat-lines are dead beings ... *smile* )

Volatility makes the security, be it a Stock, an ETF, a Mutual Fund, or a Crypto Currency to rise and fall. Each rise and each fall that occurs, potentially is a trading opportunity. Every rise is a potential opportunity to go long and profit, and every fall is a potential opportunity to go short and profit. Different traders with diverse sets of tools/skills/Algos target different set of securities to try to benefit from such rise/fall. Presently (6/27/2021) I only target ETFs, Mutual Funds, and Cryptos. (I have not traded any Stocks since 2011, and I have no plans to trade Stocks at all.) For years I've enjoyed the Volatility - I especially like the large Volatility offered by leveraged ETFs / Mutual Funds by firm Pro, Guggenheim, and DireXion. Since 2021, I've started appreciating the large inherent Vollatility present in Cryptos as well.

There are many measures of Volatility viz. Bollinger Bands, Keltner Channels, Average True Range, Alpha, Beta, Ulcer Index. The one I prefer to use for my trading is Average True Range, and variation Normalized Average True Range. J. Wells Wilder formulated ATR in 1978. This indicator only provides the degree of Volatility, and totally lacks any indication of ttrend. (I of course am completely disinterested in trend). This formula is available in TA-LIB for Python/Java/Excel etc. I use Heatmaps I generate for getting the overall Volatility for Cryptos. In general the Cryptos are Volatile, and some of them are especaiily more Volatile than others making them ideally suited for Blitz Algo.



Copyright © 2021 Salil V Gangal, All Rights Reserved.