Update ReadMe and add sample sheet
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
3.9.18
|
||||||
@@ -31,39 +31,49 @@ The repository consists of several interconnected modules:
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
1. Clone the repository:
|
1. **Clone the repository**:
|
||||||
```
|
```
|
||||||
git clone https://github.com/yourusername/poly-maker.git
|
git clone https://github.com/yourusername/poly-maker.git
|
||||||
cd poly-maker
|
cd poly-maker
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Install Python dependencies:
|
2. **Install Python dependencies**:
|
||||||
```
|
```
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Install Node.js dependencies for the merger:
|
3. **Install Node.js dependencies for the merger**:
|
||||||
```
|
```
|
||||||
cd poly_merger
|
cd poly_merger
|
||||||
npm install
|
npm install
|
||||||
cd ..
|
cd ..
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Set up your environment variables by copying the example file:
|
4. **Set up environment variables**:
|
||||||
```
|
```
|
||||||
cp .env.example .env
|
cp .env.example .env
|
||||||
```
|
```
|
||||||
|
|
||||||
5. Edit the `.env` file with your credentials:
|
5. **Configure your credentials in `.env`**:
|
||||||
- `PK`: Your private key for Polymarket
|
- `PK`: Your private key for Polymarket
|
||||||
- `BROWSER_ADDRESS`: Your wallet address
|
- `BROWSER_ADDRESS`: Your wallet address
|
||||||
- `SPREADSHEET_URL`: URL to your Google Sheets configuration
|
|
||||||
|
|
||||||
6. Create a Google Service Account and download credentials:
|
6. **Set up Google Sheets integration**:
|
||||||
|
- Create a Google Service Account and download credentials to the main directory
|
||||||
|
- Copy the [sample Google Sheet](https://docs.google.com/spreadsheets/d/1Kt6yGY7CZpB75cLJJAdWo7LSp9Oz7pjqfuVWwgtn7Ns/edit?gid=1884499063#gid=1884499063)
|
||||||
|
- Add your Google service account to the sheet with edit permissions
|
||||||
|
- Update `SPREADSHEET_URL` in your `.env` file
|
||||||
|
|
||||||
|
7. **Update market data**:
|
||||||
|
- Run `python update_markets.py` to fetch all available markets
|
||||||
|
- This should run continuously in the background (preferably on a different IP than your trading bot)
|
||||||
|
- Add markets you want to trade to the "Selected Markets" sheet. You'd wanna select markets from the "Volatility Markets" sheet.
|
||||||
|
- Configure corresponding parameters in the "Hyperparameters" sheet. Default parameters that worked well in November are there.
|
||||||
|
|
||||||
|
8. **Start the market making bot**:
|
||||||
```
|
```
|
||||||
cp data_updater/credentials.json.example credentials.json
|
python main.py
|
||||||
```
|
```
|
||||||
Edit the credentials.json with your Google service account details.
|
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
|
|||||||
@@ -1,78 +0,0 @@
|
|||||||
# Polymarket Market Maker Data Updater
|
|
||||||
|
|
||||||
This tool analyzes Polymarket prediction markets to identify profitable market making opportunities. It fetches market data, calculates potential rewards, analyzes price volatility, and updates a Google Spreadsheet with the results.
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- Fetches all available Polymarket markets
|
|
||||||
- Calculates rewards based on market maker formulas
|
|
||||||
- Analyzes price volatility over different time windows
|
|
||||||
- Updates Google Sheets with market opportunities sorted by profitability
|
|
||||||
- Automatically runs every 5 minutes
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
- Python 3.7+
|
|
||||||
- A Google Cloud project with Sheets API enabled
|
|
||||||
- Polymarket account with an API key
|
|
||||||
|
|
||||||
## Setup
|
|
||||||
|
|
||||||
1. Clone the repository
|
|
||||||
2. Install dependencies:
|
|
||||||
```
|
|
||||||
pip install -r requirements.txt
|
|
||||||
```
|
|
||||||
3. Create a `.env` file with your private key (see example below)
|
|
||||||
4. Create a Google service account and download `credentials.json`
|
|
||||||
5. Set up your Google Spreadsheet with the following worksheets:
|
|
||||||
- "All Markets"
|
|
||||||
- "Volatility Markets"
|
|
||||||
- "Full Markets"
|
|
||||||
- "Selected Markets"
|
|
||||||
|
|
||||||
## Running the Tool
|
|
||||||
|
|
||||||
```
|
|
||||||
python update_markets.py
|
|
||||||
```
|
|
||||||
|
|
||||||
This will start the continuous update process, refreshing market data every 5 minutes.
|
|
||||||
|
|
||||||
## Configuration Files
|
|
||||||
|
|
||||||
### .env Example
|
|
||||||
|
|
||||||
```
|
|
||||||
PK=your_polygon_wallet_private_key
|
|
||||||
SPREADSHEET_URL=https://docs.google.com/spreadsheets/d/your_spreadsheet_id/edit
|
|
||||||
```
|
|
||||||
|
|
||||||
### credentials.json Example
|
|
||||||
|
|
||||||
This is a Google service account credentials file. Create one at the [Google Cloud Console](https://console.cloud.google.com/):
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"type": "service_account",
|
|
||||||
"project_id": "your-project-id",
|
|
||||||
"private_key_id": "abc123...",
|
|
||||||
"private_key": "-----BEGIN PRIVATE KEY-----\nYOUR_PRIVATE_KEY_HERE\n-----END PRIVATE KEY-----\n",
|
|
||||||
"client_email": "your-service-account@your-project-id.iam.gserviceaccount.com",
|
|
||||||
"client_id": "123456789",
|
|
||||||
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
|
||||||
"token_uri": "https://oauth2.googleapis.com/token",
|
|
||||||
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
|
||||||
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/your-service-account%40your-project-id.iam.gserviceaccount.com"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Security Notes
|
|
||||||
|
|
||||||
- Keep your private key and credentials.json secure
|
|
||||||
- Never commit sensitive files to public repositories
|
|
||||||
- Use environment variables for sensitive information
|
|
||||||
|
|
||||||
## Disclaimer
|
|
||||||
|
|
||||||
This tool is for educational purposes only. Trading cryptocurrency involves significant risk. This is not financial advice.
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"type": "service_account",
|
|
||||||
"project_id": "your-project-id",
|
|
||||||
"private_key_id": "abc123...",
|
|
||||||
"private_key": "-----BEGIN PRIVATE KEY-----\nYOUR_PRIVATE_KEY_HERE\n-----END PRIVATE KEY-----\n",
|
|
||||||
"client_email": "your-service-account@your-project-id.iam.gserviceaccount.com",
|
|
||||||
"client_id": "123456789",
|
|
||||||
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
|
||||||
"token_uri": "https://oauth2.googleapis.com/token",
|
|
||||||
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
|
||||||
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/your-service-account%40your-project-id.iam.gserviceaccount.com"
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
py-clob-client
|
|
||||||
gspread
|
|
||||||
gspread-dataframe
|
|
||||||
pandas
|
|
||||||
@@ -3,7 +3,6 @@ from py_clob_client.client import ClobClient
|
|||||||
from py_clob_client.clob_types import OrderArgs, BalanceAllowanceParams, AssetType
|
from py_clob_client.clob_types import OrderArgs, BalanceAllowanceParams, AssetType
|
||||||
from py_clob_client.order_builder.constants import BUY
|
from py_clob_client.order_builder.constants import BUY
|
||||||
|
|
||||||
from web3.constants import MAX_INT
|
|
||||||
from web3 import Web3
|
from web3 import Web3
|
||||||
from web3.middleware import geth_poa_middleware
|
from web3.middleware import geth_poa_middleware
|
||||||
|
|
||||||
@@ -16,6 +15,8 @@ import time
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
MAX_INT = 2**256 - 1
|
||||||
|
|
||||||
def get_clob_client():
|
def get_clob_client():
|
||||||
host = "https://clob.polymarket.com"
|
host = "https://clob.polymarket.com"
|
||||||
key = os.getenv("PK")
|
key = os.getenv("PK")
|
||||||
|
|||||||
+10
-3
@@ -1,12 +1,19 @@
|
|||||||
py-clob-client
|
py-clob-client==0.20.0
|
||||||
python-dotenv
|
python-dotenv
|
||||||
pandas
|
pandas
|
||||||
gspread
|
gspread
|
||||||
gspread-dataframe
|
gspread-dataframe
|
||||||
sortedcontainers
|
sortedcontainers
|
||||||
websockets==12.0.0
|
black==24.4.2
|
||||||
|
eth-account===0.13.0
|
||||||
|
eth-utils===4.1.1
|
||||||
|
poly_eip712_structs==0.0.1
|
||||||
|
py_order_utils==0.3.2
|
||||||
|
pytest==8.2.2
|
||||||
|
python-dotenv==0.19.2
|
||||||
|
requests==2.32.3
|
||||||
|
websockets==12.0
|
||||||
cryptography==42.0.8
|
cryptography==42.0.8
|
||||||
web3==5.3.1
|
|
||||||
asyncio
|
asyncio
|
||||||
requests
|
requests
|
||||||
google-auth
|
google-auth
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import time
|
import time
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
from trading_utils import get_clob_client
|
from data_updater.trading_utils import get_clob_client
|
||||||
from google_utils import get_spreadsheet
|
from data_updater.google_utils import get_spreadsheet
|
||||||
from find_markets import get_sel_df, get_all_markets, get_all_results, get_markets, add_volatility_to_df
|
from data_updater.find_markets import get_sel_df, get_all_markets, get_all_results, get_markets, add_volatility_to_df
|
||||||
from gspread_dataframe import set_with_dataframe
|
from gspread_dataframe import set_with_dataframe
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
Reference in New Issue
Block a user