Python math.factorial()

The Python installation comes with its own library of functions. The factorial function math.factorial() is included with its math module. Math modules are part of the Python install code package. Math modules or functions such as factorial, square root, sine, and exponential may be used in Python programs. To use them, the import command must … Read more

Python Black-Scholes Model and the Basics of Option Pricing

?Β Part I: Risk-neutral valuation, Monte Carlo integration vs. the Black-Scholes formula You can find the code in the GitHub repository for this article. The Black-Scholes (BS) pricing model is still a de facto standard method of pricing financial options. Even though there has been much research into improved and possibly more realistic models, the fact … Read more

The Quickselect Algorithm – A Simple Guide with Video

What is the Quickselect algorithm? The Quickselect algorithm is a computer algorithm designed to find the kth (e.g. smallest or largest) element from an unordered list. It is based on the idea behind the Quicksort algorithm, invented by the same author, Sir Charles Anthony Richard (Tony) Hoare. Here, k stands for the index of an … Read more

Bollinger Bands Algorithm – Python Binance API for Crypto Trading

A Bollinger Band consists of three lines: a simple moving average, an upper band, and a lower band. The assumption is that if the real price crosses over one of the bands, this can be seen as a signal to trade in or our of a given asset. For cryptocurrencies, breakout trades are more frequently … Read more

Moving Average Convergence Divergence (MACD) – Python Binance API for Crypto Trading

MACD is a trend-following momentum indicator used for trading. It consists of two lines: This article is based on the full trading tutorial on the Not-Satoshi blog. Introduction Before we begin, I would like to make a small request ##################### Disclaimer!! ################################### # The bots built here with python should be used only as a … Read more

Simple Moving Average (SMA) – Python Binance API for Crypto Trading

A simple moving average (SMA) is calculated by summing over a fixed number of last prices, say k, and dividing this by the number of prices k. Depending on the selection k, you can obtain short-term or long-term SMAs. Short-term SMAs respond quickly whereas long-term SMAs respond slowly to changes in the prices. You can … Read more

NumPy Sort [Ultimate Guide]

The np.sort(array) function returns a sorted copy of the specified NumPy array. Per default, it sorts the values in ascending order, so np.sort([42, 2, 21]) returns the NumPy array [2 21 42]. Here’s an example of 1D sorting: And here’s an example of 2D sorting — each axis is sorted separately. An example of 3D … Read more

[Cheat Sheet] 6 Pillar Machine Learning Algorithms

This machine learning cheat sheet gives you a visual overview of 6 must-know machine learning algorithms (and where to learn more). Linear Regression: train your linear model to predict output values. K-Means Clustering: apply it on unlabeled data to find clusters and patterns in your data. K-Nearest Neighbors: use a similarity metric to find the … Read more

Logistic Regression in Python Scikit-Learn

Logistic regression is a popular algorithm for classification problems (despite its name indicating that it is a β€œregression” algorithm). It belongs to one of the most important algorithms in the machine learning space. Linear Regression Background Let’s review linear regression. Given the training data, we compute a line that fits this training data so that … Read more

Random Forest Classifier with sklearn

Does your model’s prediction accuracy suck but you need to meet the deadline at all costs? Try the quick and dirty β€œmeta-learning” approach called ensemble learning. In this article, you’ll learn about a specific ensemble learning technique called random forests that combines the predictions (or classifications) of multiple machine learning algorithms. In many cases, it … Read more