Julian's Notes


  • Home

  • Archives

  • Tags

Bollinger Band

Posted on 2017-04-05
Reading time 1
Developed by John Bollinger, the Bollinger Band shows the price of the stock with an upper and lower band (standard deviation) shown with a 21-day simple moving average. Standard Deviation is a model of volatility. larger volatility is presented with a larger band (more room for growth, but equally for loss) smaller band means less volatile. Oversold & Overbought Some people believe that: as the price of the stock moves to the upper band == Overbought the more it moves to the lower band == Oversold The Squeeze When the bands contract, this is called a squeeze. period of lower volatility many take as a signal for future increased volatility and trading When the bands move further apart larger risk for them to move apart again may be a good time to exit a trade. These conditions are not trading signals. They don’t indicate when the change will take place, or the direction they’ll move. The math Bollinger Bands consist of: an N-period moving average (MA) an upper band at K times an N-period standard deviation above the moving average (MA + Kσ) a lower band at K times an N-period standard deviation below the moving average (MA − Kσ) N and K are usually 20 and 2. Other averages can be used, such as the exponential moving average. Effectiveness A 2007 study that spanned from 1995 to 2005 showed no evidence of consistent performance over the standard “buy and hold” approach, but a “contrarian Bollinger Band” (reversal of the...
Read more »

Auto-generating Gantt charts for a method

Posted on 2017-04-05
Reading time 4
While working on timing the performance of Bundler, I noticed that Gantt charts are an effective way to visualize slowness. Working off of this theory, I automated the generation of the charts using Mermaid. The resulting chart data can be plugged into this online editor, or you can generate it using the Mermaid library yourself. # We use a global aggregate cache to allow us to track methods within a loop all at once $timed = {} at_exit do $timed.each do |method_name, timed_hash| # Output mermaid syntax for gantt title_file = timed_hash[:path].gsub(ENV['GEM_HOME'], '').gsub(ENV['HOME'], '') puts "gantt" puts " title file: #{title_file} method: #{method_name}" puts " dateFormat s.SSS\n\n" curr_time = 0.000 # Aggregate the lines together. Loops can cause things to become unweildly otherwise @grouped_lines = timed_hash[:entries].group_by { |line| [line[:line], line[:line_no]] } @grouped_lines.each do |(group_name, _line_no), group| # If we have run more than once, we should indicate how many times something is called entry_name = group.size > 1 ? "#{group_name} (run #{group.size} times)" : group_name entry_name = entry_name.tr('"', "'").tr(",", ' ') # Mermaid has trouble with these # Total time for all entries to run total_time = group.collect { |e| e[:time] }.inject(:+) time = total_time < 0.001 ? 0.001 : total_time # Output the line post_time = time + curr_time puts format(" \"#{entry_name}\" :a1, %.3f, %.3f", curr_time, post_time) curr_time = post_time end puts "\n\n" end end def gantt_chart ret = nil # Determine the method and path that we're calling from call_loc = caller_locations.reject { |l| l.path.include?('byebug') }.first method_name =...
Read more »

Kubernetes

Posted on 2017-04-05
Reading time 1
Kubernetes is an orchestration layer to manage containerized applications. In a traditional system, you either run on bare metal or with containers on a host. With Kubernetes, containerized applications and services can be spread across many hosts. This means if one host goes down, the work and containers can be redistributed to other nodes. Example: Each node can contain random services, or it can contain specific ones. In the example above, a node contains one of every service required to run an application. This means that if a node goes down, the work can be redistributed to other nodes, without any downtime, while Kubernetes also works on bringing that node back to life. Glossary Borrowed from Karan Thukral Cluster – The set of machines you are running the application on Node – A single machine Pods – A group of containers that work together to achieve a certain task. Service – A way to externally expose (externally and internally) a set of pods that work together Labels – An arbitrary tag that can be places on kubernetes resources and can be used to filter on Selectors – Way for the user to identify a set of objects based on labels assigned to them Controller – A reconciliation loop that drives current state towards desired state
Read more »
1 2 3
Julian Nadeau

Julian Nadeau

Notes about various topics. Mostly computer science related.

23 posts
4 categories
14 tags
RSS
© 2018 Julian Nadeau
Powered by Jekyll
Theme - NexT.Mist