Wednesday, September 28, 2016

Algorithmic trading robot

Sales and trading plays a central role in the financial stock market. Algorithmic trading has increasing popularity over the past few years, it can do so much more than a human trader. The picture below shows the percentage of algorithmic trading over the entire market transaction. 

What is Algorithmic trading?
Algorithmic trading uses computers to program a defined set of instructions for placing a trade in order. It is often used by banks, pension funds, mutual funds and hedge funds, and it was developed as a cost saving mechanism, because institutional traders need to executive large orders in markets that can not support all of the size at once. By setting by variables such as time, price, and volume, computers(algorithmic trading robot) can watch the stock market constantly and execute traders, whenever the conditions are met. Another benefit of algorithmic trading is that human trader does not have to watch the stocks constantly and repeatedly, which saves time for them to work on other projects. Since computers processes information at a higher speed and thus higher frequency, algorithmic trading generates more profits than a human trader.

How do you build a algorithmic trading robot?
MetaTrade4(MT4) is an electronic trading platform that uses the MetaQuotes Language 4 (MQL4) for coding trading strategies. It is one of the popular softwares to build a  algorithmic trading robot.

I will show you part of an example below with the free and open-source Quantiacs Toolbox which supports both Python and MATLAB by building a Heikin-Ashi indicator.
def HEIKIN(O, H, L, C, oldO, oldC):
    HA_Close = (O + H + L + C)/4
    HA_Open = (oldO + oldC)/2
    elements = numpy.array([H, L, HA_Open, HA_Close])
    HA_High = elements.max(0)
    HA_Low = elements.min(0)
    out = numpy.array([HA_Close, HA_Open, HA_High, HA_Low])  
    return out
Heikin-Ashi Candle Calculations
HA_Close = (Open + High + Low + Close) / 4
HA_Open = (previous HA_Open + previous HA_Close) / 2
HA_Low = minimum of Low, HA_Open, and HA_Close
HA_High = maximum of High, HA_Open, and HA_Close
Heikin-Ashi Calculations on First Run
HA_Close = (Open + High + Low + Close) / 4
HA_Open = (Open + Close) / 2
HA_Low = Low
HA_High = High
This is the beginning part of the code and you can read more from this link: https://quantiacs.com/Blog/Intro-to-Algorithmic-Trading-with-Heikin-Ashi.aspx. 

The code for algorithmic trading is very complex and advanced, but isn't it so encouraging that we start to understand the basics like "array" and "return"? Once, a finance professional told me, "we can teach you about algorithmic trading, as long as you know some basics of the computer science, even if you only took one computer science class. But even that basic knowledge will give you a good starting point." I did not truly understand what he meant until when I wrote this blog and googled the code for algorithmic trading. I open the website, expecting to know nothing about the codes, but I was excited to find that I do understand some basics. 

--------------------------------------------------------------------------------------------------------------------------
Picture References:
1.https://www.google.com/search?q=algorithmic+trading&biw=1280&bih=625&tbm=isch&source=lnms&sa=X&ved=0ahUKEwiq_fb-zLjPAhUGPCYKHexED24Q_AUICSgE#imgrc=llwEXhaZbAXpnM%3A
2.https://en.wikipedia.org/wiki/Algorithmic_trading#/media/File:Algorithmic_Trading._Percentage_of_Market_Volume.png
Writing References:
1. http://www.investopedia.com/articles/active-trading/101014/basics-algorithmic-trading-concepts-and-examples.asp
2. https://en.wikipedia.org/wiki/Algorithmic_trading
3. http://www.investopedia.com/articles/active-trading/081315/how-code-your-own-algo-trading-robot.asp
4. https://quantiacs.com/Blog/Intro-to-Algorithmic-Trading-with-Heikin-Ashi.aspx
--------------------------------------------------------------------------------------------------------------------------
Check the video below for how the basics of algorithmic trading

Friday, September 23, 2016

Amazon - Robotics and inventory management

Were you ever amazed by the fact that you can receive one-day free prime delivery at Amazon?
Have you ever thought about how did Amazon manage all of its inventories?
The answer is AMAZON ROBOTICS.

Traditionally, inventories are managed and moved around by conveyor system or forklifters. With increasing popularity of eCommerce, it is increasingly important to effectively manage the inventories. With Amazon Robotics, items are stored on portable storage units, as shown in the picture above. Amazon robots are way much more efficient and less error-prone than the traditional method.

This is how the robots operate:
When an order is entered into the database system, the software analyzes all of the items in the order and locates the closest robot to the each of the item and directs the robot to retrieve the item. The robots are controlled by a centralized computer with secured WiFi network for communication. The robots move by following the QR codes on the floor and have sensors inside to avoid collision. They also have powered wheels that allow them to rotate and move around.

When the robot reaches the target location, it slides underneath the pod/rack and lifts the pod/rack off the ground through corkscrew action. Then, the robot carries the pod back to the human operator to pick the items and returns the pod back.

Amazon has two types of robots: the "G" drive for light pods weighing up to 750 pounds and the "S" drive for larger racks and pallets weighing up to 3,000 pounds. Both kinds of robots are designed to operate on rotating schedule for 60 minutes and then to be recharged for 5 minutes.

The systems behind the robots are essential to how robots work. The sophisticated fulfillment system processes hundred of orders per second. When an order is placed, the system analyzes the shipping location and products, depending on the product type and availability. Also, the system assigns the priority to each product based on the customer's delivery preference. AmazonPrime same day shipping order has the highest priority, while a "Super Saver" order might wait a several hours before processed.  Once the priority is determine, the system sends order to robots to locate and move pods to assigned packing station.


--------------------------------------------------------------------------------------------------------------------------
Picture References:
1.https://www.google.com/search?q=amazon+robotics&biw=1280&bih=625&tbm=isch&source=lnms&sa=X&ved=0ahUKEwjNrurj-6bPAhXC24MKHU_KDMAQ_AUIDCgA#imgrc=BtRv2fLlZbf_XM%3A
2.https://www.google.com/search?q=amazon+robotics&biw=1280&bih=625&tbm=isch&source=lnms&sa=X&ved=0ahUKEwjNrurj-6bPAhXC24MKHU_KDMAQ_AUIDCgA#imgrc=mNBuqcz1JaweIM%3A
Writing References:
1. https://en.wikipedia.org/wiki/Amazon_Robotics
2. http://www.informationweek.com/strategic-cio/amazon-robotics-iot-in-the-warehouse/d/d-id/1322366


--------------------------------------------------------------------------------------------------------------------------
Check the video below for how Amazon Robotics work!

Wednesday, September 14, 2016

Zootopia - Fur technology makes Zootopia's animal believable



This is the last post about computer graphics and I want to ended it with my third favorite Disney movie- Zootopia. It tells a stony about anthropomorphized animals trying to realize their dreams and living in a metropolitan city. The movie is a comedy but also sheds lights on race relations and diversity.

Were you impressed by the fur of all the animals by real they all look? Animal means fur. In fact, one Animal in Zootopia Has More Individual Hairs Than Every Character in Frozen Combined.

Similar to how disney studies water waves in Finding Nemo, the Zootipia team are composed of directors, engineers and animators. They spent eight month studying animals and they went to San Diego's Safari Park, Disney's Animal Kingdom and all the way to Kenya to observe their movements and habits. To make look real, the team went to Natural History Museum and studied fur under a microscope and under lighting setups.


To make the animals look realistic, Disney's trusty team of engineers introduced iGroom, a fur-controlling tool that had never been used before. The software helped shape about 2.5 million hairs on the leading bunny and about the same on the fox. A giraffe in the movie walks around with 9 million hairs, while a gerbil has about 480,000 (even the rodent in the movie beats Elsa's 400,000 strands in Frozen).

The software gave animator so much more flexibilities that they could easily brush, shade and brush the fur. iGroom iterates very quickly and this immediate feedback enables the team to play around to achieve the effect they want. 


Next week - Robotics at Amazon 
--------------------------------------------------------------------------------------------------------------------------

Picture References:
1.https://www.engadget.com/2016/03/04/fur-technology-makes-zootopias-bunnies-believable/
2.http://fusion.net/story/275485/zootopia-police-racism-race-relations-commentary/
Writing References:
1. One Animal in Zootopia Has More Individual Hairs Than Every Character in Frozen Combined- http://io9.gizmodo.com/one-animal-in-zootopia-has-more-individual-hairs-than-e-1761542252
2. The fur-reaching tech of Zootopia- https://www.fxguide.com/featured/the-fur-reaching-tech-of-zootopia/

--------------------------------------------------------------------------------------------------------------------------

Another reason that I like Zootopia is their DMV scene. Have you ever been frustrated with the inefficiency at DMV? Everytime I go to DMV, the experience is painful and it seems like I need to wait there forever. Zootopia followed the comedy principle and famously slow sloths runs DMV in the movie.

Friday, September 9, 2016

Finding Nemo - The art of computer animation and water flow simulation


Last post discussed the snow simulation in Frozen, which is my favorite movie. 

As a Disney enthusiast, I will continue the discussion of computer graphics with the example of Finding Nemo(my second favorite movie) and explore the art of computer animation. John Lasseter, the executive producer of the film, said:“This movie absolutely raises the bar for Pixar and for the art of computer animation... The film is breathtakingly beautiful and filled with real drama, real emotion and depth, as well as great comedy."

Compared to the challenge of snow simulation Frozen, the biggest challenge in Finding Nemo was water flow simulation. First of all, the actions, textures and other details of water flow are hard to describe in English language and the staff at Disney had to invent new vocabularies in order to communicate. In addition, Disney invited scientists to present lectures on wave, swells and other motions. The team member even took a trip to Hawaii to study the water and sea life. 

Finally, water simulation was achieved by pioneering the new techniques in digital lighting, which were used to create realistic-looking water. Digital lighting is a technique that brightens evert scene in the same way as stage lighting. It further presents the emotion of each scene and better defines key, fill and bound lights. 

Key, fill, and bounce lights and room ambience are all defined and used to enhance the mood and emotion of each scene. Lighting takes its inspiration from the moody color scripts created by the art department. The underwater setting with lighting effect 

The water simulation technique was so realistic that the team decided to push back and de-emphasize to make the film more cartoony.


--------------------------------------------------------------------------------------------------------------------------
Picture References:
1. https://www.google.com/search?q=Finding+Nemo&biw=1280&bih=583&source=lnms&tbm=isch&sa=X&ved=0ahUKEwiL0LmjtoLPAhUDZCYKHdl5CW0Q_AUIBygC&dpr=2#imgrc=4MsDpdUl--_MpM%3A
2. https://www.google.com/search?q=finding+nemo+animation+disney&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjLwarktoLPAhVLPCYKHUnjCnMQ_AUICSgC&biw=1280&bih=583#imgrc=dc-kQA_h1JgL9M%3A

Writing References:
1. Use of Technology - http://pixar-animation.weebly.com/use-of-technology.html
2. The Making of Finding Nemo - http://www.cgsociety.org/index.php/CGSFeatures/CGSFeatureSpecial/
the_making_of_finding_nemo
3. Finding the Right CG Water and Fish in 'Nemo' - https://renderman.pixar.com/view/computer-graphics-at-walt-disney-animation

--------------------------------------------------------------------------------------------------------------------------
If you like Finding Nemo as much as I do, you can actually realize the dream of living with Nemo at Finding Nemo Rooms at Disney Art Of Animation Resort in Walt Disney World.  See below for the picture of the room.