What are Call and Put Options

Probir Banerjee
Updated on 04-Oct-2021 09:09:47

393 Views

Options are "derivative investments", meaning the price movements of the investments are based on the price movements of another financial product. The financial product from which the derivative is obtained is called the "underlying."Call and Put OptionsOptions are contracts that provide the buyer the right to buy or sell an underlying asset, at a predetermined price and before a specific date.A call option is bought by a trader if the investor expects the price of the underlying to rise within a certain time frame.A put option is bought by a trader if he/she expects the price of the underlying to ... Read More

Find Minimum Deletion Cost to Avoid Repeating Letters in Python

Arnab Chakraborty
Updated on 04-Oct-2021 08:50:25

711 Views

Suppose we have a string s and another array of integers called cost where cost[i] represents the cost of deleting the ith character in s. We have to find the minimum cost of deletions such that there are no two same letters next to each other. We have to keep in mind that that we will delete the chosen characters at the same time. So after deleting a character, the costs of deleting other characters will not change.So, if the input is like s = "pptpp", cost = [2, 3, 4, 5, 2], then the output will be 4 because ... Read More

Find Number of Ways Where Square Equals Product of Two Numbers in Python

Arnab Chakraborty
Updated on 04-Oct-2021 08:39:40

227 Views

Suppose we have two arrays nums1 and nums2, we have to find of triplets formed (type 1 and type 2) following these two rules −Triplet (i, j, k) if nums1[i]^2 = nums2[j] * nums2[k] where [0

What Does Strike Price Mean in Option Contracts

Probir Banerjee
Updated on 04-Oct-2021 08:27:05

250 Views

What is a Strike Price?In the case of an option contract, the "strike price" is the predetermined and agreed-upon price at which a specific security may be bought (by the call option holder) or sold (by the put option holder) until or upon the expiration of the contract. The term "strike price" is also termed as "exercise price."Options are derivatives that offer their buyers a right, or an option—but not an obligation—to buy or sell a security, such as a stock at a specific price (or the strike price) until or on a certain date (the expiration date).Buying or selling ... Read More

Find Shortest Subarray to Remove for Sorted Array in Python

Arnab Chakraborty
Updated on 04-Oct-2021 08:12:57

309 Views

Suppose we have an array called arr, we have to remove a subarray of arr such that the remaining elements in arr are in non-decreasing order. We have to find the length of the shortest subarray to remove.So, if the input is like arr = [10, 20, 30, 100, 40, 20, 30, 50], then the output will be 3 because we can remove [100, 40, 20] which is smallest subarray of length 3, and by removing these all are in non-decreasing order [10, 20, 30, 30, 50].To solve this, we will follow these steps:n := size of arrarr := insert ... Read More

Find Number of Ways to Split a String in Python

Arnab Chakraborty
Updated on 04-Oct-2021 08:02:11

439 Views

Suppose we have a binary string s we can split s into 3 non-empty strings s1, s2, s3 such that (s1 concatenate s2 concatenate s3 = s). We have to find the number of ways s can be split such that the number of characters '1' is the same in s1, s2, and s3. The answer may be very large so return answer mod 10^9+7.So, if the input is like s = "11101011", then the output will be 2 because we can split them like "11 | 1010 | 11" and "11 | 101 | 011".To solve this, we will ... Read More

Find Maximum Length of Subarray with Positive Product in Python

Arnab Chakraborty
Updated on 04-Oct-2021 07:47:16

302 Views

Suppose we have an array called nums, we have to find the maximum length of a subarray where the product of all its elements is positive. We have to find the maximum length of a subarray with positive product.So, if the input is like nums = [2, -2, -4, 5, -3], then the output will be 4 because first four elements are forming a subarray whose product is positive.To solve this, we will follow these steps :Define a function util() . This will take s, eneg := 0ns := -1, ne := -1for i in range s to e, doif ... Read More

Density Plots with Pandas for a Specific Attribute

AmitDiwan
Updated on 04-Oct-2021 07:42:33

629 Views

We will use plot.density() to density plot on a Dataset in the form of a csv file. Let’s say the following is our dataset − Cricketers2.csvAt first, import the required libraries −import pandas as pd import matplotlib.pyplot as pltLoad data from a CSV file into a Pandas DataFrame −dataFrame = pd.read_csv("C:\Users\amit_\Desktop\Cricketers2.csv") Plotting the density plot. Attribute considered is "Age" −dataFrame.Age.plot.density(color='green')ExampleFollowing is the complete code −import pandas as pd import matplotlib.pyplot as plt # Load data from a CSV file into a Pandas DataFrame dataFrame = pd.read_csv("C:\Users\amit_\Desktop\Cricketers2.csv") # plotting the density plot # attribute considered is "Age" dataFrame.Age.plot.density(color='green') plt.title('Density ... Read More

Draw Vertical Violinplot Grouped by Categorical Variable with Seaborn

AmitDiwan
Updated on 04-Oct-2021 07:39:55

584 Views

Violin Plot in Seaborn is used to draw a combination of boxplot and kernel density estimate. The seaborn.violinplot() is used for this. We will plotti violin plot with the columns grouped by a categorical variable.Let’s say the following is our dataset in the form of a CSV file − Cricketers.csvAt first, import the required libraries −import seaborn as sb import pandas as pd import matplotlib.pyplot as pltLoad data from a CSV file into a Pandas DataFrame −dataFrame = pd.read_csv("C:\Users\amit_\Desktop\Cricketers.csv") Plotting violin plot with Role and Age grouped by a categorical variable −sb.violinplot(x = 'Role', y = "Age", data = dataFrame)ExampleFollowing ... Read More

Draw a Bar Plot and Set Error Bars with Seaborn in Python Pandas

AmitDiwan
Updated on 04-Oct-2021 07:37:07

942 Views

Bar Plot in Seaborn is used to show point estimates and confidence intervals as rectangular bars. The seaborn.barplot() is used. Set caps to the error bars using the capsize parameter.Let’s say the following is our dataset in the form of a CSV file − Cricketers2.csvAt first, import the required libraries −import seaborn as sb import pandas as pd import matplotlib.pyplot as pltLoad data from a CSV file into a Pandas DataFrame −dataFrame = pd.read_csv("C:\Users\amit_\Desktop\Cricketers2.csv") Set caps to the error bars using the capsize parameter −sb.barplot(x=dataFrame["Role"], y=dataFrame["Matches"], capsize=.3)ExampleFollowing is the code −import seaborn as sb import pandas as pd import matplotlib.pyplot ... Read More

Advertisements