-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added logs for trade processing #490
Conversation
My review is in progress 📖 - I will have feedback for you in a few minutes! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reviewed your code and found 4 potential issues. To discuss my individual comments that I have added, tag me in replies using @korbit-ai.
Please react with a 👍 to my comments that you find helpful and a 👎 to those you find unhelpful - this will help me learn and improve as we collaborate.
@@ -625,6 +625,9 @@ def on_trade_event_poll(): | |||
|
|||
@broker.stream.add_action(broker.NEW_ORDER) | |||
def on_trade_event_new(order): | |||
# Log that the order was submitted | |||
logging.info(f"Processing action for new order {order}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.logger.info( | ||
f"Processing held trade event. Trade event received for stored_order: {stored_order}, type_event: {type_event}, price: {price}, filled_quantity: {filled_quantity}, multiplier: {multiplier}" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -199,18 +202,33 @@ def add_event(self, event_name, payload): | |||
self.queue.put((event_name, payload)) | |||
|
|||
def process_event(self, event, payload): | |||
# Log that we are processing an event. | |||
self.strategy.logger.info(f"Processing event: {event}, payload: {payload}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def __init__(self, strategy, asset, quantity, orders=None, hold=0, available=0, avg_fill_price=None): | ||
self.strategy = strategy | ||
self.asset = asset | ||
self.symbol = self.asset.symbol | ||
self.orders = None | ||
self.avg_fill_price = avg_fill_price |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that you've added an 'avg_fill_price' attribute to the Position class, but it doesn't seem to be used anywhere in the class methods. If this attribute is not needed, I would recommend removing it to avoid confusion. If it is needed, please consider adding methods that use or manipulate this attribute, and add comments explaining its purpose and usage.
No description provided.