Replies: 2 comments 1 reply
-
sorry for the bad markup, I was in a hurry |
Beta Was this translation helpful? Give feedback.
0 replies
-
Better to reference
I tested your code using |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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