聊天记录
共 3 条,显示第 1-3 条
Hey everyone, I'm building a trading bot using Python and py_clob_client_v2, but I'm running into persistent issues when trying to execute Take Profit (TP) and Stop Loss (SL) orders.
My bot manages to enter a position using a Limit Buy, but when it tries to sell for TP/SL, I keep getting this error:
PolyApiException[status_code=400, error_message={'error': 'not enough balance / allowance'}]
I suspect this happens because of partial fills (the bot tries to sell the original target size instead of the actual filled size).
Does anyone have a reliable Python code snippet or best practices on how to properly implement:
1. Dynamic Take Profit / Stop Loss (handling partial fills correctly)
2. Standard Limit vs. Market Sell execution to avoid crossing the book incorrectly?
Any help or examples would be hugely appreciated. Thanks!
Hey everyone, I'm building a trading bot using Python and py_clob_client_v2, but I'm running into persistent issues when trying to execute Take Profit (TP) and Stop Loss (SL) orders.
My bot manages to enter a position using a Limit Buy, but when it tries to sell for TP/SL, I keep getting this error:
PolyApiException[status_code=400, error_message={'error': 'not enough balance / allowance'}]
I suspect this happens because of partial fills (the bot tries to sell the original target size instead of the actual filled size).
Does anyone have a reliable Python code snippet or best practices on how to properly implement:
1. Dynamic Take Profit / Stop Loss (handling partial fills correctly)
2. Standard Limit vs. Market Sell execution to avoid crossing the book incorrectly?
Any help or examples would be hugely appreciated. Thanks!
Hey everyone, I'm building a trading bot using Python and py_clob_client_v2, but I'm running into persistent issues when trying to execute Take Profit (TP) and Stop Loss (SL) orders.
My bot manages to enter a position using a Limit Buy, but when it tries to sell for TP/SL, I keep getting this error:
PolyApiException[status_code=400, error_message={'error': 'not enough balance / allowance'}]
I suspect this happens because of partial fills (the bot tries to sell the original target size instead of the actual filled size).
Does anyone have a reliable Python code snippet or best practices on how to properly implement:
1. Dynamic Take Profit / Stop Loss (handling partial fills correctly)
2. Standard Limit vs. Market Sell execution to avoid crossing the book incorrectly?
Any help or examples would be hugely appreciated. Thanks!
Hey everyone, I'm building a trading bot using Python and py_clob_client_v2, but I'm running into persistent issues when trying to execute Take Profit (TP) and Stop Loss (SL) orders.
My bot manages to enter a position using a Limit Buy, but when it tries to sell for TP/SL, I keep getting this error:
PolyApiException[status_code=400, error_message={'error': 'not enough balance / allowance'}]
I suspect this happens because of partial fills (the bot tries to sell the original target size instead of the actual filled size).
Does anyone have a reliable Python code snippet or best practices on how to properly implement:
1. Dynamic Take Profit / Stop Loss (handling partial fills correctly)
2. Standard Limit vs. Market Sell execution to avoid crossing the book incorrectly?
Any help or examples would be hugely appreciated. Thanks!
Hi, I'm getting this error when trying to post an order via py_clob_client_v2:
Error:
PolyApiException[status_code=400, error_message={'error': 'maker address not allowed, please use the deposit wallet flow'}]
Setup:
- signature_type=2
- FUNDER = same address as derived from private key (get_address() confirmed match)
- Wallet has USDC balance on Polygon (verified on polygonscan)
- API key was generated via client.create_or_derive_api_key() (not from dashboard)
- Approve and Delegate transactions are visible on-chain for this address
Code snippet:
client = ClobClient(
host="https://clob.polymarket.com",
chain_id=137,
key=PRIVATE_KEY,
funder=FUNDER, # same as get_address() result
signature_type=2,
creds=creds
)
order_args = OrderArgs(
price=0.99,
size=1.0,
side=BUY,
token_id=TOKEN_ID,
)
signed = client.create_order(order_args)
resp = client.post_order(signed) # <-- error here
Questions:
1. Does the wallet need to be activated via polymarket.com UI first before API trading works?
2. Is there an on-chain registration step missing that the SDK should handle?
3. What exactly is "deposit wallet flow" and how to trigger it programmatically?
Thanks
Hi, I'm getting this error when trying to post an order via py_clob_client_v2:
Error:
PolyApiException[status_code=400, error_message={'error': 'maker address not allowed, please use the deposit wallet flow'}]
Setup:
- signature_type=2
- FUNDER = same address as derived from private key (get_address() confirmed match)
- Wallet has USDC balance on Polygon (verified on polygonscan)
- API key was generated via client.create_or_derive_api_key() (not from dashboard)
- Approve and Delegate transactions are visible on-chain for this address
Code snippet:
client = ClobClient(
host="https://clob.polymarket.com",
chain_id=137,
key=PRIVATE_KEY,
funder=FUNDER, # same as get_address() result
signature_type=2,
creds=creds
)
order_args = OrderArgs(
price=0.99,
size=1.0,
side=BUY,
token_id=TOKEN_ID,
)
signed = client.create_order(order_args)
resp = client.post_order(signed) # <-- error here
Questions:
1. Does the wallet need to be activated via polymarket.com UI first before API trading works?
2. Is there an on-chain registration step missing that the SDK should handle?
3. What exactly is "deposit wallet flow" and how to trigger it programmatically?
Thanks