2017-11-28

A Knowledge Processing Network for Robo-Advisors

by Mark Hsia
Robo-Advisor Knowledge Processing Network


Let’s see how to handle an incoming Forex financial news:


”The safe-haven yen and Swiss franc were higher, with USD/JPY sliding 0.41% to 112.01, just off the previous session's two-month peak of 112.72, while USD/CHF fell 0.21% to trade at 0.9687.Elsewhere, EUR/USD gained 0.20% to trade at 1.1965, while GBP/USD edged down 0.10% to 1.3569, off Monday's 15-month highs of 1.3620.”


Checked the sentences of this news, we found these keywords and phrases:
  • number and percentage
  • USD/JPY, USD/CHF, EUR/USD, GBP/USD
  • and, higher, sliding to, off peak of, fell to, gained to, edged down to, off highs of







figure : Financial knowledge stickers structure


Therefore, we should build various Knowledge Processing Units (KPUs) to handle numbers, symbols of Forex instruments and phrases of their movements. The first layer of KPUs handles words, the second layer of KPUs combines words to phrases and the last layers of KPUs processes the meaning of the sentences.


When a KPU finds the price of an forex instrument in the sentence, it should store this last price, change and date in memory and then computes all technical analysis indicators like Moving Average, Variance, RSI, MACD, Bollinger Band indicator,.. etc. Also, the KPUs can process correlation coefficients between various financial instruments.


The KPUs in charge of Robo-Advisor strategies should check the movements of the financial instruments to see how will they affect others and how much. Based on these predictions the final judgement of buying or selling financial instruments will be generated.


Also, the following rules should be defined:


- If the instrument A is up or down, then we should buy or sell what financial instruments and how many?
- What are mean-variances of all financial instruments?
- What are buying and selling points of all financial instruments?
- What is the optimal leverage ratio?


Financial Calculation Algorithms


Basic financial calculation algorithms like what I’ve implemented in the wealth management calculators website CubicPower.idv.tw  covering various aspects should also be included. Such as:


Time Value of Money:


Compounding
Discounting


Money generates interest in a saving account. So the money of the present time will be worth more than the same amount of money in the future. To interchange the values of two periods, compounding is used to convert present value to the future value of money and discounting is to convert the future money to present value.


Assets Allocation:


Capital Allocation Line(CAL)
Asset Allocation with Stocks and Bonds
Asset Allocation with Minimum Variance
Asset Allocation Optimal Risky Portfolio
Expected Return Scenario Analysis





figure : Risk and return of three asset classes combination


We can use the above tools to calculate the risks and rewards of different combination ratios of three asset classes - equities, fixed income and cash equivalents. A Robo-Advisor is in charge of portfolio management of these assets. The idea of efficient frontier should also be built into it.


Annuity:


Annuity Future Value
Annuity Present Value
Period Investment
PVOA
Investment Return Rate


An annuity is a group of fixed amount of  cash flows within a period of time.  We can discount each individual flow into its present value and add them up to get the present value of the annuity. This is the  way to evaluate the annuity. We can calculate the present and future values of the annuity easily with these tools.


Stocks/Bonds:


Stock Evaluation Dividend Discounting
Current Bond Price
Coupon Bond Price
Coupon Bond Yield
Zero Coupon Bond Price


Bondholders receive a fixed amount of interest in every period. Therefore, bond prices will change when interest rates changed. When the interest rate goes down, bonds become more valuable, so their prices will go up.


Futures/Options:


Stock Index Futures Hedge
Futures Long Hedge
Futures Short Hedge
European Stock Options
European Future Options

2017-11-19

The Real Time Streaming Processing with Edge Computing Gateways

by Mark Hsia

An edge computing gateway plays multiple roles at the same time. It receives incoming data from the cloud, processes it and disseminates them to the local nodes. On the other hand, it collects data from local nodes, summarizes the data and send them to the cloud centers. Key components of the edge computing gateway are: a Complex Event Processor (CEP), an Message Queue (MQ) system and a fast real-time DataBase.






Streaming data

Streaming data is the data generated continuously from multiple sources. Normally these data come with arrival timestamps to process them sequentially. Since data keeps pouring into the system, so we have to use the sliding window technique to remove all expired data outside the sliding window. A typical example of streaming data is stock prices. Stock quotes, prices keep coming tick by tick. Each tick includes price, time stamp and other related information. Normally we keep these tick data in two places: the CEP sliding window and a database. The CEP processes data and throw them away, but a database always tries to keep them forever.

Tick by Tick data



Market data from the data feed is sent in a tick by tick way. A tick from the data feed must be shown on all users desktop immediately. The high frequency trading system applications usually expect a very low latency environment. Industry gateway could offer a service level of less than 10 us latency. Top-notch products made by FPGA can reach a level of 3 us latency.


Periodical Data: Minute Data

Periodical data like minute data, hourly data or even daily data could be generated from tick data in the sliding window. These types of data keep only the open, high, low, close data of each period. Therefore, converting data from tick to period can offer a very high compression rate.

Tick by Tick or Micro-Batch Processing

If a process can handle 1000 tasks per second. When we do a task with tick by tick basis, then the maximum throughput will be 1000 tasks/sec. If each task can handle one message, the throughput will be 1000 messages/sec.



But if we only do 100 tasks, but each task handles 20 messages, then the overall throughput becomes 2000 messages/sec. One task handles one message is a tick by tick process. One task handles multiple messages is a micro-batch process. The ratio of variable cost and fixed cost of a task decides which type of process performs better. The smaller ratio is the variable cost, and the micro-batch performance will be better.