Replies: 3 comments 1 reply
-
|
sorry for the bad markup, I was in a hurry |
Beta Was this translation helpful? Give feedback.
-
|
Better to reference
I tested your code using |
Beta Was this translation helpful? Give feedback.
-
|
I'm looking at this because drawdown monitoring has two separate failure modes: false repeated warnings and late/no warning when account state goes stale after reconnect. I'm testing a small read-only IBKR monitor around disconnects, stale account state, margin stress, and order/reject anomalies. If this is still relevant in your setup, happy to compare notes. No trading/signals/credentials involved. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey all, I am very new to python and async outside of browser. My goal here is for this to run as a second client " client_id=2", to protect myself from a failure due to tws fat fingers or from client 1 from doing something unintended(lets be real, I am not worried about tws fat fingers).
Either I get infinite "Warning :Loss threshold of -1.00 exceeded with daily PnL: -1776.51 at 2024-08-27 12:48:28" or I get that message once and it quits.
Looking for the Python gods to smile down upon me with pitty. Mocking in the comments accepted and welcome. :)
`import logging
from datetime import datetime
import pytz
from ib_async import IB, MarketOrder
class SimplePnLStrategy:
def init(self, host='127.0.0.1', port=7497, client_id=2, loss_threshold=-1):
self.host = host
self.port = port
self.client_id = client_id
if name == "main":
logging.info("Script is starting...")
strategy = SimplePnLStrategy()
strategy.run()
logging.info("Script has finished.")
`
Beta Was this translation helpful? Give feedback.
All reactions