Update: I have provided the full code at algo-utils::options_vizualizer.py . 
 In the world of financial trading, understanding options volatility is crucial for making informed decisions. In this post, I’ll break down a Python script that visualizes options volatility for various market ETFs and indices. This tool leverages the volvisualizer library to generate insightful volatility…
In the fast-paced world of cryptocurrency trading, making informed decisions based on market data is crucial. Today, I want to share a Python tool I’ve built that helps select cryptocurrencies based on their trading volume - a key metric that can indicate market interest and liquidity. 
 Why Trading Volume Matters 
 Trading volume is one of the most important metrics when selecting…
Update: I have provided the full code at algo-utils::tasty_iron_condors.py 
 In this blog post, I’ll break down a Python program that screens for iron condor options trading opportunities using the TastyTrade API. The code retrieves options data, calculates metrics for iron condor spreads, and ranks the results to find potentially profitable trades. 
 What is an Iron Condor? 
…
Update: I have provided the full code at algo-utils::tasty_place_orders_manual_buy.py 
 In today’s fast-paced trading environment, automation can give you a significant edge. I’ve been working on a Python project that leverages the TastyTrade API to streamline various trading operations, from monitoring positions to setting automatic stop losses. In this post, I’ll walk…
Update: I have provided the full code at algo-utils::triple_momentum.py . 
 In the world of algorithmic trading, momentum strategies hold a special place for their simplicity and effectiveness. Today, I want to share a Python implementation of a “Triple Momentum” strategy that I’ve been working with. This approach allows you to dynamically switch between three different…
Update: I have provided the full code at algo-utils::google_api_helper . 
 Working with data often means juggling between different platforms and formats. Google Sheets is a powerful collaborative tool, but its real potential emerges when you can programmatically access and manipulate your spreadsheet data. In this post, I’ll walk through how to create a robust integration between Google…
Update: I have uploaded the code. You can find it here: algo-utils::dhan_place_orders_manual . 
 In today’s fast-paced financial markets, algorithmic trading has become increasingly accessible to retail investors. With the right tools and knowledge, you can automate your trading strategies and execute orders with precision. In this post, I’ll walk you through a comprehensive Python…
Update: I have provided the full code at backtrader-strategies-compendium::backtest.py . 
 A few days ago we saw how to build a simple backtesting framework for algorithmic trading using the backtrader Python library.
I showcased a special class called StrategyForComparison that allowed for a flexible trading approach with various risk management options.
Now let’s see how…
Update: I have provided the full code at backtrader-strategies-compendium . 
 If you’re serious about algorithmic trading and backtesting in Python, you’ve likely encountered Backtrader - an excellent framework that gives you the freedom to test trading strategies with historical data. Today, I want to walk through a comprehensive strategy implementation I’ve been working…
Update: I have provided the full code at algo-utils::logger.py . 
 Effective logging is a critical yet often overlooked aspect of application development. A well-implemented logging system can mean the difference between hours of frustrating debugging and a quick resolution when issues arise. In this post, I’ll walk through a powerful custom logging utility function called get_logger…
Update: I have provided the full code for this at algo-utils::util_files.py 
 File operations are the bread and butter of many Python applications. Whether you’re working with data processing, automation, or building robust applications, having a reliable set of utilities to handle files can save you countless hours of development time. 
 In this post, I’ll explore a versatile…
Many apps do not come pre-built in rpm format for Fedora so you’d have to download the tar file for it.
To run the app, you would have to go to the saved folder and then either double cilck or run the command through
command line. By default, that app won’t be accessible through the Super key’s universal search or
as a regular application in * Show Applications .…
While working on big projects, sometimes, you have invoke tasks lying around
in different places. It wouldn’t make sense to merge them together
but rather help each other out as and when needed. 
 One such way for this would be to search for invoke tasks from other folders
and run them directly when they can be used. 
 I had to go for this approach for a monolithic repo…
Systemd usually requires two files: 
 
 service file 
 timer file 
 
 Service files 
 Here you provide the details you’d use to 
 
 Start/stop a service 
 Define the type of service
 
 Can be simple , forking , oneshot , dbus , notify or idle 
 
 
 How to kill the service 
 Ability to restart 
 Path for starting up 
 Timeout…
Here’s a short tutorial on setting up gitlab cli for yourselves.
It is extremely user friendly and you can take almost any action that you need.
Anything that the UI provides is also available over cli or web services -
both of which have examples here. 
 Let’s get started. 
 gitlab cli 
 Installing the gitlab CLI 
 #…
Found it really strange that nobody had mentioned on their blog how to
compile Protobuf in python with C++ implementation. 
 I had been having a lot of trouble with the compilation of python protobuf.
After struggling with it for a few months on and off I decided to give Docker 
a try as I realized that my own Fedora OS may be the one having troubles.
Thought of starting with…
I recently started using Fedora for work and had to manage a lot of tasks on various projects.
The list was big enough and there’s no proper support for Evernote in linux, my trusty todo list manager
or ToDo list manager by AbstractSpoon. Decided to try post-it notes but my list was changing on an
ad-hoc basis. Finally came across an extension Todo.txt . 
 Turned out this was…
When you are working on Agile Boards in JIRA , you may want to retrieve
all the issues related to a particular board or the sprint.
Usually you’d find issues in progress under the dashboard of the sprint itself. 
 Python JIRA allows you only a few options: 
 
 incompleted issues 
 completed issues 
 removed issues 
 
 As you will also notice from jira docs…
Should you use getopt or getopts in your bash scripts? 
 The answer can be a bit tricky but mostly straight forward. 
 getopt 
 Generally, try to stay away from getopt for the following reasons: 
 
 External utility 
 Traditional versions can’t handle empty argument strings, or arguments with embedded whitespace 
 For the loops to work perfectly, you must provide…
Many a times I am grepping for a process that is running on a prod server with lots of different configuration
parameters. However, since there are so many of them, it is very difficult to view a particular parameter itself
and find out what value was assigned to it. I wanted to make it easier on the eyes and decided to color code the
parameters and separate them out from the…
It is quite easy to set up a local pypi server. 
 Some details can be found here .
You can also use devpi if you prefer but it
seems overly complicated for a job that is easily achieved by pip. 
 Let’s look at how to use pip for local installation.
Firstly, it is possible to install all requirements beforehand in a separate directory.
We can use the following…
Let’s explain the eight building blocks of any Angular 2 app: 
 
 Module 
 Component 
 Template 
 Metadata 
 Data Binding 
 Directive 
 Service 
 Dependency Injection 
 
 Module 
 
 Optional feature 
 Useful if you are using TypeScript which allows you to use interface or classes 
 export class AppComponent is like saying that this…
I recently needed to call a command whenever there was a push on my Github repo.
Since this was related to AWS tasks, I figured aws lambda is a good candidate.
Here I will talk about the steps I took to enable all of this using aws lambda, python.
As a side note, I will also elaborate on using API gateway to call upon the lambda itself. 
 In a nutshell, what I will talk about:
After installing spf13 vim every time I would open a file I had trouble with two things on my mac: 
 
 File opening would halt in the middle with the following error : Cannot find word list “en.utf-8.spl” or “en.ascii.spl” 
 Syntax highlighting also failed thereafter 
 
 Here’s what I would see: 
 $ vim release.sh 
 Warning: Cannot find…
Let’s take the example of my domain itself abhipandey.com that I want to serve from abhi1010.github.io .
We will need to do it in two steps: 
 
 Setup CNAME on github
 
 So that github knows about your domain 
 
 
 Setup A record on AWS Route 53
 
 So that domain can be registered 
 
 
 
 Change CNAME 
 If we want to tell github…
Note : If you are not sure of what you are doing here, don’t touch it.
This is all sensitive stuff and a minor mistake can bring down your production. 
 Sometimes, because of so many deployments happening and sharing volumes between dockers instances, the space runs out on production server. 
 I found some ways to fix this but the most brutal way to leave the orphaned directories…

 Powerline 
 
 

 I was having a lot of trouble getting powerline to work on my mac machine.
No matter what I tried, I was getting errors like the following: 
 .oh-my-zsh/themes/powerline.zsh-theme:100: character not in range
 
 Finally got it to work after multiple attempts on bash and zsh . 
 All I had to do was set LC_ALL to en_US.UTF-8 . It would set…
Experience with Gitlab CI 
 
 Git Mirror from Gitlab to Bitbucket using Gitlab CI 
 
 

 Had to move from BitBucket to Gitlab ; which is really great, btw. However, there was one tiny issue here - Gitlab was not supported by Shippable .
As you may know already Shippable is a hosted cloud platform that provides hosted continuous integration.
We use it in our current…
Recently had an interest in seeing how many LOC were committed to the code base over a particular period of
time. After some tinkering around, mainly to find out the correct format for time ranges, decided to use the following bash script for finding coding stats.
Following sample is to find out lines added or removed during the year 2014. 
 $ git log --after= '2014-1-1' --before=…

 Create your own blog 
 
 

 My blogging experience started with blogspot . It was great until I realized that I needed something that was responsive.
The layout looked nice on 1024x768 but with the new generation of screens it started to look narrow.
I hated the look of the website when it seemed that I was wasting a lot of white space on the web pages.
I moved to…
If you want to view what has changed since one commit to another, it is quite easy to view the diff. 
 git diff 5fad06c..0a504fa 
 You will get something like this: 
 diff --git a/modules/file_1.erb b/modules/file_1.erb
 index 0538da0..6621d93 100644
 --- a/modules/file_1.erb
 +++ b/modules/file_1.erb
 @@ -5,8 +5,8 @@
 
 // Algo settings
 'Carbo': {
 -…
We are going to talk about a setup where all you need to do it commit your code and all the rest of the steps from unit tests to deployment can be taken care of by some externally hosted cloud platform that provides continuous integration. 
In my case, it is going to be Shippable that I am using as a sample but you can use almost anything like TravisCI or codeship , for example.
If I am not wrong, nginx only allows you to upload up till max 2Mb of data by default. If you are doing a docker deployment on beanstalk you may to remember to change that not once but twice! 
 As you may know already, beanstalk creates an EC2 instance to manage the docker environment. 
Since EC2 needs to manage the docker environment and serve the web interface as well, it does so by…
While deploying docker multiple times, you may not want to copy over your Django source code every time you do a deployment. 
 Setting up supervisord 
 Luckily there is an easy way to manage this. Since you are working with Django , there is a good chance that you are also managing the processes (like uwsgi ) with supervisord . 
 Here are some of the steps that you can take with…
It may seem like a daunting task to have multiple python projects running in their own virtual environments in docker as you want to manage the running of the tasks from a single source - let’s say supervisord .
However, all that is required here is to know that python automatically picks up the location of the virtual environments if you provide full path to the virtual…
It is very easy to setup volume sharing in docker . You ideally want the following folders to be shared when a new docker is initialized for you: 
 
 /var/log so that you can keep track of logs 
 nginx specific folders because you will have two instances of nginx running - one on docker and another on EC2 . This allows you to share logs
 
 Also read this post for related info…
I recently wanted to setup a wiki so that I could convert it into a static html site with a proper themes.
What could be a possible use case for such a requirement: 
 
 Manage the documentation of a product internally through git but publish it for clients/world through static site 
 Convert the uncolored wiki to a themed version 
 Allow serving of the wiki through web…
Sometimes you may notice that old containers are not cleaned up from Beanstalk environment. This may be due to your container still running as a ghost on the background. One way to find out about this is to quickly look into your
 /var/lib/docker/vfs/dir directory whether it has too many folders. 
 Next, find out what container processes you have going on.
 [root@ip dir]# docker ps -a…
Welcome to Coders Digest! 
 I am Abhishek . I have been working in the financial industry for over 18 years now. 
 In my current blog I am putting up some articles that would be of interest to other developers. The blog is pretty widespread with topics ranging from C++ to Finance. Please feel free to correct me if something’s odd. You can start here: 
 https://github.com/abhi1010…
How do you partition a list around a value x, such that all nodes less than x come before all nodes greater than or equal to x? 
 Well, there are some solutions possible. The solution, I came up with, is a bit convoluted but let me tell the idea behind it. You want to track the following: 
 
 
 Two pointers to remember the beginning of the lower and higher series each
It is possible to a recursive solutions but I will use a simple runner logic. Recursive solutions are usually less optimal. 
 Note here that, in our logic K=1 would return the last element in the linked list. Similarly, K=2 would return the second last element. 
 The suggested solution here is to use two pointers: 
 
 One pointer will first travel K items into the list 
 Once…
Duplicates can be removed in many ways: 
 
 
 Create a new Linked List containing only unique items 
 
 
 Iterate through the Linked List and keep removing items that are being repeated 
 
 
 The internal structure itself for the algo can either be map or set based. When using map the Node itself can be saved thereby making your life easier if you are creating a…
Deleting a Node from Singly Linked List is rather straight forward. 
 
 
 You have to know the head first of all 
 
 
 Start by checking the head if that’s the one you are looking for 
 
 
 Keep moving forward and checking - always check for null pointers everywhere 
 
 
 Before we talk about the code, let’s see how Linked List is setup.…
What is wrong with the following code? 
 
 The issue is very simple but hard to notice. If you try to compile this, you will get the following errors: 
 main.cpp:24:5: error: need 'typename' before 'OuterStruct<T2>::InnerStruct' because 'OuterStruct<T2>' is a dependent scope
 OuterStruct<T2>::InnerStruct mUsingInner;
 ^
 main.cpp: In function 'int main(int, char**)':
…
Writing code using VIM can be a bit overwhelming but it helps creating a few shortcuts there to make your life easier. Here I will discuss a few. 
 
 First of all, it is always a good idea to set up your tabs and spaces 
 Set up shortcuts for: 
 Toggling of Auto-Indent while pasting source text; very useful in code ( F2 in my provided script) 
 Toggling of Auto-Scroll of Split…
I’ve had this need quite a few times to pull out a section of logs that would begin with a particular line and end with another. grep is not exactly useful there because it only prints out sections based on line counters (using -A/B/C) lines based on a single search pattern. 
 I came up with a script that can run at almost same speeds using grep/cat/awk . awk is used to decide whether…
When to use 64-bit? 
 If your application needs more than 2-4gb of data 
 
 If your application intensively uses 64-bit arithmetic 
 
 * 32-bit x86 compiled applications are restricted to x86 instruction set, even when run on on a 64-bit machine
 
 
 x64 supports 16 registers compared to just 8 in x86. If your code is computation intensive this may help a great deal…
Here’s a short snippet to split a string into multiple tokens; into a vector. As you will see that, if you run the code, boost version performs better because you can choose a number of delimiters to split your string instead of the vanilla version using the normal C++ code. Of course, you may also write your own code to do something like this but I was looking to do some short snippets.
I had written about sorting algorithms (Tag: Sorting ) with details about what to look out for along with their code snippets but I wanted a do a quick comparison of all the algos together to see how do they perform when the same set of input is provided to them. Hence I started working on a simple implementation for each one of them. I have now put together all of them in a single project on…
You must be knowing about regular VIM search 
 %s/SEARCH/REPLACE/CMD
 
 However, sometimes you do not want to replace something but just see all instances of the a word or phrase. In such cases, global search is really useful when on vim. The syntax is simpler than normal search-replace: 
 :[range]g[lobal]/{pattern}/[cmd]
 
 This will show all instances of the…