↓ Skip to main content

stakepd.profit

144 words·1 min
spd.profit(stakes, odds, odds_type)

Calculates the profit from a bet or a Series of bets. Profit = Payout − Stake.

Parameters:

  • stakes (float, int, or pandas.Series): Scalar or Series of stake/bet values.
  • odds (float, int, or pandas.Series): Scalar or Series of odds in odds_type format. Must match the type of stakes (scalar or Series of the same length).
  • odds_type (str): Type of odds provided. Supported values are 'decimal', 'fractional', 'american', and 'implied_probability'.

Returns:

  • float: Profit of the bet, or
  • pandas.Series: Series of profit values with the same length as stakes and odds.

Example (scalar):

import stakepd as spd

stakes = 100
odds = 2
profit = spd.profit(stakes, odds, 'decimal')
print(profit)
100

Example (Series):

import pandas as pd
import stakepd as spd

stakes = pd.Series([100, 50, 10])
odds = pd.Series([2.0, 3.0, 1.5])
profits = spd.profit(stakes, odds, 'decimal')
print(profits)
0    100.0
1    100.0
2      5.0
dtype: float64