Skip to content

Commit

Permalink
executed a trade automatically!
Browse files Browse the repository at this point in the history
  • Loading branch information
alexnicita committed Aug 5, 2024
1 parent 5a1adbd commit b1b1a36
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions connectors/polymarket.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ def __init__(self):
self.neg_risk_exchange_address = "0xC5d563A36AE78145C45a50134d48A1215220f80a"

self._init_api_keys()
self._init_approvals(
False
) # set to True first time running this! (could use an env var)
self._init_approvals(False)

def _init_api_keys(self):
self.client = ClobClient(
Expand Down Expand Up @@ -324,6 +322,7 @@ def execute_market_order(self, amount, token_id):
amount=amount,
)
signed_order = self.client.create_market_order(order_args)
print("Execute market order... signed_order ", signed_order)
resp = self.client.post_order(signed_order, orderType=OrderType.FOK)
print(resp)
print("Done!")
Expand Down Expand Up @@ -436,13 +435,17 @@ def main():
)
test_market_data = p.get_market(test_market_token_id)

test_size = 0.0001
# test_size = 0.0001
test_size = 1
test_side = BUY
test_price = float(ast.literal_eval(test_market_data["outcome_prices"])[0])

order = p.execute_order(
test_price,
test_size,
test_side,
test_market_token_id,
)
#order = p.execute_order(
# test_price,
# test_size,
# test_side,
# test_market_token_id,
#)

order = p.execute_market_order(test_price, test_market_token_id)

0 comments on commit b1b1a36

Please sign in to comment.