Skip to content

Commit

Permalink
Update docs / update positions command (#24)
Browse files Browse the repository at this point in the history
* Update docs
* add condition id to positions
  • Loading branch information
PolyTrader authored Jul 21, 2021
1 parent f1cb2bd commit 7ce9ef6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
Simple cli tool for trading on PolyMarket

### Installation on Windows
- Install [Python](https://www.microsoft.com/en-us/p/python-39/9p7qfqmjrfp7?activetab=pivot:overviewtab)
- Install [Python](https://www.microsoft.com/en-us/p/python-39/9p7qfqmjrfp7?activetab=pivot:overviewtab) from Microsoft
* or download the [Python installer](https://www.python.org/ftp/python/3.9.6/python-3.9.6-amd64.exe) directly
- Install [Visual Studio](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=16) C++ Build Tools
- Open a terminal
- Run `pip install polymarket-trading`
- Run `pm-trade -h` to display help

### Trading Setup
- Create a new wallet on the matic chain
- Create your matic endpoint on https://rpc.maticvigil.com/
- Create your matic RPC endpoint on https://rpc.maticvigil.com/ (or other RPC provider)
- Set env variables
- POLYGON_PRIVATE_KEY
- MATIC_VIGIL_RPC_KEY
- MATIC_VIGIL_RPC_KEY or RPC_URI
- Fund your trading wallet with matic and usdc

#### Made some money from this tool and want to contribute? Donate to these charities.
Expand Down
9 changes: 5 additions & 4 deletions polymarket/positions.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,16 @@ def list_positions(web3_provider, user):
outcome_prices = get_chain_price(web3_provider, mkt_id, condition_id, num_outcomes)
outcome_price = outcome_prices[int(pos['outcomeIndex'])]

positions[mkt_id]['condition_id'] = condition_id
positions[mkt_id]['positions'][int(pos['outcomeIndex'])] = (outcome_label, pos['netQuantity'], outcome_price,
pos['netValue'])

print("-"*80)
print("Question")
print(" position / number shares / share price / position value ")
print("Question (condition id)")
print(" position / number shares / share price / position value / condition id")
for _, v in positions.items():
print("-" * 80)
print(v['question'])
print(f"{v['question']} ({v['condition_id']})")

for z in v['positions']:
if z is not None:
Expand All @@ -99,4 +100,4 @@ def list_positions(web3_provider, user):
share_price = float(z[2])
position_value = num_shares * share_price

print(f" {position_name} / {num_shares:.6f} / {share_price:.4f} / ${position_value:.4f}")
print(f" {position_name} / {num_shares:.6f} / {share_price:.4f} / ${position_value:.4f} ")
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = polymarket_trading
version = 0.1.3
version = 0.1.4
author = PolyTrader
description = A collection of tools for trading on polymarket.com
long_description = file: README.md
Expand Down

0 comments on commit 7ce9ef6

Please sign in to comment.