↓ Skip to main content
All methods

stakepd.profit

Function → float or Series
Signature
spd.profit(stakes, odds, odds_type)

Calculate the profit of a bet, or of a Series of bets.

Profit is what you gain if the bet wins: profit = payout - stake.

Parameters

stakes:float, int or pandas.Series
A stake, or a Series of stakes.
odds:float, int or pandas.Series
Odds in odds_type format. Must be a scalar if stakes is a scalar, or a Series of the same length if stakes is a Series.
odds_type:{'decimal', 'fractional', 'american', 'implied_probability'}
Format of odds.

Returns

float
The profit, if stakes and odds are scalars.
pandas.Series
Profits, if stakes and odds are Series. Same length as the inputs.

See also

stakepd.payout
Payout including the stake.
stakepd.kelly_criterion
Calculate how much to stake on a positive-EV bet using the Kelly criterion.

Examples
#

import pandas as pd
import stakepd as spd

Scalar:

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

Series:

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

American odds:

stakes = pd.Series([100, 50, 10])                 # Series of betting stakes
odds = pd.Series([100, -200, 300])                # American odds for each stake
profits = spd.profit(stakes, odds, 'american')
print(profits)
Output:
0    100.0
1     25.0
2     30.0
dtype: float64

This method is also covered, alongside the rest of the module, in the overview guide.