Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New betting strategy for the academy #240

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kongzii
Copy link

@kongzii kongzii commented Mar 23, 2024

A new betting strategy migrated from https://github.com/gnosis/prediction-market-agent-tooling/blob/main/prediction_market_agent_tooling/tools/betting_strategies/market_moving.py.

The idea is simple: How much and on what outcome do we need to bet, if we want to move market's probability to X? (credits for original implementation to https://github.com/evangriffiths in our PMAT repository 🥇 )

Output from running example.py:

current_p_yes=0.91
target_p_yes=0.85, new_p_yes=0.00, bet_outcome_index=1, bet_amount=33032215489420764044200
target_p_yes=0.85, new_p_yes=0.00, bet_outcome_index=1, bet_amount=16516107744710382022100
target_p_yes=0.85, new_p_yes=0.00, bet_outcome_index=1, bet_amount=8258053872355191011050
target_p_yes=0.85, new_p_yes=0.00, bet_outcome_index=1, bet_amount=4129026936177595505525
target_p_yes=0.85, new_p_yes=0.01, bet_outcome_index=1, bet_amount=2064513468088797752762
target_p_yes=0.85, new_p_yes=0.03, bet_outcome_index=1, bet_amount=1032256734044398876381
target_p_yes=0.85, new_p_yes=0.10, bet_outcome_index=1, bet_amount=516128367022199438190
target_p_yes=0.85, new_p_yes=0.26, bet_outcome_index=1, bet_amount=258064183511099719095
target_p_yes=0.85, new_p_yes=0.50, bet_outcome_index=1, bet_amount=129032091755549859547
target_p_yes=0.85, new_p_yes=0.70, bet_outcome_index=1, bet_amount=64516045877774929773
target_p_yes=0.85, new_p_yes=0.81, bet_outcome_index=1, bet_amount=32258022938887464886
target_p_yes=0.85, new_p_yes=0.86, bet_outcome_index=1, bet_amount=16129011469443732443
target_p_yes=0.85, new_p_yes=0.84, bet_outcome_index=1, bet_amount=24193517204165598664
target_p_yes=0.85, new_p_yes=0.85, bet_outcome_index=1, bet_amount=20161264336804665553
---
current_p_yes=0.91
target_p_yes=0.95, new_p_yes=1.00, bet_outcome_index=0, bet_amount=33032215489420764044200
target_p_yes=0.95, new_p_yes=1.00, bet_outcome_index=0, bet_amount=16516107744710382022100
target_p_yes=0.95, new_p_yes=1.00, bet_outcome_index=0, bet_amount=8258053872355191011050
target_p_yes=0.95, new_p_yes=1.00, bet_outcome_index=0, bet_amount=4129026936177595505525
target_p_yes=0.95, new_p_yes=1.00, bet_outcome_index=0, bet_amount=2064513468088797752762
target_p_yes=0.95, new_p_yes=0.99, bet_outcome_index=0, bet_amount=1032256734044398876381
target_p_yes=0.95, new_p_yes=0.97, bet_outcome_index=0, bet_amount=516128367022199438190
target_p_yes=0.95, new_p_yes=0.95, bet_outcome_index=0, bet_amount=258064183511099719095

@kongzii
Copy link
Author

kongzii commented Mar 23, 2024

Based on the comment from https://github.com/valory-xyz/trader/pull/201/files, I executed

autonomy ipfs add

inside of trader/packages/kongzii/betting_strategies/market_moving_bet, but I'm getting this error:

Processing package: /Users/peter/Dropbox/Projects/Gnosis/trader/packages/kongzii/betting_strategies/market_moving_bet
Traceback (most recent call last):
  File "/Users/peter/Library/Caches/pypoetry/virtualenvs/trader-ZP1nLyMi-py3.10/bin/autonomy", line 8, in <module>
    sys.exit(cli())
  File "/Users/peter/Library/Caches/pypoetry/virtualenvs/trader-ZP1nLyMi-py3.10/lib/python3.10/site-packages/click/core.py", line 1126, in __call__
    return self.main(*args, **kwargs)
  File "/Users/peter/Library/Caches/pypoetry/virtualenvs/trader-ZP1nLyMi-py3.10/lib/python3.10/site-packages/click/core.py", line 1051, in main
    rv = self.invoke(ctx)
  File "/Users/peter/Library/Caches/pypoetry/virtualenvs/trader-ZP1nLyMi-py3.10/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/peter/Library/Caches/pypoetry/virtualenvs/trader-ZP1nLyMi-py3.10/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/peter/Library/Caches/pypoetry/virtualenvs/trader-ZP1nLyMi-py3.10/lib/python3.10/site-packages/click/core.py", line 1393, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/peter/Library/Caches/pypoetry/virtualenvs/trader-ZP1nLyMi-py3.10/lib/python3.10/site-packages/click/core.py", line 752, in invoke
    return __callback(*args, **kwargs)
  File "/Users/peter/Library/Caches/pypoetry/virtualenvs/trader-ZP1nLyMi-py3.10/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/peter/Library/Caches/pypoetry/virtualenvs/trader-ZP1nLyMi-py3.10/lib/python3.10/site-packages/aea_cli_ipfs/core.py", line 85, in add
    package_hash = register_package(ipfs_tool, dir_path, no_pin)
  File "/Users/peter/Library/Caches/pypoetry/virtualenvs/trader-ZP1nLyMi-py3.10/lib/python3.10/site-packages/aea_cli_ipfs/core.py", line 178, in register_package
    register_item_to_local_registry(
  File "/Users/peter/Library/Caches/pypoetry/virtualenvs/trader-ZP1nLyMi-py3.10/lib/python3.10/site-packages/aea_cli_ipfs/registry.py", line 150, in register_item_to_local_registry
    registry_data[f"{item_type}s"][str(public_id)] = str(package_hash)
KeyError: 'customs'

can someone give me an advice what to do, please?

@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the required package structure (see this as reference).
trader/packages/<author>/customs/<package_name>

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved, sorry I missed that. Is this repository-design decision, or is it enforced by the framework?

But, unfortunately, I'm still getting the error above :(

Processing package: /Users/peter/Dropbox/Projects/Gnosis/trader/packages/kongzii/customs/market_moving_bet
Traceback (most recent call last):
  File "/Users/peter/Library/Caches/pypoetry/virtualenvs/trader-ZP1nLyMi-py3.10/bin/autonomy", line 8, in <module>
    sys.exit(cli())
  File "/Users/peter/Library/Caches/pypoetry/virtualenvs/trader-ZP1nLyMi-py3.10/lib/python3.10/site-packages/click/core.py", line 1126, in __call__
    return self.main(*args, **kwargs)
  File "/Users/peter/Library/Caches/pypoetry/virtualenvs/trader-ZP1nLyMi-py3.10/lib/python3.10/site-packages/click/core.py", line 1051, in main
    rv = self.invoke(ctx)
  File "/Users/peter/Library/Caches/pypoetry/virtualenvs/trader-ZP1nLyMi-py3.10/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/peter/Library/Caches/pypoetry/virtualenvs/trader-ZP1nLyMi-py3.10/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/peter/Library/Caches/pypoetry/virtualenvs/trader-ZP1nLyMi-py3.10/lib/python3.10/site-packages/click/core.py", line 1393, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/peter/Library/Caches/pypoetry/virtualenvs/trader-ZP1nLyMi-py3.10/lib/python3.10/site-packages/click/core.py", line 752, in invoke
    return __callback(*args, **kwargs)
  File "/Users/peter/Library/Caches/pypoetry/virtualenvs/trader-ZP1nLyMi-py3.10/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/peter/Library/Caches/pypoetry/virtualenvs/trader-ZP1nLyMi-py3.10/lib/python3.10/site-packages/aea_cli_ipfs/core.py", line 85, in add
    package_hash = register_package(ipfs_tool, dir_path, no_pin)
  File "/Users/peter/Library/Caches/pypoetry/virtualenvs/trader-ZP1nLyMi-py3.10/lib/python3.10/site-packages/aea_cli_ipfs/core.py", line 178, in register_package
    register_item_to_local_registry(
  File "/Users/peter/Library/Caches/pypoetry/virtualenvs/trader-ZP1nLyMi-py3.10/lib/python3.10/site-packages/aea_cli_ipfs/registry.py", line 150, in register_item_to_local_registry
    registry_data[f"{item_type}s"][str(public_id)] = str(package_hash)
KeyError: 'customs'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants