-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce
fees
into AgentMarket itself (not just OmenAgentMarket) (#…
…506)
- Loading branch information
Showing
21 changed files
with
176 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -162,3 +162,5 @@ cython_debug/ | |
|
||
tests_files/* | ||
!tests_files/.gitkeep | ||
|
||
bet_strategy_benchmark* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from pydantic import BaseModel, Field | ||
|
||
|
||
class MarketFees(BaseModel): | ||
bet_proportion: float = Field( | ||
..., ge=0.0, lt=1.0 | ||
) # proportion of the bet, from 0 to 1 | ||
absolute: float # absolute value paid in the currency of the market | ||
|
||
@staticmethod | ||
def get_zero_fees( | ||
bet_proportion: float = 0.0, | ||
absolute: float = 0.0, | ||
) -> "MarketFees": | ||
return MarketFees( | ||
bet_proportion=bet_proportion, | ||
absolute=absolute, | ||
) | ||
|
||
def total_fee_absolute_value(self, bet_amount: float) -> float: | ||
""" | ||
Returns the total fee in absolute terms, including both proportional and fixed fees. | ||
""" | ||
return self.bet_proportion * bet_amount + self.absolute | ||
|
||
def total_fee_relative_value(self, bet_amount: float) -> float: | ||
""" | ||
Returns the total fee relative to the bet amount, including both proportional and fixed fees. | ||
""" | ||
if bet_amount == 0: | ||
return 0.0 | ||
total_fee = self.total_fee_absolute_value(bet_amount) | ||
return total_fee / bet_amount | ||
|
||
def get_bet_size_after_fees(self, bet_amount: float) -> float: | ||
return bet_amount - self.total_fee_absolute_value(bet_amount) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.