Life cycle of technology

Technology is a very hard to value idea. So when money gets into the mix, many people suddenly become technology experts. Throwing around ideas, such as block chain, cloud computing and cryptography as the next buzzword just because it is the next sexy thing. And for sexy things, people are more willing to pay more for it.

sexy ethereum

This post is with regards to cryptocurrencies and ICOS in general, however I will take some reference from the Dot Com boom and bust of the 2000s as well.

This sexy trend of putting money backing some shady ICOS is actually akin to investing in Pets.com in the 2000s. Some background of Pets.com from wikipedia

Pets.com was a short-lived online business that sold pet accessories and supplies directly to consumers over the World Wide Web. It launched in February 1999 and went from an IPO on a major stock exchange (the Nasdaq) to liquidation in 268 days

However with the bad news there are also good news from the bust. Companies which survived the dot com bust came back stronger than ever. Companies like Amazon, Microsoft,  Apple (which by the way just became a trillion dollar company). There is just no way of predicting which technology will survive. However based on the Lindy effect, if it is still here, it might be here for a while more longer.

That being said, I asked myself this question, the largest cryptocurrency in terms of market cap Bitcoin was bootstrapped by 1 single person, required no such thing as a crowd fund, and survived to this day. Several attacks on it, and even a fork to Bitcoin Cash couldn’t kill it yet.

Question to myself : If the biggest market cap cryptocurrency could bootstrap it’s way through and still remain the biggest crypto in the market. Why are these shady ICOs asking for handouts.

Possible answer based on SITG and Antifragile : They probably don’t have SITG and just want a fast payout by milking the sexiness of such buzzwords being thrown around. Such ICOs will never have the antifragile edge as they have already been corrupted by the abundance of funding. Scarcity is the recipe to making strong man.

Possible answer based on Ikigai : When one does things for the sake of money, and not for his own Ikigai, it is highly likely it will barely amount to anything perfected. At most it will become a “Factory made cheap alternative”

Bootstrapped Coins which are still here today : BTC and LTC

 

Advertisements

Micro business 5 – Ether percentile

Rules

a. Sell at the range of 0.0904

b. Depending on which percentile you are in. Divide the total amount by the number of percentile under it. Example if i wish to play 6th percentile, I will have 5 more percentile under it which I will need to average down,

In this example : Total amount / 5 for each trade

c. Average down each percentile with the amount left over divided by the number of percentiles left under it

c. Once hit $0, close this business and deemed it a failure.

ether range

 

BTC Volume / Market cap Ratio

I have a burning question in mind, does the volume of bitcoin traded on that day with respect to the market cap matter in its price.

cake quarter

Hypothesis : The more the ratio of volume / market cap ratio, the more its price should rise subsequently

This analysis yield some particularly some weird results. The below chart shows the analysis of the ratio of bitcoin volume/market cap with respect to its price if I blindly buy and sell 1 week later on a Monday. Its a loser’s trade.

bitcoin 1 week buy and sell

I was expecting the 4 weeks blindly buy and sell to yield the same curve, however it yielded something particularly different.

 

The 4 weeks buy and sell yielded a growth in the bank from ratio 0.0038-0.027

bitcoin 4 week buy and sell

I then took the time series of the price and did an analysis if i were to buy at this ratio 0.0038-0.027 and only sell @ above 0.027, it yielded me an interesting result.

With $1000 on every trade, I made a positive $1073 on these 9 trades. 3 Trades lost money with the worst draw down of -$296 and the best profit $418, However do note that most of the trades were only in effect as of year 2017 which render the whole analysis kind of useless as most of the trades occurred in that 1 year and might be an anomaly.

9 trades-bitcoin ratio vol-marketcap

What I learnt from this analysis

  1. Buy and sell in the short term (1 Week) is a bad idea as commissions will eat into your profit. This simulation was done with a $20 commission being charged for each trade (Not really accurate but I just want to find a trend)
  2. Buy and sell in long term (4 weeks) might be a better idea
  3. Although there is a trend and the profits are positive does not mean you should trade this. In this example most of the trades are in year 2017 which might be an anomaly.
  4. Charting this out lets you see clearer and there will be no way you will be trading this ratio. You shouldn’t trade a possible anomaly. Its all about risk management and probability.

 

Arbitrage Bot UML Diagram

In a nutshell.

  1. Bot Class will be the main class.
  2. Bot will call the constructor for Exchange(Both subclass).
  3. Exchange Subclass will call the fileHandler class to get its endPoint, ApiKey and API secret which it will than go into the garbage collector once Exchange subclass is being instantiated.
  4. Bot Class will then call the getOrderBook Method for both exchanges .
  5. The methods of the subclasses for exchanges might need to go through the hashingAndEncoding class to hash and encode their HTTP Request before posting.
  6. Once the JSON returns back, and goes back into the Bot Main class, decision maker will be called to place order, cancel order or do nothing.

ArbBotUML-PNG

Working With API – Part 2

So far working with the Gemini APIs sample codes are all python codes, shell scripts samples in Gemini. These 2 are not the most popular coding languages and they are environment specific. Yesterday as I was browsing FYB-SG website, I noticed that there were code samples for Java, Ruby, Go etc being automatically generated by a software called Apiary for it’s API

apiary

 

In order to understand more about how API works, and for generating the source codes automatically, download the program POSTMAN

Postman link

The below shows how to navigate Gemini for it’s more complicated API for eg some orders which require authentication to the server.

  1. Let us use 1 example (Get available balance), the rest of the examples will be similar except the changing of some variables. From the API below, you know that in order to get available balance, you will need to post to /v1/balances

get_avail-balance2. Next let us see how the POST request is being structured. Because the private API requires authentication, this will be more complicated than compared to the previous public API. The instructions on Gemini website states that the request need to be send with a payload, the structure of the sample payload is below. Do note that the below is just a sample payload and not all payload will need an order_id. We will also need a nounce and they explained what a nounce is below. A nounce is simply just a number generated programatically and must increase incrementally as and when my API connects to Gemini. You can simply just use a running number counter for testing purposes.

payload-API

3. After constructing the payload. The documentation informs us that the payload created in step 2 will need to be encoded in base64 and then passed to a key  of X-Gemini-Payload of the header in JSON format. We will need to pass the JSON created in step 2 to a program to encode it in base64.

payload - api 2

4. After encoding in base64, we use the string and copy into POSTMAN to get ready for testing purposes. We change the function to POST as Gemini tells us that this private API uses the post request. from the header, we enter in the format that gemini tells us from the documentation and pass in the encoded payload.

postman-payload

 

5. Now from the documentation, there are 2 more variables to fill in, the api key and the signature.

api key and secret

 

6. Now make sure all the variables are placed correctly and then click on send to test out this Request.

postman good to go

 

7. If it is successful, the body of the response will have a JSON reply

json reply

8.Now POSTMAN can generate out the source code of this request automatically. Click on the code and you can copy the code to be used

postman generate code

 

 

 

 

Working with API – Part 1

Working with API has been a tremendous steep learning curve so far. This is to document the How to work with API.

The example that is shown below is from Gemini API. Part 1 will be the usage of the public API. The Public API does not require authentication to the Gemini Server which means that you will not need to create an API key for this tutorial.

What is an API

There is a comprehensive article on API on medium below.

What is an API

What is REST

There is a comprehensive article on what is REST on medium below.

What is REST

If you TLDR :  Just know that it is simply just an architecture which is stateless,  meaning that the server does not need to know anything about what state the client is in and vice versa. In this way, both the server and the client can understand any message received, even without seeing previous messages.

There are other architecture such as SOAP or GraphQL which some crypto exchanges are using.

Why API?

Why is there a need for an API. Let us go into an example.

  1. When you go into the website : https://stackoverflow.com/The browser knows that you are requesting for this page from http://www.stackoverflow.com and there will be a request to get the page from stackoverflow.
  2. Now go to right click on the web page and click on view page source. The page is rendered like this with the proper alignment etc so the viewer can view the page in human readable format.

browser http request

3. However even though it is in human readable format, for the programmer, or program, there are too many extra things such as the alignment of buttons etc which we do not need if we want to program a software to do automation. These extra stuff are the things which are making it difficult for us to Parse the whole HTML document.

4. So here comes API to the rescue. API is merely something coded at the back end by the server owner to open up some resources back to the querier in machine readable format such as XML or JSON.

API

5. To start navigating APIs, you will need to know what is the endpoint. Using gemini exchange as an example, You can browse to this link below.

https://docs.gemini.com/rest-api/#symbols

What this means is that Gemini have coded a method that if you tell the computer browser / program to access this end point, it will return the computer some machine readable data.

endpoint

Let’s try this example. The browser returns back a JSON file which can be easily parsed by a JSON parser program. The Sandbox means it is a test environment for people to play around before deployment to production.

api return JSON

 

6. For another example, if I want to create an arbitrage bot which checks Gemini for its bid and ask spread. I will need to browse to Gemini API documentation on current book order. I know that the end point is

https://api.gemini.com/v1/book/:symbol

based on the documentation. However when we try we get a error. The API replies us with the supplied symbol is not a valid symbol. We then know that :symbol is a variable which we need to change to access the correct order book.

currentorderbook

 

7. Let us change the :symbol to ethusd, as we wish to arbitrage eth usd. The program then returns a JSON file which the square brackets is being encapsulated by the Bids are all buy orders. The square brackets encapsulating the Asks are all sell orders. We can then parse this JSON file in our program to create our arbitrage bot.

bid-ask-api

I will be using Python 3.6 to program the Gemini API connectors etc

The connection to the respective API are created in my Gists. This is just bare connection codes to the respective exchanges, Coinut and Gemini

https://gist.github.com/caulinez