Posts

Showing posts with the label Python

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

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