Group Details Private


  • Kian Lee Teo

    Stock oversold, but market is bearish.

    posted in Investments read more
  • Kian Lee Teo

    Inline Functions

    The inline functions are a C++ enhancement feature to decrease the execution time (lower latency) of a program. Functions can be instructed to compiler to make them inline so that compiler can replace those function definition wherever those are being called. Compiler replaces the definition of inline functions at compile time instead of referring function definition at runtime.


    1. It speeds up your program by avoiding function calling overhead.
    2. It save overhead of variables push/pop on the stack, when function calling happens.
    3. It save overhead of return call from a function.
    4. It increases locality of reference by utilizing instruction cache.
    5. By marking it as inline, you can put a function definition in a header file (i.e. it can be included in multiple compilation unit, without the linker complaining)


    1. It increases the executable size due to code expansion.
    2. C++ inlining is resolved at compile time. Which means if you change the code of the inlined function, you would need to recompile all the code using it to make sure it will be updated
    3. When used in a header, it makes your header file larger with information which users don’t care.
    4. As mentioned above it increases the executable size, which may cause thrashing in memory. More number of page fault bringing down your program performance.
    5. Sometimes not useful for example in embedded system where large executable size is not preferred at all due to memory constraints.

    When to use

    Function can be made as inline as per programmer need. Some useful recommendation are mentioned below-

    1. Use inline function when performance is needed.
    2. Use inline function over macros.
    3. Prefer to use inline keyword outside the class with the function definition to hide implementation details.

    posted in Technology read more
  • Kian Lee Teo

    Difference between Implied Volatility &. Historical Volatility

    • Implied or projected volatility is a forward-looking metric used by options traders to calculate probability.
    • Implied volatility, as its name suggests, uses supply and demand, and represents the expected fluctuations of an underlying stock or index over a specific time frame.
    • With historical volatility, traders use past trading ranges of underlying securities and indexes to calculate price changes.
    • Calculations for historical volatility are generally based on the change from one closing price to the next.

    posted in Investments read more
  • Kian Lee Teo

    Implied Volatility

    Implied volatility is the parameter component of an option pricing model.

    Not directly observable, so it needs to be solved using the five other inputs of the model:

    • the market price of the option
    • the underlying stock price
    • the strike price
    • the time to expiration
    • the risk-free interest rate

    posted in Investments read more
  • Kian Lee Teo

    Historical Volatility
    Historical volatility (HV) is a statistical measure of the dispersion of returns for a given security or market index over a given period of time. This measure is calculated by determining the average deviation from the average price of a financial instrument in the given time period. Using standard deviation to calculate historical volatility. The higher the historical volatility value, the riskier the security.

    posted in Investments read more
  • Kian Lee Teo

    1. Install Cygwin (

    2. Install Required Cygwin Packages

    C:\cygwin64>setup-x86_64.exe -q -P wget -P gcc-g++ -P make -P diffutils -P libmpfr-devel -P libgmp-devel -P libmpc-devel

    3. Download, Build and Install the Latest GCC

    Open a Cygwin terminal

    tar xf gcc-9.1.0.tar.gz

    That will create a subdirectory named gcc-4.9.2. Next, we’ll configure our GCC build.

    mkdir build-gcc
    cd build-gcc
    ../gcc-9.1.0/configure --program-suffix=-9.1.0 --enable-languages=c,c++ --disable-bootstrap --disable-shared

    Next, we’ll actually build the new GCC compiler suite, including C, C++ and the standard C++ library. This is the longest step.

    make -j4

    The -j4 option lets the build process spawn up to four child processes in parallel.

    Once that’s finished, install the new compiler:

    make install
    cd ..

    posted in Technology read more
  • Kian Lee Teo

    The Google Edge TPU coprocessor has support for TensorFlow Lite, or ‘machine learning at the edge’. The point of TensorFlow Lite isn’t to train a system, but to run an existing model.

    posted in Technology read more
  • Kian Lee Teo

    Different ways to iterate over rows in a Pandas Dataframe — performance comparison

    • Column operation and apply are both relatively fast
    • Select using at() and iat() is faster than loc()
    • Location-based indexing on numpy array is faster than locating-based indexing on a pandas dataframe

    • zip() is relatively fast for small dataset - even faster than apply() for N < 1000
    • iat() and at() indexing can be 30 times faster than loc()
    • loc() is slower than expected even when access using the index

    • If I cannot achieve what I want using column operation or apply(), I will use zip() instead (not iterrows()!)
    • I will avoid using loc() for updating or access single value, use iat() and at() instead
    • Consider extracting the underlying values as a numpy array then perform the processing/analysing

    posted in Technology read more
  • Kian Lee Teo

    Change percent of rolling 5 secs window

    Panda's dataframe has an inbuilt function rolling where it provide rolling window calculations (non-exhaustively) such as:

    • mean
    • sum

    If we want to calculate the change percent of rolling 5 secs window,

    def rolling_chgpct(dataset):
      if len(dataset) == 1:
        return np.nan
      first_data = dataset[0]
      last_data = dataset[-1]
      rchgpct = (last_data - first_data) / first_data
      return rchgpct
    # calculate chgpct of rolling 5 secs
    df['rchgpct'] = df.rolling('5s').apply(rolling_chgpct)

    posted in Technology read more

Looks like your connection to administrators group was lost, please wait while we try to reconnect.