mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-06 05:14:38 +08:00
STY: Factors-out event price handling
This commit is contained in:
@@ -288,16 +288,18 @@ class PerformanceTracker(object):
|
||||
|
||||
return _dict
|
||||
|
||||
def process_trade(self, event):
|
||||
# update last sale, and pay out a cash adjustment
|
||||
def _handle_event_price(self, event):
|
||||
# updates last sale, and pays out a cash adjustment if applicable
|
||||
cash_adjustment = self.position_tracker.update_last_sale(event)
|
||||
if cash_adjustment != 0:
|
||||
for perf_period in self.perf_periods:
|
||||
perf_period.handle_cash_payment(cash_adjustment)
|
||||
|
||||
def process_trade(self, event):
|
||||
self._handle_event_price(event)
|
||||
|
||||
def process_transaction(self, event):
|
||||
# Transaction events also count as trade events for the trackers
|
||||
self.process_trade(event)
|
||||
self._handle_event_price(event)
|
||||
self.txn_count += 1
|
||||
self.position_tracker.execute_transaction(event)
|
||||
for perf_period in self.perf_periods:
|
||||
|
||||
Reference in New Issue
Block a user