Go to file
Gabe Appleton 376e67934d
General refactoring of code
2022-09-04 17:41:10 -04:00
.vscode Add some vscode stuff 2022-08-30 23:12:16 -04:00
src General refactoring of code 2022-09-04 17:41:10 -04:00
.gitignore Minor updates 2022-08-18 23:04:25 -04:00
.gitmodules Update dependencies 2022-08-01 16:39:45 -04:00
LICENSE Create LICENSE 2022-07-13 20:45:12 -04:00
MarketInfoBot.sqlite3 General refactoring of code 2022-09-04 17:41:10 -04:00
MarketInfoPersonal.sqlite3 General refactoring of code 2022-09-04 17:41:10 -04:00
Readme.md Update readme 2022-08-30 23:06:29 -04:00
daemon.sh General refactoring of code 2022-09-04 17:41:10 -04:00
example.json General refactoring of code 2022-09-04 17:41:10 -04:00
example_json.py General refactoring of code 2022-09-04 17:41:10 -04:00
requirements.txt Modify so pip won't freak out 2022-08-17 22:09:21 -04:00

Readme.md

Market Manager for Manifold

Currently Implemented

  • Resolve a market based on a GitHub PR
    • Both "does it merge" and "how long did it take to merge"
  • Resolve a market based on its close date and current answer
  • Resolve a market based on any logical combination of implemented rules
  • Resolve market randomly, like in a lottery
    • Several methods implemented, including:
    • Random value
    • Random index
      • Weighted or unweighted
      • Excluding early indices if wanted
      • Only including the first N indices if wanted
    • Can also specify the method, arguments yourself
  • Automatically formats rules for the market type
  • Before resolving a market, reach out on Telegram to confirm that's okay

Application Behavior

Every time you run example.py, it goes through the following steps:

  1. (TODO) If flagged, scan a JSON file
    1. For each entry:
      1. If it's a market creation request, add it to pending
      2. If it's an existing market, add it to markets
    2. Clear the file
  2. (TODO) Unless flagged otherwise, for each market in pending:
    1. Check your balance
    2. If it's less than M$100, break
    3. If it's less than the cost of this market, continue
    4. Create the market
    5. Add it to markets
    6. Remove it from pending
  3. If flagged, manually remove many markets from markets
  4. If flagged, manually add a market to markets
  5. Unless flagged otherwise, for each market in markets:
    1. If the time is before last_checked + check_rate and refresh is not flagged, continue
    2. If the market does not meet the resolution criteria, continue
    3. Ask the operator what action to take (either via Telegram or the console):
      1. Cancel it, or
      2. Resolve to the suggested value, or
      3. Do nothing
    4. Update check time

Database Spec

  • markets
    • id: INTEGER
    • market: A serialized python object with the relevant rules
    • check_rate: REAL, the minimum number of hours between checks
    • last_checked: TIMESTAMP, the time it was last checked (or NULL)
  • pending
    • id: INTEGER
    • priority: REAL, lower means you get created sooner
    • cost: INTEGER, cost in mana to create, lower means you get created sooner
    • request: A serialized python object with the relevant rules and info

Immediate Goals

  • Testing for the API bindings by spinning up a dev node of Manifold
  • Resolve based on passage of a US law
  • Automatic creation of a market when a Pull Request is made
  • A way to queue creation of markets for when account has enough mana

Future Goals

The goal of this project is to make a Manifold agent that can manage various forms of markets. Currently targeted are:

  1. Mirror markets on another service
    • Include ability to do this for future markets via regex or tag matching
    • Example: Election markets
  2. Future Discount Markets
    • Automatically make markets that resolve at a variety of different dates
    • Offer a link that charts the future discount based off of these markets
  3. Ethereum/Python Improvement Proposals
    • Automatically make markets for whether a PEP or EIP is accepted
    • Resolve when the associated issue has been closed for some amount of time
    • Might be able to just resolve to round(MKT), honestly
      • Maybe use this instead as a flag for error, if ex: pull request accepted but round(MKT)=0, flag for attention
    • Actually, this might look like a generic Pull Request -> Manifold Market bridge
      • If so, make some for every Manifold PR
  4. Box Office Futures Markets
    • Note that this could include Rotten Tomatoes scores as well
    • Feels easily queryable
    • Feels like movies from major studios could be fetched fairly easily
  5. Rotten Tomatoes Markets
  6. Markets for OSM campaigns and bounties
  7. Conditional Markets
  8. Does a US Congress bill pass?

How to Run/Contribute

  1. First, make sure you are running Python >= 3.7
  2. Load the submodules
  3. Run pip install -r requirements.txt
  4. Make a file called env.sh. It should contain 5 exports
    1. GithubAPIKey: The API key for reading GitHub issues and pull requests. Strictly speaking not needed, so long as you don't use GitHub rules, but the underlying script will check that this exists.
    2. ManifoldAPIKey: The API key for managing your Manifold markets. See here for instructions on how to retrieve it.
    3. TelegramAPIKey: The API key for your Telegram bot. For more info, see here
    4. TelegramChatID: The chat ID between your Telegram bot and you. For more info, see here
    5. DBName: The name of your database file
  5. Add your first markets using the arguments provided in example.py. Each market needs at least one DoResolveRule and at least one ResolveToRule. The simplest ResolveToRule is --poll. The simplest DoResolve rule is --rel-date. More complicated markets may need to have rules constructed manually.
  6. When you've added all your markets, modify the polling frequency in daemon.sh, then run it