Posts

When Zipline Gets Stuck

Image
I stumbled across this Analytics Vidhya article by Sabir Jana How to Import Indian equities Data to zipline on your local machine? and after more than 2 years I was tempted to give it a shot once again. Jana's post specifically addressed the roadblock that prevented most Indians from using the library. Zipline, after all, is the retail industry standard when it comes to backtesting in Python. Entire books are devoted to it, and all other backtesters are considered a distant second. Jana's article is well written, and code is not just easy to follow, it's very well written. (There is a problem with tabs in the medium post, and indentation isn't clear because of the font used, so I used this version instead.) However as soon as I was done fetching BSE data from Quandl and ready to feed it to Zipline, I ran into a new hurdle: Zipline just absolutely refused to install! The error message overflowed the terminal's buffer and I had to route the output to a log file, on...

Lenovo IdeaPad 320 15AST Battery issue

Image
It started out as a small kink: the palm rest to the left of the trackpad swelled up a little. I knew that it was a battery issue. I opened the back cover, visually verified my hunch but it looked benign, and I had used swollen Li-Po cells in drones which work fine until they stopped charging. And the laptop was working fine so I ignored it. But it got worse very gradually and I did not realize it until the plastic cracked. It looked gnarly, but there was no issue with any functional aspect of the computer. Opened the back cover and noted the battery part number: L16C2PB1. Searched for the part number on Amazon and Flipkart, but it was out of stock everywhere. The laptop was still fully functional so I ignored it again. And one fine day I started the machine and half the keyboard wasn't responding. Opened the machine again, only to discover that keyboards aren't built like they used to be, there are no copper contact pads, and the rest of the motherboard is mounted in a way tha...

Notes on Google Authentication with Flask

There are many ways to set up Google Authentication with Flask. I found 3 self-contained guides using completely different methods, and I played with all 3 to find their strong points and problems. This blog documents those observations: 1. Create a Flask Application With Google Login Why you should try this: good explanations that help you understand the OAuth workflow part of Real Python's larger Flask tutorial. Although I did not use it, it might be good to see how it fits into the larger framework uses [flask-login](https://github.com/maxcountryman/flask-login) module which counts Flask personalities like David Baumgold and Miguel Grinberg as contributors, so current implementation as well as future developments are/will be tightly integrated with the Flask framework Why you might not end up using this implementation: simpler ...

Notes on Flask

Flask with AJAX For those well versed with Flask and AJAX this is nothing new, but for newcomers to both/either, the following code snippet is a quick start introduction to using AJAX with Flask on their websites. Python Flask + JavaScript XMLHttpRequest. There are a large number of tutorials and examples out there, but this one helped me the most because of its simplicity. It uses plain JavaScript instead of JQuery or any other framework, and given my incremental style of development, and "Mistake Driven Learning" style of learning, this was my starting point for the MarketDB project. Eschewing JSON In the current stage, I am avoiding using JSON as much as possible for three conscious reasons: (1) less learning required to handle JSON in JavaScript and Python. I know this is just laziness, and I already do know the basics of JSON in both languages, but using it in a production project requires deeper dive into the standards, which is really not necessary. Lists suffice for ...

Theme-ing Lektor

Documented steps for changing theme: https://www.getlektor.com/docs/themes/installing/ So first I create a local directory in project root to hold all Lektor themes mkdir themes then I cloned a theme into that folder git clone https://github.com/Andrew-Shay/lektor-theme-simple-strap.git themes then I added a reference to that theme in the project config file: nano nitishshukla.com.lektorproject themes = lektor-theme-simple-strap #Ctrl+o, Enter, Ctrl+x, Enter now update repo git add . git commit git push origin master By this time there was already an error in Netlify: 12:51:55 AM: Error checking out submodules: fatal: No url found for submodule path 'themes' in .gitmodules 12:51:55 AM: Failing build: Failed to prepare repo 12:51:55 AM: Failed during stage 'preparing repo': Error checking out submodules: fatal: No url found for submodule path 'themes' in .gitmodules : exit status 128 This basically means that the theme that I cloned into [project]/...

Deploying Lektor project in GitHub over Netlify

Following instructions here: https://www.netlify.com/blog/2016/05/25/lektor-on-netlify-a-step-by-step-guide/ Lektor project was created with the name: nitishshukla.com nano runtime.txt python 3.7.5 #Ctrl+o, Enter, Ctrl+x, Enter To find dependencies, we check Lektor on GitHub, and take entries from setup.py>install_requires, however https://github.com/nixjdm/lektor-netlify/issues/3 says we can just put "lektor" in that file. So nano requirements.txt lektor #Ctrl+o, Enter, Ctrl+x, Enter After this you are supposed to visit https://app.netlify.com , add your new site there, link the Netlify settings to the GitHub repo, go to GitHub and give Netlify the authority to modify files in the repo, then come back to Netlify and configure deployment parameters for your repo (which branch you will deploy, build directory, and build command.) Now you have all the moving parts in place, and you can build your project using Netlify. Only one catch: "runtime.txt" i...

Hello Website

This entry is relevant to the older method of hosting this blog. I have moved to Blogger.com since then, but keeping this note just in case/archival purposes. This website is a Lektor creation. It was created by Armin Ronacher, and you can read more about the anecdote for it here . My own personal website has been vagrant, sometimes a plain HTML sitting in Web 1.0 hosting service, just a sandbox for AJAX/MySQL scripts. The last avatar was a Gatsby (nodejs) static website served out of this very GitHub. But given my aversion to all forms and manners of JS frameworks, I went looking for the following: a simple site that can be regularly updated but doesn't need a complex CMS and can be hosted for free bonus marks if interesting to use Lektor checks all the boxes since it spins out a static site that has a simple blogging feature but works from my laptop (pseudo CMS) and saves output to GitHub bonus marks since it's a nifty use of Python Flask The author of...