Ultra 2018 lineup

Only went for the 3 acts of day 1 and the last 2 acts of day2

ultra lineup

Day 1 : Nicky Romero 

nicky romero

Ranked 50 but was quite ok.

Day 1 : Steve Angello 

steve angelo

Best of the 3 days.

Day 1 : DJ Snake 

DJ Snake

Not my style, left within 30 mins. When I was going through the exit, seemed like there were a lot of people who had the same sentiments

Day 2 : Afrojack

afrojack

Kinda weird style where his music has no drop. And went silent before the next.

Day 2 : Above and Beyond

above and beyond

Lots of people leaving when the supposedly finale was playing, 3 lao ah pek playing retro EDM and slow songs. Was surprisingly good for me. I kinda enjoyed it. But left earlier as my friend did not really like this.

My ranking for this Ultra 2018 is like this.

  1. Steve Angello
  2. Above and beyond
  3. Nicky Romero
  4. Afrojack
  5. DJ Snake

You learn something new everyday.

  • Ranking means nothing if the style doesn’t suit you. 

– You might be book smart throughout in life, however if you do not do something which is 2nd nature to you in life when you grow up, no matter how good your scores, and papers are, you are susceptible to failure eventually as time will slowly wear you down.

  • What you like, your friends might not like thus if you are out having a night out with other people, you often might need to compromise.

– If you are super stubborn and cannot compromise, its best you go solo whenever you do anything, so you won’t spoil the night.

  • Steve Angello should be out there with the top 50s since he is 1/3 of the swedish house mafia, somehow he dropped 52 places to 82 however he still rocks.

-Form is temporary, class is always permanent.

Advertisements

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

What is Apache Maven

Maven is a software management tool which is used in Java. One of its use is that when we create a maven project in the IDE, we can specify a project object model XML file in the project folder under the dependencies tag. These are the Jar files which Java will automatically grab from the maven central repository to build. Now no no of files which will not compile without the correct Jar version as you will just need to include this POM.XML file in the project folder and your IDE will auto grab all the required dependencies to build the project.


maven pom

How to add the correct dependencies into POM.XML

  1. An example is httpClient. Lets say I need to import methods and classes from HTTP Client. First I will go google to search for a HTTPclient Maven . mvnrepository is the official maven repo website.

maven httpclient search2. Copy the XML tag dependencies and paste it into the POM.XML file in your Maven project.

httpclient maven XML tag

3. Now you can build and your IDE will automatically add in the jar files.

jar dependencies

 

4. You are done. No more hunting for Jar files dependencies anymore.

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